Fixed Hammer of Notch projectiles

This commit is contained in:
Kino 2016-12-20 19:57:42 -05:00
parent ecbcf27a3b
commit 8c96eb503f

View file

@ -20,6 +20,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.world.World;
public class EntityHammerProjectile extends Entity implements IProjectile
@ -234,7 +235,7 @@ public class EntityHammerProjectile extends Entity implements IProjectile
}
}
if (rayTraceResult != null)
if (rayTraceResult != null && rayTraceResult.typeOfHit == Type.ENTITY)
{
if (rayTraceResult.entityHit instanceof EntitySaddleMount && ((EntitySaddleMount)rayTraceResult.entityHit).getSaddled())
{
@ -249,6 +250,19 @@ public class EntityHammerProjectile extends Entity implements IProjectile
if (movingobjectposition != null)
{
if (movingobjectposition.typeOfHit == Type.ENTITY)
{
if (movingobjectposition.entityHit instanceof EntitySaddleMount && ((EntitySaddleMount)movingobjectposition.entityHit).getSaddled())
{
}
else if (movingobjectposition.entityHit != this.thrower)
{
movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.thrower), 5);
movingobjectposition.entityHit.addVelocity(this.motionX, 0.6D, this.motionZ);
}
}
for (int l = (int) (this.posX - 3); l <= this.posX + 3; l++)
{
for (int i1 = (int) (this.posY - 3); i1 <= this.posY + 3; i1++)
@ -274,16 +288,6 @@ public class EntityHammerProjectile extends Entity implements IProjectile
}
}
if (movingobjectposition.entityHit instanceof EntitySaddleMount && ((EntitySaddleMount)movingobjectposition.entityHit).getSaddled())
{
}
else if (movingobjectposition != null && movingobjectposition.entityHit != this.thrower)
{
movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.thrower), 5);
movingobjectposition.entityHit.addVelocity(this.motionX, 0.6D, this.motionZ);
}
for (int j = 0; j < 8; j++)
{
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);