Tidy up entity geometry stuff:

- Add a getCentre method for entities to GeometryUtils
- Replace getPositionEyes(0) with getPositionEyes(1) since it's more efficient, and by definition they must be the same
- Remove all the silly getEntityBoundingBox().minY stuff, this bug has been fixed since 1.8! (which begs the question: if it was considered a bug, how on earth did it go unfixed for that long?)
- A few other small things
This commit is contained in:
Electroblob77
2020-07-04 13:34:11 +01:00
parent 3f19e89b91
commit 8ae6bc9102
67 changed files with 109 additions and 104 deletions
@@ -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;
@@ -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);
// }