Fixed non-armour and non-sigil items

This commit is contained in:
WayofTime 2015-07-30 08:44:01 -04:00
parent 8241c3cbd1
commit 9e2c0e6e74
72 changed files with 483 additions and 1411 deletions

View file

@ -4,6 +4,7 @@ import java.util.Iterator;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
@ -12,7 +13,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
@ -20,7 +23,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.IThrowableEntity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
//Shamelessly ripped off from x3n0ph0b3
public class EnergyBlastProjectile extends Entity implements IProjectile, IThrowableEntity
@ -53,7 +55,6 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
super(par1World);
this.setSize(0.5F, 0.5F);
this.setPosition(par2, par4, par6);
yOffset = 0.0F;
this.maxTicksInAir = 600;
}
@ -68,7 +69,6 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
posY -= 0.2D;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
@ -88,7 +88,6 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
posY -= 0.2D;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
@ -104,7 +103,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
this.shootingEntity = par2EntityLivingBase;
this.posY = par2EntityLivingBase.posY + (double) par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D;
double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX;
double d1 = par3EntityLivingBase.boundingBox.minY + (double) (par3EntityLivingBase.height / 1.5F) - this.posY;
double d1 = par3EntityLivingBase.getBoundingBox().minY + (double) (par3EntityLivingBase.height / 1.5F) - this.posY;
double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ;
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
@ -115,7 +114,6 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3);
this.yOffset = 0.0F;
float f4 = (float) d3 * 0.2F;
this.setThrowableHeading(d0, d1, d2, par4, par5);
}
@ -155,18 +153,6 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
}
@Override
@SideOnly(Side.CLIENT)
/**
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
* posY, posZ, yaw, pitch
*/
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
{
this.setPosition(par1, par3, par5);
this.setRotation(par7, par8);
}
@Override
@SideOnly(Side.CLIENT)
/**
@ -233,28 +219,21 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI);
}
Block var16 = worldObj.getBlock(xTile, yTile, zTile);
IBlockState state = worldObj.getBlockState(new BlockPos(xTile, yTile, zTile));
Block var16 = state.getBlock();
if (var16 != null)
{
var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
var16.setBlockBoundsBasedOnState(worldObj, new BlockPos(xTile, yTile, zTile));
AxisAlignedBB var2 = var16.getCollisionBoundingBox(worldObj, new BlockPos(xTile, yTile, zTile), state);
if (var2 != null && var2.isVecInside(SpellHelper.createVec3(posX, posY, posZ)))
if (var2 != null && var2.isVecInside(new Vec3(posX, posY, posZ)))
{
inGround = true;
}
}
if (inGround)
{
Block var18 = worldObj.getBlock(xTile, yTile, zTile);
int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile);
if (var18.equals(Block.getBlockById(inTile)) && var19 == inData)
{
}
} else
if (!inGround)
{
++ticksInAir;
@ -266,19 +245,19 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
}
}
Vec3 var17 = SpellHelper.createVec3(posX, posY, posZ);
Vec3 var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ);
MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false);
var17 = SpellHelper.createVec3(posX, posY, posZ);
var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ);
Vec3 var17 = new Vec3(posX, posY, posZ);
Vec3 var3 = new Vec3(posX + motionX, posY + motionY, posZ + motionZ);
MovingObjectPosition var4 = worldObj.rayTraceBlocks(var17, var3, true, false, false);
var17 = new Vec3(posX, posY, posZ);
var3 = new Vec3(posX + motionX, posY + motionY, posZ + motionZ);
if (var4 != null)
{
var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord);
var3 = new Vec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord);
}
Entity var5 = null;
List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, getBoundingBox().addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
double var7 = 0.0D;
Iterator var9 = var6.iterator();
float var11;
@ -290,7 +269,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5))
{
var11 = 0.3F;
AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11);
AxisAlignedBB var12 = var10.getBoundingBox().expand(var11, var11, var11);
MovingObjectPosition var13 = var12.calculateIntercept(var17, var3);
if (var13 != null)
@ -331,8 +310,8 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
public void doFiringParticles()
{
worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
worldObj.spawnParticle(EnumParticleTypes.SPELL_MOB_AMBIENT, posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
worldObj.spawnParticle(EnumParticleTypes.FLAME, posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
/**
@ -379,13 +358,6 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
return false;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
/**
* Sets the amount of knockback the arrow applies when it hits a mob.
*/
@ -462,20 +434,15 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow
worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, (float) (0.1), true);
}
spawnHitParticles("magicCrit", 8);
spawnHitParticles(EnumParticleTypes.CRIT_MAGIC, 8);
this.setDead();
}
private int d6()
{
return rand.nextInt(6) + 1;
}
protected void spawnHitParticles(String string, int i)
protected void spawnHitParticles(EnumParticleTypes type, int i)
{
for (int particles = 0; particles < i; particles++)
{
worldObj.spawnParticle(string, posX, posY - (string == "portal" ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
worldObj.spawnParticle(type, posX, posY - (type == EnumParticleTypes.PORTAL ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
}