From 4f0e6ffb019b56d95c16bc991872d841b0581b38 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Fri, 8 Nov 2013 21:09:13 +1100 Subject: [PATCH] Attempted to get birds to avoid water --- common/biomesoplenty/entities/EntityBird.java | 8 ++++++-- common/biomesoplenty/entities/models/ModelBird.java | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/biomesoplenty/entities/EntityBird.java b/common/biomesoplenty/entities/EntityBird.java index 0fdd8ff2a..38d51f983 100644 --- a/common/biomesoplenty/entities/EntityBird.java +++ b/common/biomesoplenty/entities/EntityBird.java @@ -1,5 +1,6 @@ package biomesoplenty.entities; +import net.minecraft.block.material.Material; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -64,8 +65,11 @@ public class EntityBird extends EntityFlyingMob for (int i = 1; (double)i < par7; ++i) { axisalignedbb.offset(d4, d5, d6); - - if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) + + if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty() + || this.isInWater() ? + this.worldObj.getBlockMaterial(MathHelper.floor_double(this.waypointX), MathHelper.floor_double(this.waypointY), MathHelper.floor_double(this.waypointZ)) == Material.water + : this.worldObj.isAnyLiquid(axisalignedbb)) { return false; } diff --git a/common/biomesoplenty/entities/models/ModelBird.java b/common/biomesoplenty/entities/models/ModelBird.java index 7597893d6..a4ffe2589 100644 --- a/common/biomesoplenty/entities/models/ModelBird.java +++ b/common/biomesoplenty/entities/models/ModelBird.java @@ -122,7 +122,11 @@ public class ModelBird extends ModelBase { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - if (entity.motionY > 0 || (entity.motionX == 0 && entity.motionZ == 0)) + int x = MathHelper.floor_double(entity.posX); + int y = MathHelper.floor_double(entity.posY); + int z = MathHelper.floor_double(entity.posZ); + + if (!(entity.posY <= entity.prevPosY && entity.worldObj.isAirBlock(x, y - 1, z))) { WingRight.rotateAngleZ = MathHelper.cos(f2 * 1.7F) * (float)Math.PI * 0.25F; WingLeft.rotateAngleZ = -WingRight.rotateAngleZ;