Attempted to get birds to avoid water
This commit is contained in:
parent
f41b8fe023
commit
4f0e6ffb01
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue