diff --git a/src/main/java/electroblob/wizardry/WizardryEventHandler.java b/src/main/java/electroblob/wizardry/WizardryEventHandler.java index 61dd4c2b..e0754c16 100644 --- a/src/main/java/electroblob/wizardry/WizardryEventHandler.java +++ b/src/main/java/electroblob/wizardry/WizardryEventHandler.java @@ -281,7 +281,7 @@ public final class WizardryEventHandler { .target(attacker).spawn(world); ParticleBuilder.spawnShockParticles(world, attacker.posX, - attacker.getEntityBoundingBox().minY + attacker.height / 2, attacker.posZ); + attacker.posY + attacker.height / 2, attacker.posZ); } DamageSafetyChecker.attackEntitySafely(attacker, MagicDamage.causeDirectMagicDamage(event.getEntityLiving(), diff --git a/src/main/java/electroblob/wizardry/client/animation/ActionAnimation.java b/src/main/java/electroblob/wizardry/client/animation/ActionAnimation.java index 6c5b94c6..70f3d092 100644 --- a/src/main/java/electroblob/wizardry/client/animation/ActionAnimation.java +++ b/src/main/java/electroblob/wizardry/client/animation/ActionAnimation.java @@ -3,6 +3,7 @@ package electroblob.wizardry.client.animation; import electroblob.wizardry.data.WizardData; import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.spell.Grapple; +import electroblob.wizardry.util.GeometryUtils; import electroblob.wizardry.util.InventoryUtils; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.EntityLivingBase; @@ -100,7 +101,7 @@ public abstract class ActionAnimation extends Animation { if(hit.entityHit instanceof EntityLivingBase){ // If the target is an entity, we need to use the entity's centre rather than the original hit position // because the entity will have moved! - target = new Vec3d(hit.entityHit.posX, hit.entityHit.getEntityBoundingBox().minY + hit.entityHit.height/2, hit.entityHit.posZ); + target = GeometryUtils.getCentre(hit.entityHit); } EnumHandSide side = InventoryUtils.getSideForHand(player, player.getActiveHand()); diff --git a/src/main/java/electroblob/wizardry/client/particle/ParticleTargeted.java b/src/main/java/electroblob/wizardry/client/particle/ParticleTargeted.java index aff023a6..100016ef 100644 --- a/src/main/java/electroblob/wizardry/client/particle/ParticleTargeted.java +++ b/src/main/java/electroblob/wizardry/client/particle/ParticleTargeted.java @@ -95,7 +95,7 @@ public abstract class ParticleTargeted extends ParticleWizardry { if(this.target != null){ this.targetX = this.target.prevPosX + (this.target.posX - this.target.prevPosX) * partialTicks; - double correction = this.target.getEntityBoundingBox().minY - this.target.posY; + double correction = this.target.posY - this.target.posY; this.targetY = this.target.prevPosY + (this.target.posY - this.target.prevPosY) * partialTicks + target.height/2 + correction; this.targetZ = this.target.prevPosZ + (this.target.posZ - this.target.prevPosZ) * partialTicks; diff --git a/src/main/java/electroblob/wizardry/client/particle/ParticleWizardry.java b/src/main/java/electroblob/wizardry/client/particle/ParticleWizardry.java index 57a5f74b..d957163a 100644 --- a/src/main/java/electroblob/wizardry/client/particle/ParticleWizardry.java +++ b/src/main/java/electroblob/wizardry/client/particle/ParticleWizardry.java @@ -206,7 +206,7 @@ public abstract class ParticleWizardry extends Particle { this.entity = entity; // Set these to the correct values if(entity != null){ - this.setPosition(this.entity.posX + relativeX, this.entity.getEntityBoundingBox().minY + this.setPosition(this.entity.posX + relativeX, this.entity.posY + relativeY, this.entity.posZ + relativeZ); this.prevPosX = this.posX; this.prevPosY = this.posY; diff --git a/src/main/java/electroblob/wizardry/client/renderer/entity/RenderFireRing.java b/src/main/java/electroblob/wizardry/client/renderer/entity/RenderFireRing.java index b25446b2..b935f29f 100644 --- a/src/main/java/electroblob/wizardry/client/renderer/entity/RenderFireRing.java +++ b/src/main/java/electroblob/wizardry/client/renderer/entity/RenderFireRing.java @@ -82,7 +82,7 @@ public class RenderFireRing extends Render { float f2 = 0.5F; float f3 = 0.0F; float f4 = 0.2f; - float f5 = (float)(entity.posY - entity.getEntityBoundingBox().minY); + float f5 = (float)(entity.posY - entity.posY); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f61 = 0.0F; int i = 0; @@ -129,7 +129,7 @@ public class RenderFireRing extends Render { float f2 = 0.5F; float f3 = 0.0F; float f4 = 0.2f; - float f5 = (float)(entity.posY - entity.getEntityBoundingBox().minY); + float f5 = (float)(entity.posY - entity.posY); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f61 = 0.0F; int i = 0; diff --git a/src/main/java/electroblob/wizardry/entity/construct/EntityHammer.java b/src/main/java/electroblob/wizardry/entity/construct/EntityHammer.java index f5aa3819..40ba1997 100644 --- a/src/main/java/electroblob/wizardry/entity/construct/EntityHammer.java +++ b/src/main/java/electroblob/wizardry/entity/construct/EntityHammer.java @@ -121,7 +121,7 @@ public class EntityHammer extends EntityMagicConstruct { ParticleBuilder.create(Type.LIGHTNING).pos(posX, posY + height - 0.1, posZ) .target(target).spawn(world); ParticleBuilder.spawnShockParticles(world, target.posX, - target.getEntityBoundingBox().minY + target.height, target.posZ); + target.posY + target.height, target.posZ); } target.playSound(WizardrySounds.ENTITY_HAMMER_ATTACK, 1.0F, rand.nextFloat() * 0.4F + 1.5F); diff --git a/src/main/java/electroblob/wizardry/entity/construct/EntityLightningSigil.java b/src/main/java/electroblob/wizardry/entity/construct/EntityLightningSigil.java index 197497f7..63cc1325 100644 --- a/src/main/java/electroblob/wizardry/entity/construct/EntityLightningSigil.java +++ b/src/main/java/electroblob/wizardry/entity/construct/EntityLightningSigil.java @@ -81,7 +81,7 @@ public class EntityLightningSigil extends EntityScaledConstruct { .pos(0, target.height/2, 0).target(secondaryTarget).spawn(world); ParticleBuilder.spawnShockParticles(world, secondaryTarget.posX, - secondaryTarget.getEntityBoundingBox().minY + secondaryTarget.height / 2, + secondaryTarget.posY + secondaryTarget.height / 2, secondaryTarget.posZ); } diff --git a/src/main/java/electroblob/wizardry/entity/construct/EntityStormcloud.java b/src/main/java/electroblob/wizardry/entity/construct/EntityStormcloud.java index 2f034c7f..e36512de 100644 --- a/src/main/java/electroblob/wizardry/entity/construct/EntityStormcloud.java +++ b/src/main/java/electroblob/wizardry/entity/construct/EntityStormcloud.java @@ -53,7 +53,7 @@ public class EntityStormcloud extends EntityScaledConstruct { }else{ ParticleBuilder.create(Type.LIGHTNING).pos(target.posX, posY + height/2, target.posZ) .target(target).scale(2).spawn(world); - ParticleBuilder.spawnShockParticles(world, target.posX, target.getEntityBoundingBox().minY + target.height, target.posZ); + ParticleBuilder.spawnShockParticles(world, target.posX, target.posY + target.height, target.posZ); } target.playSound(WizardrySounds.ENTITY_STORMCLOUD_THUNDER, 1, 1.6f); diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityAIAttackSpell.java b/src/main/java/electroblob/wizardry/entity/living/EntityAIAttackSpell.java index c559a919..f8a75ac1 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityAIAttackSpell.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityAIAttackSpell.java @@ -117,7 +117,7 @@ public class EntityAIAttackSpell extends // Only executed server side. - double distanceSq = this.attacker.getDistanceSq(this.target.posX, this.target.getEntityBoundingBox().minY, + double distanceSq = this.attacker.getDistanceSq(this.target.posX, this.target.posY, this.target.posZ); boolean targetIsVisible = this.attacker.getEntitySenses().canSee(this.target); diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityDecoy.java b/src/main/java/electroblob/wizardry/entity/living/EntityDecoy.java index f704a0ca..9c4df7ac 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityDecoy.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityDecoy.java @@ -44,7 +44,7 @@ public class EntityDecoy extends EntitySummonedCreature { if(world.isRemote){ for(int i = 0; i < 20; i++){ ParticleBuilder.create(Type.DUST) - .pos(this.posX + (this.rand.nextDouble() - 0.5) * this.width, this.getEntityBoundingBox().minY + .pos(this.posX + (this.rand.nextDouble() - 0.5) * this.width, this.posY + this.rand.nextDouble() * this.height, this.posZ + (this.rand.nextDouble() - 0.5) * this.width) .time(40) .clr(0.2f, 1.0f, 0.8f) diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicArrow.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicArrow.java index 5c7221a8..0c7c011f 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicArrow.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicArrow.java @@ -90,7 +90,7 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE this.setCaster(caster); - this.setLocationAndAngles(caster.posX, caster.getEntityBoundingBox().minY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET, + this.setLocationAndAngles(caster.posX, caster.posY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET, caster.posZ, caster.rotationYaw, caster.rotationPitch); this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); @@ -117,10 +117,10 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE this.setCaster(caster); - this.posY = caster.getEntityBoundingBox().minY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET; + this.posY = caster.posY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET; double dx = target.posX - caster.posX; - double dy = this.doGravity() ? target.getEntityBoundingBox().minY + (double)(target.height / 3.0f) - this.posY - : target.getEntityBoundingBox().minY + (double)(target.height / 2.0f) - this.posY; + double dy = this.doGravity() ? target.posY + (double)(target.height / 3.0f) - this.posY + : target.posY + (double)(target.height / 2.0f) - this.posY; double dz = target.posZ - caster.posZ; double horizontalDistance = (double)MathHelper.sqrt(dx * dx + dz * dz); diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicProjectile.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicProjectile.java index fa94a473..edf5386e 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicProjectile.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicProjectile.java @@ -48,7 +48,7 @@ public abstract class EntityMagicProjectile extends EntityThrowable implements I /** Sets the shooter of the projectile to the given caster, positions the projectile at the given caster's eyes and * aims it in the direction they are looking with the given speed. */ public void aim(EntityLivingBase caster, float speed){ - this.setPosition(caster.posX, caster.getEntityBoundingBox().minY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET, caster.posZ); + this.setPosition(caster.posX, caster.posY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET, caster.posZ); // This is the standard set of parameters for this method, used by snowballs and ender pearls amongst others. this.shoot(caster, caster.rotationPitch, caster.rotationYaw, 0.0f, speed, 1.0f); this.thrower = caster; @@ -66,10 +66,10 @@ public abstract class EntityMagicProjectile extends EntityThrowable implements I // Mojang's 'fix' for the projectile-hitting-thrower bug actually made the problem worse, hence the following line. this.ignoreEntity = thrower; - this.posY = caster.getEntityBoundingBox().minY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET; + this.posY = caster.posY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET; double dx = target.posX - caster.posX; - double dy = !this.hasNoGravity() ? target.getEntityBoundingBox().minY + (double)(target.height / 3.0f) - this.posY - : target.getEntityBoundingBox().minY + (double)(target.height / 2.0f) - this.posY; + double dy = !this.hasNoGravity() ? target.posY + (double)(target.height / 3.0f) - this.posY + : target.posY + (double)(target.height / 2.0f) - this.posY; double dz = target.posZ - caster.posZ; double horizontalDistance = MathHelper.sqrt(dx * dx + dz * dz); diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntitySparkBomb.java b/src/main/java/electroblob/wizardry/entity/projectile/EntitySparkBomb.java index 53e0e145..facb0dd0 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntitySparkBomb.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntitySparkBomb.java @@ -81,7 +81,7 @@ public class EntitySparkBomb extends EntityBomb { }else{ ParticleBuilder.create(Type.LIGHTNING).pos(this.getPositionVector()).target(target).spawn(world); - ParticleBuilder.spawnShockParticles(world, target.posX, target.getEntityBoundingBox().minY + target.height/2, target.posZ); + ParticleBuilder.spawnShockParticles(world, target.posX, target.posY + target.height/2, target.posZ); } } } diff --git a/src/main/java/electroblob/wizardry/item/ItemArtefact.java b/src/main/java/electroblob/wizardry/item/ItemArtefact.java index 4174b4ea..45749116 100644 --- a/src/main/java/electroblob/wizardry/item/ItemArtefact.java +++ b/src/main/java/electroblob/wizardry/item/ItemArtefact.java @@ -609,7 +609,7 @@ public class ItemArtefact extends Item { .pos(0, event.getEntity().height/2, 0).target(target).spawn(player.world); ParticleBuilder.spawnShockParticles(player.world, target.posX, - target.getEntityBoundingBox().minY + target.height/2, target.posZ); + target.posY + target.height/2, target.posZ); } DamageSafetyChecker.attackEntitySafely(target, MagicDamage.causeDirectMagicDamage(player, @@ -693,7 +693,7 @@ public class ItemArtefact extends Item { .pos(0, event.getEntity().height/2, 0).target(target).spawn(world); ParticleBuilder.spawnShockParticles(world, target.posX, - target.getEntityBoundingBox().minY + target.height/2, target.posZ); + target.posY + target.height/2, target.posZ); } DamageSafetyChecker.attackEntitySafely(target, MagicDamage.causeDirectMagicDamage(player, diff --git a/src/main/java/electroblob/wizardry/item/ItemLightningHammer.java b/src/main/java/electroblob/wizardry/item/ItemLightningHammer.java index 6ae8b69c..455dc3bf 100644 --- a/src/main/java/electroblob/wizardry/item/ItemLightningHammer.java +++ b/src/main/java/electroblob/wizardry/item/ItemLightningHammer.java @@ -210,7 +210,7 @@ public class ItemLightningHammer extends Item implements IConjuredItem { if(hit.world.isRemote){ ParticleBuilder.create(Type.LIGHTNING).pos(hit.getPositionVector().add(0, hit.height / 2, 0)) .target(target).spawn(hit.world); - ParticleBuilder.spawnShockParticles(hit.world, target.posX, target.getEntityBoundingBox().minY + target.height / 2, target.posZ); + ParticleBuilder.spawnShockParticles(hit.world, target.posX, target.posY + target.height / 2, target.posZ); } //target.playSound(WizardrySounds.SPELL_SPARK, 1, 1.5f + 0.4f * world.rand.nextFloat()); diff --git a/src/main/java/electroblob/wizardry/item/ItemPurifyingElixir.java b/src/main/java/electroblob/wizardry/item/ItemPurifyingElixir.java index 785ed409..62607cdf 100644 --- a/src/main/java/electroblob/wizardry/item/ItemPurifyingElixir.java +++ b/src/main/java/electroblob/wizardry/item/ItemPurifyingElixir.java @@ -59,7 +59,7 @@ public class ItemPurifyingElixir extends Item { for(int i = 0; i < 20; i++){ double x = entity.posX + world.rand.nextDouble() * 2 - 1; - double y = entity.getEntityBoundingBox().minY + entity.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = entity.posY + entity.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = entity.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.14, 0).clr(0x0f001b) .time(20 + world.rand.nextInt(12)).spawn(world); diff --git a/src/main/java/electroblob/wizardry/item/ItemWand.java b/src/main/java/electroblob/wizardry/item/ItemWand.java index b22cb6b8..5d5cb2e6 100644 --- a/src/main/java/electroblob/wizardry/item/ItemWand.java +++ b/src/main/java/electroblob/wizardry/item/ItemWand.java @@ -847,7 +847,7 @@ public class ItemWand extends Item implements IWorkbenchItem, ISpellCastingItem, if(player.world.isRemote){ - Vec3d origin = new Vec3d(player.posX, player.getEntityBoundingBox().minY + player.getEyeHeight(), player.posZ); + Vec3d origin = player.getPositionEyes(1); Vec3d hit = origin.add(player.getLookVec().scale(player.getDistance(event.getTarget()))); // Generate two perpendicular vectors in the plane perpendicular to the look vec Vec3d vec1 = player.getLookVec().rotatePitch(90); diff --git a/src/main/java/electroblob/wizardry/misc/Forfeit.java b/src/main/java/electroblob/wizardry/misc/Forfeit.java index 54a98178..3f9da890 100644 --- a/src/main/java/electroblob/wizardry/misc/Forfeit.java +++ b/src/main/java/electroblob/wizardry/misc/Forfeit.java @@ -190,7 +190,7 @@ public abstract class Forfeit { add(Tier.APPRENTICE, Element.FIRE, create("fireball", (w, p) -> { if(!w.isRemote){ EntityMagicFireball fireball = new EntityMagicFireball(w); - Vec3d vec = p.getPositionEyes(0).add(p.getLookVec().scale(6)); + Vec3d vec = p.getPositionEyes(1).add(p.getLookVec().scale(6)); fireball.setPosition(vec.x, vec.y, vec.z); fireball.shoot(p.posX, p.posY + p.getEyeHeight(), p.posZ, 1.5f, 1); w.spawnEntity(fireball); diff --git a/src/main/java/electroblob/wizardry/potion/ICustomPotionParticles.java b/src/main/java/electroblob/wizardry/potion/ICustomPotionParticles.java index ab0ec6e0..5bcc6423 100644 --- a/src/main/java/electroblob/wizardry/potion/ICustomPotionParticles.java +++ b/src/main/java/electroblob/wizardry/potion/ICustomPotionParticles.java @@ -53,7 +53,7 @@ public interface ICustomPotionParticles extends ISyncedPotion { double x = event.getEntityLiving().posX + (event.getEntityLiving().world.rand.nextDouble() - 0.5) * event.getEntityLiving().width; - double y = event.getEntityLiving().getEntityBoundingBox().minY + double y = event.getEntityLiving().posY + event.getEntityLiving().world.rand.nextDouble() * event.getEntityLiving().height; double z = event.getEntityLiving().posZ + (event.getEntityLiving().world.rand.nextDouble() - 0.5) * event.getEntityLiving().width; diff --git a/src/main/java/electroblob/wizardry/potion/PotionContainment.java b/src/main/java/electroblob/wizardry/potion/PotionContainment.java index a29e9831..6fc5a19a 100644 --- a/src/main/java/electroblob/wizardry/potion/PotionContainment.java +++ b/src/main/java/electroblob/wizardry/potion/PotionContainment.java @@ -54,7 +54,7 @@ public class PotionContainment extends PotionMagicEffect { if(target.getEntityBoundingBox().minX < origin.x - maxDistance) x = origin.x - maxDistance + target.width/2; if(target.getEntityBoundingBox().maxY > origin.y + maxDistance) y = origin.y + maxDistance - target.height; - if(target.getEntityBoundingBox().minY < origin.y - maxDistance) y = origin.y - maxDistance; + if(target.posY < origin.y - maxDistance) y = origin.y - maxDistance; if(target.getEntityBoundingBox().maxZ > origin.z + maxDistance) z = origin.z + maxDistance - target.width/2; if(target.getEntityBoundingBox().minZ < origin.z - maxDistance) z = origin.z - maxDistance + target.width/2; @@ -67,7 +67,7 @@ public class PotionContainment extends PotionMagicEffect { // for(int i = 0; i < 20; i++){ // ParticleBuilder.create(ParticleBuilder.Type.DUST).pos( // x, -// target.getEntityBoundingBox().minY + target.height * target.world.rand.nextFloat(), +// target.posY + target.height * target.world.rand.nextFloat(), // target.posZ + target.width * (target.world.rand.nextFloat() - 0.5f)) // .face(EnumFacing.EAST).clr(0.8f, 0.9f, 1).spawn(target.world); // } @@ -87,7 +87,7 @@ public class PotionContainment extends PotionMagicEffect { // for(int i = 0; i < 20; i++){ // ParticleBuilder.create(ParticleBuilder.Type.DUST).pos( // target.posX + target.width * (target.world.rand.nextFloat() - 0.5f), -// target.getEntityBoundingBox().minY + target.height * target.world.rand.nextFloat(), +// target.posY + target.height * target.world.rand.nextFloat(), // z) // .face(EnumFacing.SOUTH).clr(0.8f, 0.9f, 1).spawn(target.world); // } diff --git a/src/main/java/electroblob/wizardry/spell/Arc.java b/src/main/java/electroblob/wizardry/spell/Arc.java index 5fe363a0..1e429106 100644 --- a/src/main/java/electroblob/wizardry/spell/Arc.java +++ b/src/main/java/electroblob/wizardry/spell/Arc.java @@ -31,7 +31,7 @@ public class Arc extends SpellRay { // Rather neatly, the entity can be set here and if it's null nothing will happen. ParticleBuilder.create(Type.LIGHTNING).entity(caster) .pos(caster != null ? origin.subtract(caster.getPositionVector()) : origin).target(target).spawn(world); - ParticleBuilder.spawnShockParticles(world, target.posX, target.getEntityBoundingBox().minY + target.height/2, target.posZ); + ParticleBuilder.spawnShockParticles(world, target.posX, target.posY + target.height/2, target.posZ); } // This is a lot neater than it was, thanks to the damage type system. diff --git a/src/main/java/electroblob/wizardry/spell/ArcaneJammer.java b/src/main/java/electroblob/wizardry/spell/ArcaneJammer.java index 4f5b9e11..eac89a9a 100644 --- a/src/main/java/electroblob/wizardry/spell/ArcaneJammer.java +++ b/src/main/java/electroblob/wizardry/spell/ArcaneJammer.java @@ -109,7 +109,7 @@ public class ArcaneJammer extends SpellRay { if(event.getWorld().isRemote){ - Vec3d centre = event.getCaster().getPositionEyes(0).add(event.getCaster().getLookVec()); + Vec3d centre = event.getCaster().getPositionEyes(1).add(event.getCaster().getLookVec()); for(int i = 0; i < 5; i++){ double x = centre.x + 0.5f * (event.getWorld().rand.nextFloat() - 0.5f); diff --git a/src/main/java/electroblob/wizardry/spell/Banish.java b/src/main/java/electroblob/wizardry/spell/Banish.java index 2f4c2e19..01281224 100644 --- a/src/main/java/electroblob/wizardry/spell/Banish.java +++ b/src/main/java/electroblob/wizardry/spell/Banish.java @@ -68,13 +68,13 @@ public class Banish extends SpellRay { int x = MathHelper.floor(entity.posX + MathHelper.sin(angle) * radius); int z = MathHelper.floor(entity.posZ - MathHelper.cos(angle) * radius); Integer y = BlockUtils.getNearestFloor(world, - new BlockPos(x, (int)entity.getEntityBoundingBox().minY, z), (int)radius); + new BlockPos(x, (int)entity.posY, z), (int)radius); if(world.isRemote){ for(int i=0; i<10; i++){ double dx1 = entity.posX; - double dy1 = entity.getEntityBoundingBox().minY + entity.height * world.rand.nextFloat(); + double dy1 = entity.posY + entity.height * world.rand.nextFloat(); double dz1 = entity.posZ; world.spawnParticle(EnumParticleTypes.PORTAL, dx1, dy1, dz1, world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5); diff --git a/src/main/java/electroblob/wizardry/spell/Blink.java b/src/main/java/electroblob/wizardry/spell/Blink.java index e45cb59d..1092a250 100644 --- a/src/main/java/electroblob/wizardry/spell/Blink.java +++ b/src/main/java/electroblob/wizardry/spell/Blink.java @@ -41,7 +41,7 @@ public class Blink extends Spell { if(world.isRemote){ for(int i = 0; i < 10; i++){ double dx = caster.posX; - double dy = caster.getEntityBoundingBox().minY + 2 * world.rand.nextFloat(); + double dy = caster.posY + 2 * world.rand.nextFloat(); double dz = caster.posZ; // For portal particles, velocity is not velocity but the offset where they start, then drift to // the actual position given. @@ -80,7 +80,7 @@ public class Blink extends Spell { float angle = (float)(Math.atan2(target.posZ - caster.posZ, target.posX - caster.posX) + world.rand.nextDouble() * Math.PI); - double radius = caster.getDistance(target.posX, target.getEntityBoundingBox().minY, target.posZ) + double radius = caster.getDistance(target.posX, target.posY, target.posZ) + world.rand.nextDouble() * 3.0d; int x = MathHelper.floor(target.posX + MathHelper.sin(angle) * radius); @@ -94,7 +94,7 @@ public class Blink extends Spell { if(world.isRemote){ for(int i = 0; i < 10; i++){ double dx1 = caster.posX; - double dy1 = caster.getEntityBoundingBox().minY + caster.height * world.rand.nextFloat(); + double dy1 = caster.posY + caster.height * world.rand.nextFloat(); double dz1 = caster.posZ; world.spawnParticle(EnumParticleTypes.PORTAL, dx1, dy1, dz1, world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5); diff --git a/src/main/java/electroblob/wizardry/spell/ChainLightning.java b/src/main/java/electroblob/wizardry/spell/ChainLightning.java index e6340381..b0fba78a 100644 --- a/src/main/java/electroblob/wizardry/spell/ChainLightning.java +++ b/src/main/java/electroblob/wizardry/spell/ChainLightning.java @@ -110,7 +110,7 @@ public class ChainLightning extends SpellRay { ParticleBuilder.create(Type.LIGHTNING).entity(caster) .pos(caster != null ? origin.subtract(caster.getPositionVector()) : origin).target(target).spawn(world); - ParticleBuilder.spawnShockParticles(world, target.posX, target.getEntityBoundingBox().minY + target.height/2, target.posZ); + ParticleBuilder.spawnShockParticles(world, target.posX, target.posY + target.height/2, target.posZ); } //target.playSound(WizardrySounds.SPELL_SPARK, 1, 1.5f + 0.4f * world.rand.nextFloat()); diff --git a/src/main/java/electroblob/wizardry/spell/Divination.java b/src/main/java/electroblob/wizardry/spell/Divination.java index 78d6421f..e2182493 100644 --- a/src/main/java/electroblob/wizardry/spell/Divination.java +++ b/src/main/java/electroblob/wizardry/spell/Divination.java @@ -84,7 +84,7 @@ public class Divination extends Spell { BlockPos target = sphere.get(sphere.size() - 1); direction = EnumFacing.getFacingFromVector((float)(target.getX() + 0.5 - caster.posX), - (float)(target.getY() + 0.5 - (caster.getEntityBoundingBox().minY + caster.getEyeHeight())), + (float)(target.getY() + 0.5 - (caster.posY + caster.getEyeHeight())), (float)(target.getZ() + 0.5 - caster.posZ)); strength = Strength.forWeight(calculateWeight(world, caster, target, range, modifiers)); diff --git a/src/main/java/electroblob/wizardry/spell/DragonFireball.java b/src/main/java/electroblob/wizardry/spell/DragonFireball.java index c1323866..8732f205 100644 --- a/src/main/java/electroblob/wizardry/spell/DragonFireball.java +++ b/src/main/java/electroblob/wizardry/spell/DragonFireball.java @@ -61,7 +61,7 @@ public class DragonFireball extends Spell { EntityDragonFireball fireball = new EntityDragonFireball(world, caster, 1, 1, 1); double dx = target.posX - caster.posX; - double dy = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) + double dy = target.posY + (double)(target.height / 2.0F) - (caster.posY + (double)(caster.height / 2.0F)); double dz = target.posZ - caster.posZ; diff --git a/src/main/java/electroblob/wizardry/spell/Fangs.java b/src/main/java/electroblob/wizardry/spell/Fangs.java index a0bf2fb1..f9a84313 100644 --- a/src/main/java/electroblob/wizardry/spell/Fangs.java +++ b/src/main/java/electroblob/wizardry/spell/Fangs.java @@ -41,7 +41,7 @@ public class Fangs extends Spell { @Override public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ - if(!spawnFangs(world, new Vec3d(caster.posX, caster.getEntityBoundingBox().minY, caster.posZ), + if(!spawnFangs(world, caster.getPositionVector(), GeometryUtils.replaceComponent(caster.getLookVec(), Axis.Y, 0).normalize(), caster, modifiers)) return false; this.playSound(world, caster, ticksInUse, -1, modifiers); return true; diff --git a/src/main/java/electroblob/wizardry/spell/Firestorm.java b/src/main/java/electroblob/wizardry/spell/Firestorm.java index 50362eaa..769405e7 100644 --- a/src/main/java/electroblob/wizardry/spell/Firestorm.java +++ b/src/main/java/electroblob/wizardry/spell/Firestorm.java @@ -3,12 +3,9 @@ package electroblob.wizardry.spell; import electroblob.wizardry.client.DrawingUtils; import electroblob.wizardry.item.SpellActions; import electroblob.wizardry.registry.WizardryItems; -import electroblob.wizardry.util.BlockUtils; +import electroblob.wizardry.util.*; import electroblob.wizardry.util.BlockUtils.SurfaceCriteria; -import electroblob.wizardry.util.EntityUtils; -import electroblob.wizardry.util.ParticleBuilder; import electroblob.wizardry.util.ParticleBuilder.Type; -import electroblob.wizardry.util.SpellModifiers; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -32,7 +29,7 @@ public class Firestorm extends SpellAreaEffect { @Override public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ - burnNearbyBlocks(world, new Vec3d(caster.posX, caster.getEntityBoundingBox().minY, caster.posZ), caster, modifiers); + burnNearbyBlocks(world, caster.getPositionVector(), caster, modifiers); return super.cast(world, caster, hand, ticksInUse, modifiers); } diff --git a/src/main/java/electroblob/wizardry/spell/FlamingAxe.java b/src/main/java/electroblob/wizardry/spell/FlamingAxe.java index 1f87a883..732c86d5 100644 --- a/src/main/java/electroblob/wizardry/spell/FlamingAxe.java +++ b/src/main/java/electroblob/wizardry/spell/FlamingAxe.java @@ -18,7 +18,7 @@ public class FlamingAxe extends SpellConjuration { for(int i=0; i<10; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; world.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); } diff --git a/src/main/java/electroblob/wizardry/spell/FlamingWeapon.java b/src/main/java/electroblob/wizardry/spell/FlamingWeapon.java index 1a02fa3b..03c52e6a 100644 --- a/src/main/java/electroblob/wizardry/spell/FlamingWeapon.java +++ b/src/main/java/electroblob/wizardry/spell/FlamingWeapon.java @@ -46,7 +46,7 @@ public class FlamingWeapon extends Spell { if(world.isRemote){ for(int i=0; i<10; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).clr(0.9f, 0.7f, 1).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/Flight.java b/src/main/java/electroblob/wizardry/spell/Flight.java index 175070e7..4826ca53 100644 --- a/src/main/java/electroblob/wizardry/spell/Flight.java +++ b/src/main/java/electroblob/wizardry/spell/Flight.java @@ -46,11 +46,11 @@ public class Flight extends Spell { if(world.isRemote){ double x = caster.posX - 1 + world.rand.nextDouble() * 2; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ - 1 + world.rand.nextDouble() * 2; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, -0.1, 0).time(15).clr(0.8f, 1, 0.5f).spawn(world); x = caster.posX - 1 + world.rand.nextDouble() * 2; - y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); z = caster.posZ - 1 + world.rand.nextDouble() * 2; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, -0.1, 0).time(15).clr(1f, 1f, 1f).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/FreezingWeapon.java b/src/main/java/electroblob/wizardry/spell/FreezingWeapon.java index 753c7add..c22cc6a2 100644 --- a/src/main/java/electroblob/wizardry/spell/FreezingWeapon.java +++ b/src/main/java/electroblob/wizardry/spell/FreezingWeapon.java @@ -52,7 +52,7 @@ public class FreezingWeapon extends Spell { if(world.isRemote){ for(int i=0; i<10; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).clr(0.9f, 0.7f, 1).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/FrostAxe.java b/src/main/java/electroblob/wizardry/spell/FrostAxe.java index 054b77f7..ee3d6fb0 100644 --- a/src/main/java/electroblob/wizardry/spell/FrostAxe.java +++ b/src/main/java/electroblob/wizardry/spell/FrostAxe.java @@ -19,7 +19,7 @@ public class FrostAxe extends SpellConjuration { for(int i=0; i<10; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SNOW).pos(x, y, z).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/Glide.java b/src/main/java/electroblob/wizardry/spell/Glide.java index 4551c6d7..17d4ff62 100644 --- a/src/main/java/electroblob/wizardry/spell/Glide.java +++ b/src/main/java/electroblob/wizardry/spell/Glide.java @@ -57,11 +57,11 @@ public class Glide extends Spell { if(world.isRemote){ double x = caster.posX - 0.25 + world.rand.nextDouble() / 2; - double y = caster.getEntityBoundingBox().minY + world.rand.nextDouble(); + double y = caster.posY + world.rand.nextDouble(); double z = caster.posZ - 0.25 + world.rand.nextDouble() / 2; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, -0.1, 0).time(15).clr(1f, 1f, 1f).spawn(world); x = caster.posX - 0.25 + world.rand.nextDouble() / 2; - y = caster.getEntityBoundingBox().minY + world.rand.nextDouble(); + y = caster.posY + world.rand.nextDouble(); z = caster.posZ - 0.25 + world.rand.nextDouble() / 2; ParticleBuilder.create(Type.LEAF).pos(x, y, z).time(20).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/Grapple.java b/src/main/java/electroblob/wizardry/spell/Grapple.java index 012ecdd1..38c7f61d 100644 --- a/src/main/java/electroblob/wizardry/spell/Grapple.java +++ b/src/main/java/electroblob/wizardry/spell/Grapple.java @@ -75,7 +75,7 @@ public class Grapple extends Spell { WizardData data = WizardData.get(caster); - Vec3d origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight(), caster.posZ); + Vec3d origin = caster.getPositionEyes(1); float extensionSpeed = getProperty(EXTENSION_SPEED).floatValue() * modifiers.get(SpellModifiers.POTENCY); @@ -98,7 +98,7 @@ public class Grapple extends Spell { if(hit.entityHit instanceof EntityLivingBase){ // If the target is an entity, we need to use the entity's centre rather than the original hit position // because the entity will have moved! - target = new Vec3d(hit.entityHit.posX, hit.entityHit.getEntityBoundingBox().minY + hit.entityHit.height/2, hit.entityHit.posZ); + target = GeometryUtils.getCentre(hit.entityHit); } double distance = origin.distanceTo(target); @@ -209,11 +209,11 @@ public class Grapple extends Spell { if(target == null) return false; - Vec3d origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight(), caster.posZ); + Vec3d origin = caster.getPositionEyes(1); // If the target is an entity, we need to use the entity's centre rather than the original hit position // because the entity will have moved! - Vec3d targetVec = new Vec3d(target.posX, target.getEntityBoundingBox().minY + target.height/2, target.posZ); + Vec3d targetVec = GeometryUtils.getCentre(target); RayTraceResult hit = findTarget(world, caster, origin, targetVec.subtract(origin).normalize(), modifiers); @@ -284,7 +284,7 @@ public class Grapple extends Spell { // If the target is an entity, we need to use the entity's centre rather than the original hit position // because the entity will have moved! - Vec3d target = new Vec3d(entity.posX, entity.getEntityBoundingBox().minY + entity.height/2, entity.posZ); + Vec3d target = GeometryUtils.getCentre(entity); double distance = origin.distanceTo(target); Vec3d vec = target.subtract(origin).normalize(); @@ -344,7 +344,7 @@ public class Grapple extends Spell { if(caster != null){ - origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight(), caster.posZ); + origin = caster.getPositionEyes(1); if(caster instanceof EntityPlayer){ WizardData data = WizardData.get((EntityPlayer)caster); @@ -354,7 +354,7 @@ public class Grapple extends Spell { } }else if(caster instanceof EntityLiving){ Entity entity = ((EntityLiving)caster).getAttackTarget(); - if(entity != null) target = new Vec3d(entity.posX, entity.getEntityBoundingBox().minY + entity.height/2, entity.posZ); + if(entity != null) target = GeometryUtils.getCentre(entity); } if(target != null) direction = target.subtract(origin).normalize(); diff --git a/src/main/java/electroblob/wizardry/spell/IceAge.java b/src/main/java/electroblob/wizardry/spell/IceAge.java index 544038d1..29dc43d9 100644 --- a/src/main/java/electroblob/wizardry/spell/IceAge.java +++ b/src/main/java/electroblob/wizardry/spell/IceAge.java @@ -6,11 +6,8 @@ import electroblob.wizardry.registry.WizardryBlocks; import electroblob.wizardry.registry.WizardryItems; import electroblob.wizardry.registry.WizardryPotions; import electroblob.wizardry.registry.WizardrySounds; -import electroblob.wizardry.util.BlockUtils; -import electroblob.wizardry.util.EntityUtils; -import electroblob.wizardry.util.ParticleBuilder; +import electroblob.wizardry.util.*; import electroblob.wizardry.util.ParticleBuilder.Type; -import electroblob.wizardry.util.SpellModifiers; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -36,7 +33,7 @@ public class IceAge extends SpellAreaEffect { @Override public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ - freezeNearbyBlocks(world, new Vec3d(caster.posX, caster.getEntityBoundingBox().minY, caster.posZ), caster, modifiers); + freezeNearbyBlocks(world, caster.getPositionVector(), caster, modifiers); return super.cast(world, caster, hand, ticksInUse, modifiers); } diff --git a/src/main/java/electroblob/wizardry/spell/ImbueWeapon.java b/src/main/java/electroblob/wizardry/spell/ImbueWeapon.java index 55e71787..a1e8d13f 100644 --- a/src/main/java/electroblob/wizardry/spell/ImbueWeapon.java +++ b/src/main/java/electroblob/wizardry/spell/ImbueWeapon.java @@ -65,7 +65,7 @@ public class ImbueWeapon extends Spell { if(world.isRemote){ for(int i=0; i<10; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).clr(0.9f, 0.7f, 1).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/Intimidate.java b/src/main/java/electroblob/wizardry/spell/Intimidate.java index 67fed76d..6b6bd101 100644 --- a/src/main/java/electroblob/wizardry/spell/Intimidate.java +++ b/src/main/java/electroblob/wizardry/spell/Intimidate.java @@ -66,7 +66,7 @@ public class Intimidate extends SpellAreaEffect { @Override protected void spawnParticleEffect(World world, Vec3d origin, double radius, @Nullable EntityLivingBase caster, SpellModifiers modifiers){ - if(caster != null) origin = caster.getPositionEyes(0); + if(caster != null) origin = caster.getPositionEyes(1); for(int i = 0; i < 30; i++){ double x = origin.x - 1 + world.rand.nextDouble() * 2; diff --git a/src/main/java/electroblob/wizardry/spell/InvokeWeather.java b/src/main/java/electroblob/wizardry/spell/InvokeWeather.java index 45b711dc..1d35e879 100644 --- a/src/main/java/electroblob/wizardry/spell/InvokeWeather.java +++ b/src/main/java/electroblob/wizardry/spell/InvokeWeather.java @@ -54,7 +54,7 @@ public class InvokeWeather extends Spell { if(world.isRemote){ for(int i = 0; i < 10; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).clr(0.5f, 0.7f, 1).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/Leap.java b/src/main/java/electroblob/wizardry/spell/Leap.java index 16b69acc..05a6c255 100644 --- a/src/main/java/electroblob/wizardry/spell/Leap.java +++ b/src/main/java/electroblob/wizardry/spell/Leap.java @@ -30,7 +30,7 @@ public class Leap extends Spell { if(world.isRemote){ for(int i = 0; i < 10; i++){ double x = caster.posX + world.rand.nextFloat() - 0.5F; - double y = caster.getEntityBoundingBox().minY; + double y = caster.posY; double z = caster.posZ + world.rand.nextFloat() - 0.5F; world.spawnParticle(EnumParticleTypes.CLOUD, x, y, z, 0, 0, 0); } diff --git a/src/main/java/electroblob/wizardry/spell/Levitation.java b/src/main/java/electroblob/wizardry/spell/Levitation.java index 2d08335d..bafa7555 100644 --- a/src/main/java/electroblob/wizardry/spell/Levitation.java +++ b/src/main/java/electroblob/wizardry/spell/Levitation.java @@ -47,7 +47,7 @@ public class Levitation extends Spell { if(world.isRemote){ double x = caster.posX - 0.25 + world.rand.nextDouble() * 0.5; - double y = caster.getEntityBoundingBox().minY; + double y = caster.getPositionEyes(1).y; double z = caster.posZ - 0.25 + world.rand.nextDouble() * 0.5; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, -0.1, 0).time(15).clr(0.5f, 1, 0.7f).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/LightningPulse.java b/src/main/java/electroblob/wizardry/spell/LightningPulse.java index 0e84131a..b4f7341f 100644 --- a/src/main/java/electroblob/wizardry/spell/LightningPulse.java +++ b/src/main/java/electroblob/wizardry/spell/LightningPulse.java @@ -70,7 +70,7 @@ public class LightningPulse extends Spell { } if(world.isRemote){ - ParticleBuilder.create(Type.LIGHTNING_PULSE).pos(caster.posX, caster.getEntityBoundingBox().minY + ParticleBuilder.create(Type.LIGHTNING_PULSE).pos(caster.posX, caster.posY + GeometryUtils.ANTI_Z_FIGHTING_OFFSET, caster.posZ) .scale(modifiers.get(WizardryItems.blast_upgrade)).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/MindControl.java b/src/main/java/electroblob/wizardry/spell/MindControl.java index 7278e626..2417fa79 100644 --- a/src/main/java/electroblob/wizardry/spell/MindControl.java +++ b/src/main/java/electroblob/wizardry/spell/MindControl.java @@ -85,10 +85,10 @@ public class MindControl extends SpellRay { for(int i=0; i<10; i++){ ParticleBuilder.create(Type.DARK_MAGIC, world.rand, target.posX, - target.getEntityBoundingBox().minY + target.getEyeHeight(), target.posZ, 0.25, false) + target.posY + target.getEyeHeight(), target.posZ, 0.25, false) .clr(0.8f, 0.2f, 1.0f).spawn(world); ParticleBuilder.create(Type.DARK_MAGIC, world.rand, target.posX, - target.getEntityBoundingBox().minY + target.getEyeHeight(), target.posZ, 0.25, false) + target.posY + target.getEyeHeight(), target.posZ, 0.25, false) .clr(0.2f, 0.04f, 0.25f).spawn(world); } } diff --git a/src/main/java/electroblob/wizardry/spell/MindTrick.java b/src/main/java/electroblob/wizardry/spell/MindTrick.java index 3e6902a4..80b62722 100644 --- a/src/main/java/electroblob/wizardry/spell/MindTrick.java +++ b/src/main/java/electroblob/wizardry/spell/MindTrick.java @@ -53,7 +53,7 @@ public class MindTrick extends SpellRay { }else{ for(int i=0; i<10; i++){ ParticleBuilder.create(Type.DARK_MAGIC, world.rand, target.posX, - target.getEntityBoundingBox().minY + target.getEyeHeight(), target.posZ, 0.25, false) + target.posY + target.getEyeHeight(), target.posZ, 0.25, false) .clr(0.8f, 0.2f, 1.0f).spawn(world); } } diff --git a/src/main/java/electroblob/wizardry/spell/PhaseStep.java b/src/main/java/electroblob/wizardry/spell/PhaseStep.java index 9c521bc4..b6cf0b8d 100644 --- a/src/main/java/electroblob/wizardry/spell/PhaseStep.java +++ b/src/main/java/electroblob/wizardry/spell/PhaseStep.java @@ -42,7 +42,7 @@ public class PhaseStep extends Spell { for(int i = 0; i < 10; i++){ double dx1 = caster.posX; - double dy1 = caster.getEntityBoundingBox().minY + 2 * world.rand.nextFloat(); + double dy1 = caster.posY + 2 * world.rand.nextFloat(); double dz1 = caster.posZ; world.spawnParticle(EnumParticleTypes.PORTAL, dx1, dy1, dz1, world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5); diff --git a/src/main/java/electroblob/wizardry/spell/PocketFurnace.java b/src/main/java/electroblob/wizardry/spell/PocketFurnace.java index 6ea2c329..2663056c 100644 --- a/src/main/java/electroblob/wizardry/spell/PocketFurnace.java +++ b/src/main/java/electroblob/wizardry/spell/PocketFurnace.java @@ -68,7 +68,7 @@ public class PocketFurnace extends Spell { if(world.isRemote){ for(int i = 0; i < 10; i++){ double x1 = (double)((float)caster.posX + world.rand.nextFloat() * 2 - 1.0F); - double y1 = (double)((float)caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5F + world.rand.nextFloat()); + double y1 = (double)((float)caster.posY + caster.getEyeHeight() - 0.5F + world.rand.nextFloat()); double z1 = (double)((float)caster.posZ + world.rand.nextFloat() * 2 - 1.0F); world.spawnParticle(EnumParticleTypes.FLAME, x1, y1, z1, 0, 0.01F, 0); } diff --git a/src/main/java/electroblob/wizardry/spell/Possession.java b/src/main/java/electroblob/wizardry/spell/Possession.java index b9f6e1ba..1c4cdcb2 100644 --- a/src/main/java/electroblob/wizardry/spell/Possession.java +++ b/src/main/java/electroblob/wizardry/spell/Possession.java @@ -140,7 +140,7 @@ public class Possession extends SpellRay { public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ Vec3d look = caster.getLookVec(); - Vec3d origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight() - Y_OFFSET, caster.posZ); + Vec3d origin = new Vec3d(caster.posX, caster.posY + caster.getEyeHeight() - Y_OFFSET, caster.posZ); if(!shootSpell(world, origin, look, caster, ticksInUse, modifiers)) return false; diff --git a/src/main/java/electroblob/wizardry/spell/RemoveCurse.java b/src/main/java/electroblob/wizardry/spell/RemoveCurse.java index 927d0b3a..83211128 100644 --- a/src/main/java/electroblob/wizardry/spell/RemoveCurse.java +++ b/src/main/java/electroblob/wizardry/spell/RemoveCurse.java @@ -43,7 +43,7 @@ public class RemoveCurse extends SpellBuff { for(int i = 0; i < particleCount*2; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.14, 0).clr(0x0f001b) .time(20 + world.rand.nextInt(12)).spawn(world); diff --git a/src/main/java/electroblob/wizardry/spell/ShadowWard.java b/src/main/java/electroblob/wizardry/spell/ShadowWard.java index d3fec9e7..5a8b5290 100644 --- a/src/main/java/electroblob/wizardry/spell/ShadowWard.java +++ b/src/main/java/electroblob/wizardry/spell/ShadowWard.java @@ -50,7 +50,7 @@ public class ShadowWard extends Spell { double dx = -1 + 2 * world.rand.nextFloat(); double dy = -1 + world.rand.nextFloat(); double dz = -1 + 2 * world.rand.nextFloat(); - world.spawnParticle(EnumParticleTypes.PORTAL, caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight(), caster.posZ, dx, dy, dz); + world.spawnParticle(EnumParticleTypes.PORTAL, caster.posX, caster.posY + caster.getEyeHeight(), caster.posZ, dx, dy, dz); } if(ticksInUse % 50 == 0){ diff --git a/src/main/java/electroblob/wizardry/spell/Shockwave.java b/src/main/java/electroblob/wizardry/spell/Shockwave.java index e5bee7e8..e710351f 100644 --- a/src/main/java/electroblob/wizardry/spell/Shockwave.java +++ b/src/main/java/electroblob/wizardry/spell/Shockwave.java @@ -70,7 +70,7 @@ public class Shockwave extends SpellAreaEffect { double velocityFactor = proximity * getProperty(MAX_REPULSION_VELOCITY).floatValue(); double dx = target.posX - origin.x; - double dy = target.getEntityBoundingBox().minY + 1 - origin.y; + double dy = target.posY + 1 - origin.y; double dz = target.posZ - origin.z; target.motionX = velocityFactor * dx; diff --git a/src/main/java/electroblob/wizardry/spell/SpectralPathway.java b/src/main/java/electroblob/wizardry/spell/SpectralPathway.java index f86b3291..e09d6068 100644 --- a/src/main/java/electroblob/wizardry/spell/SpectralPathway.java +++ b/src/main/java/electroblob/wizardry/spell/SpectralPathway.java @@ -46,7 +46,7 @@ public class SpectralPathway extends Spell { // Gets the coordinates of the nearest block intersection to the player's feet. // Remember that a block always takes the coordinates of its northwestern corner. - BlockPos origin = new BlockPos(Math.round(caster.posX), (int)caster.getEntityBoundingBox().minY - 1, + BlockPos origin = new BlockPos(Math.round(caster.posX), (int)caster.posY - 1, Math.round(caster.posZ)); int startPoint = direction.getAxisDirection() == AxisDirection.POSITIVE ? -1 : 0; diff --git a/src/main/java/electroblob/wizardry/spell/SpeedTime.java b/src/main/java/electroblob/wizardry/spell/SpeedTime.java index 0882bafd..3215c544 100644 --- a/src/main/java/electroblob/wizardry/spell/SpeedTime.java +++ b/src/main/java/electroblob/wizardry/spell/SpeedTime.java @@ -108,7 +108,7 @@ public class SpeedTime extends Spell { double particleSpread = 2; double x = caster.posX + 2; - double y = caster.getEntityBoundingBox().minY + caster.height / 2; + double y = caster.posY + caster.height / 2; double z = caster.posZ; ParticleBuilder.create(ParticleBuilder.Type.SPARKLE, world.rand, x, y, z, particleSpread, false) diff --git a/src/main/java/electroblob/wizardry/spell/SpellAreaEffect.java b/src/main/java/electroblob/wizardry/spell/SpellAreaEffect.java index c1c12d32..abb46500 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellAreaEffect.java +++ b/src/main/java/electroblob/wizardry/spell/SpellAreaEffect.java @@ -4,6 +4,7 @@ import electroblob.wizardry.Wizardry; import electroblob.wizardry.registry.WizardryItems; import electroblob.wizardry.util.AllyDesignationSystem; import electroblob.wizardry.util.EntityUtils; +import electroblob.wizardry.util.GeometryUtils; import electroblob.wizardry.util.SpellModifiers; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; @@ -104,7 +105,7 @@ public abstract class SpellAreaEffect extends Spell { @Override public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ - boolean result = findAndAffectEntities(world, new Vec3d(caster.posX, caster.getEntityBoundingBox().minY, caster.posZ), + boolean result = findAndAffectEntities(world, caster.getPositionVector(), caster, ticksInUse, modifiers); if(result) this.playSound(world, caster, ticksInUse, -1, modifiers); return result; diff --git a/src/main/java/electroblob/wizardry/spell/SpellBuff.java b/src/main/java/electroblob/wizardry/spell/SpellBuff.java index b39e1549..7c08374a 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellBuff.java +++ b/src/main/java/electroblob/wizardry/spell/SpellBuff.java @@ -195,7 +195,7 @@ public class SpellBuff extends Spell { for(int i = 0; i < particleCount; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).clr(r, g, b).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/SpellConjuration.java b/src/main/java/electroblob/wizardry/spell/SpellConjuration.java index 57aa98e6..55eed416 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellConjuration.java +++ b/src/main/java/electroblob/wizardry/spell/SpellConjuration.java @@ -70,7 +70,7 @@ public class SpellConjuration extends Spell { for(int i=0; i<10; i++){ double x = caster.posX + world.rand.nextDouble() * 2 - 1; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = caster.posY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = caster.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).clr(0.7f, 0.9f, 1).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java b/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java index aa788087..5422b364 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java +++ b/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java @@ -109,7 +109,7 @@ public class SpellConstructRanged extends SpellC Vec3d look = caster.getLookVec(); double x = caster.posX + look.x * range; - double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() + look.y * range; + double y = caster.posY + caster.getEyeHeight() + look.y * range; double z = caster.posZ + look.z * range; if(!spawnConstruct(world, x, y, z, null, caster, modifiers)) return false; @@ -128,7 +128,7 @@ public class SpellConstructRanged extends SpellC SpellModifiers modifiers){ double range = getProperty(RANGE).doubleValue() * modifiers.get(WizardryItems.range_upgrade); - Vec3d origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight(), caster.posZ); + Vec3d origin = caster.getPositionEyes(1); if(target != null && caster.getDistance(target) <= range){ diff --git a/src/main/java/electroblob/wizardry/spell/SpellRay.java b/src/main/java/electroblob/wizardry/spell/SpellRay.java index 78c6c927..db02b2f0 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellRay.java +++ b/src/main/java/electroblob/wizardry/spell/SpellRay.java @@ -160,7 +160,7 @@ public abstract class SpellRay extends Spell { public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){ Vec3d look = caster.getLookVec(); - Vec3d origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight() - Y_OFFSET, caster.posZ); + Vec3d origin = new Vec3d(caster.posX, caster.posY + caster.getEyeHeight() - Y_OFFSET, caster.posZ); if(!this.isContinuous && world.isRemote && !Wizardry.proxy.isFirstPerson(caster)){ origin = origin.add(look.scale(1.2)); } @@ -175,16 +175,16 @@ public abstract class SpellRay extends Spell { @Override public boolean cast(World world, EntityLiving caster, EnumHand hand, int ticksInUse, EntityLivingBase target, SpellModifiers modifiers){ // IDEA: Add in an aiming error and trigger onMiss accordingly - Vec3d origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight() - Y_OFFSET, caster.posZ); + Vec3d origin = new Vec3d(caster.posX, caster.posY + caster.getEyeHeight() - Y_OFFSET, caster.posZ); Vec3d targetPos = null; if(!ignoreLivingEntities || !EntityUtils.isLiving(target)){ - targetPos = new Vec3d(target.posX, target.getEntityBoundingBox().minY + target.height / 2, target.posZ); + targetPos = new Vec3d(target.posX, target.posY + target.height / 2, target.posZ); }else{ int x = MathHelper.floor(target.posX); - int y = (int)target.getEntityBoundingBox().minY - 1; // -1 because we need the block under the target + int y = (int)target.posY - 1; // -1 because we need the block under the target int z = MathHelper.floor(target.posZ); BlockPos pos = new BlockPos(x, y, z); diff --git a/src/main/java/electroblob/wizardry/spell/SpellThrowable.java b/src/main/java/electroblob/wizardry/spell/SpellThrowable.java index dcd8752d..1cdb0bf6 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellThrowable.java +++ b/src/main/java/electroblob/wizardry/spell/SpellThrowable.java @@ -127,10 +127,10 @@ public class SpellThrowable extends Spell { throwable.ignoreEntity = caster; - throwable.posY = caster.getEntityBoundingBox().minY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET; + throwable.posY = caster.posY + (double)caster.getEyeHeight() - LAUNCH_Y_OFFSET; double dx = target.posX - caster.posX; - double dy = !throwable.hasNoGravity() ? target.getEntityBoundingBox().minY + (double)(target.height / 3.0f) - throwable.posY - : target.getEntityBoundingBox().minY + (double)(target.height / 2.0f) - throwable.posY; + double dy = !throwable.hasNoGravity() ? target.posY + (double)(target.height / 3.0f) - throwable.posY + : target.posY + (double)(target.height / 2.0f) - throwable.posY; double dz = target.posZ - caster.posZ; double horizontalDistance = MathHelper.sqrt(dx * dx + dz * dz); diff --git a/src/main/java/electroblob/wizardry/spell/Thunderstorm.java b/src/main/java/electroblob/wizardry/spell/Thunderstorm.java index 732cbbe0..a0feef28 100644 --- a/src/main/java/electroblob/wizardry/spell/Thunderstorm.java +++ b/src/main/java/electroblob/wizardry/spell/Thunderstorm.java @@ -89,7 +89,7 @@ public class Thunderstorm extends Spell { ParticleBuilder.create(Type.LIGHTNING).pos(x, y, z).target(secondaryTarget).spawn(world); ParticleBuilder.spawnShockParticles(world, secondaryTarget.posX, - secondaryTarget.getEntityBoundingBox().minY + secondaryTarget.height / 2, + secondaryTarget.posY + secondaryTarget.height / 2, secondaryTarget.posZ); } @@ -115,7 +115,7 @@ public class Thunderstorm extends Spell { ParticleBuilder.create(Type.LIGHTNING).entity(secondaryTarget) .pos(0, secondaryTarget.height / 2, 0).target(tertiaryTarget).spawn(world); ParticleBuilder.spawnShockParticles(world, tertiaryTarget.posX, - tertiaryTarget.getEntityBoundingBox().minY + tertiaryTarget.height / 2, + tertiaryTarget.posY + tertiaryTarget.height / 2, tertiaryTarget.posZ); } diff --git a/src/main/java/electroblob/wizardry/spell/Whirlwind.java b/src/main/java/electroblob/wizardry/spell/Whirlwind.java index be394a62..d015b57e 100644 --- a/src/main/java/electroblob/wizardry/spell/Whirlwind.java +++ b/src/main/java/electroblob/wizardry/spell/Whirlwind.java @@ -41,7 +41,7 @@ public class Whirlwind extends SpellRay { // Left as EntityLivingBase because why not be able to move armour stands around? if(target instanceof EntityLivingBase){ - Vec3d vec = target.getPositionVector().add(0, target.getEyeHeight(), 0).subtract(origin).normalize(); + Vec3d vec = target.getPositionEyes(1).subtract(origin).normalize(); if(!world.isRemote){ diff --git a/src/main/java/electroblob/wizardry/spell/WitherSkull.java b/src/main/java/electroblob/wizardry/spell/WitherSkull.java index c71af6ec..9c79ce20 100644 --- a/src/main/java/electroblob/wizardry/spell/WitherSkull.java +++ b/src/main/java/electroblob/wizardry/spell/WitherSkull.java @@ -74,7 +74,7 @@ public class WitherSkull extends Spell { EntityWitherSkull witherskull = new EntityWitherSkull(world, caster, 1, 1, 1); double dx = target.posX - caster.posX; - double dy = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) + double dy = target.posY + (double)(target.height / 2.0F) - (caster.posY + (double)(caster.height / 2.0F)); double dz = target.posZ - caster.posZ; diff --git a/src/main/java/electroblob/wizardry/util/BlockUtils.java b/src/main/java/electroblob/wizardry/util/BlockUtils.java index 538e3637..2c61e11f 100644 --- a/src/main/java/electroblob/wizardry/util/BlockUtils.java +++ b/src/main/java/electroblob/wizardry/util/BlockUtils.java @@ -125,7 +125,7 @@ public final class BlockUtils { * is negative. */ public static IBlockState getBlockEntityIsStandingOn(Entity entity){ - BlockPos pos = new BlockPos(MathHelper.floor(entity.posX), (int)entity.getEntityBoundingBox().minY - 1, + BlockPos pos = new BlockPos(MathHelper.floor(entity.posX), (int)entity.posY - 1, MathHelper.floor(entity.posZ)); return entity.world.getBlockState(pos); } diff --git a/src/main/java/electroblob/wizardry/util/EntityUtils.java b/src/main/java/electroblob/wizardry/util/EntityUtils.java index dbbf488d..e61fd228 100644 --- a/src/main/java/electroblob/wizardry/util/EntityUtils.java +++ b/src/main/java/electroblob/wizardry/util/EntityUtils.java @@ -210,7 +210,7 @@ public final class EntityUtils { } } - box = box.offset(destination.subtract(entity.posX, box.minY, entity.posZ)); + box = box.offset(destination.subtract(entity.posX, entity.posY, entity.posZ)); // All the parameters of this method are INCLUSIVE, so even the max coordinates should be rounded down Iterable cuboid = BlockPos.getAllInBox(MathHelper.floor(box.minX), MathHelper.floor(box.minY), diff --git a/src/main/java/electroblob/wizardry/util/GeometryUtils.java b/src/main/java/electroblob/wizardry/util/GeometryUtils.java index fe3e5389..d13d2c7b 100644 --- a/src/main/java/electroblob/wizardry/util/GeometryUtils.java +++ b/src/main/java/electroblob/wizardry/util/GeometryUtils.java @@ -1,5 +1,6 @@ package electroblob.wizardry.util; +import net.minecraft.entity.Entity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; import net.minecraft.util.math.AxisAlignedBB; @@ -49,6 +50,14 @@ public final class GeometryUtils { return new Vec3d(box.minX + (box.maxX - box.minX) * 0.5, box.minY + (box.maxY - box.minY) * 0.5, box.minZ + (box.maxZ - box.minZ) * 0.5); } + /** + * Returns a {@link Vec3d} of the coordinates at the centre of the given entity's bounding box. This is more + * efficient than {@code GeometryUtils.getCentre(entity.getEntityBoundingBox())} as it can use the entity's fields. + */ + public static Vec3d getCentre(Entity entity){ + return new Vec3d(entity.posX, entity.posY + entity.height/2, entity.posZ); + } + /** * Returns a {@link Vec3d} of the coordinates at the centre of the given face of the given block position (i.e. the * centre of the block plus 0.5 in the given direction). diff --git a/src/main/java/electroblob/wizardry/util/ParticleBuilder.java b/src/main/java/electroblob/wizardry/util/ParticleBuilder.java index 4c7403c7..0b019303 100644 --- a/src/main/java/electroblob/wizardry/util/ParticleBuilder.java +++ b/src/main/java/electroblob/wizardry/util/ParticleBuilder.java @@ -768,7 +768,7 @@ public final class ParticleBuilder { for(int i = 0; i < 10; i++){ double x = entity.posX + world.rand.nextDouble() * 2 - 1; - double y = entity.getEntityBoundingBox().minY + entity.getEyeHeight() - 0.5 + world.rand.nextDouble(); + double y = entity.posY + entity.getEyeHeight() - 0.5 + world.rand.nextDouble(); double z = entity.posZ + world.rand.nextDouble() * 2 - 1; ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).clr(1, 1, 0.3f).spawn(world); } diff --git a/src/main/java/electroblob/wizardry/util/RayTracer.java b/src/main/java/electroblob/wizardry/util/RayTracer.java index 2a6bf478..61b47853 100644 --- a/src/main/java/electroblob/wizardry/util/RayTracer.java +++ b/src/main/java/electroblob/wizardry/util/RayTracer.java @@ -43,7 +43,7 @@ public final class RayTracer { public static RayTraceResult standardBlockRayTrace(World world, EntityLivingBase entity, double range, boolean hitLiquids, boolean ignoreUncollidables, boolean returnLastUncollidable){ // This method does not apply an offset like ray spells do, since it is not desirable in most other use cases. - Vec3d origin = new Vec3d(entity.posX, entity.getEntityBoundingBox().minY + entity.getEyeHeight(), entity.posZ); + Vec3d origin = entity.getPositionEyes(1); Vec3d endpoint = origin.add(entity.getLookVec().scale(range)); return world.rayTraceBlocks(origin, endpoint, hitLiquids, ignoreUncollidables, returnLastUncollidable); } @@ -76,7 +76,7 @@ public final class RayTracer { @Nullable public static RayTraceResult standardEntityRayTrace(World world, Entity entity, double range, boolean hitLiquids){ // This method does not apply an offset like ray spells do, since it is not desirable in most other use cases. - Vec3d origin = new Vec3d(entity.posX, entity.getEntityBoundingBox().minY + entity.getEyeHeight(), entity.posZ); + Vec3d origin = entity.getPositionEyes(1); Vec3d endpoint = origin.add(entity.getLookVec().scale(range)); return rayTrace(world, origin, endpoint, 0, hitLiquids, false, false, Entity.class, ignoreEntityFilter(entity)); }