public final void update() { float xDiff = -0.7F * MathHelper.sin(parent.yRot * (float) Math.PI / 180.0F); float zDiff = 0.7F * MathHelper.cos(parent.yRot * (float) Math.PI / 180.0F); int x = (int) (this.mob.x + xDiff); int y = (int) (this.mob.y - 2.0F); int z = (int) (this.mob.z + zDiff); if (parent.grazing) { if (this.level.getTile(x, y, z) != VanillaBlock.GRASS.getId()) { parent.grazing = false; } else { if (parent.grazingTime++ == 60) { this.level.setTile(x, y, z, VanillaBlock.DIRT.getId()); if (this.random.nextInt(5) == 0) { parent.hasFur = true; } } this.xxa = 0.0F; this.yya = 0.0F; this.mob.xRot = 40 + parent.grazingTime / 2 % 2 * 10; } } else { if (this.level.getTile(x, y, z) == VanillaBlock.GRASS.getId()) { parent.grazing = true; parent.grazingTime = 0; } super.update(); } }
public final void setRotationAngles( float animStep, float runProgress, float dt, float yaw, float pitch, float scale) { super.setRotationAngles(animStep, runProgress, dt, yaw, pitch, scale); float armYaw = MathHelper.sin(this.attackTime * MathHelper.PI); float armPitch = MathHelper.sin((1 - (1 - this.attackTime) * (1 - this.attackTime)) * MathHelper.PI); this.rightArm.roll = 0; this.leftArm.roll = 0; this.rightArm.yaw = -(0.1F - armYaw * 0.6F); this.leftArm.yaw = 0.1F - armYaw * 0.6F; this.rightArm.pitch = -MathHelper.HALF_PI; this.leftArm.pitch = -MathHelper.HALF_PI; this.rightArm.pitch -= armYaw * 1.2F - armPitch * 0.4F; this.leftArm.pitch -= armYaw * 1.2F - armPitch * 0.4F; this.rightArm.roll += MathHelper.cos(dt * 0.09F) * 0.05F + 0.05F; this.leftArm.roll -= MathHelper.cos(dt * 0.09F) * 0.05F + 0.05F; this.rightArm.pitch += MathHelper.sin(dt * 0.067F) * 0.05F; this.leftArm.pitch -= MathHelper.sin(dt * 0.067F) * 0.05F; }
public void setRotationAngles( float animStep, float runProgress, float dt, float yaw, float pitch, float scale) { this.head.yaw = yaw / 57.295776F; this.head.pitch = pitch / 57.295776F; this.rightArm.pitch = MathHelper.cos(animStep * 0.6F + MathHelper.PI) * 2 * runProgress; this.rightArm.roll = (MathHelper.cos(animStep * 0.2F) + 1) * runProgress; this.leftArm.pitch = MathHelper.cos(animStep * 0.6F) * 2 * runProgress; this.leftArm.roll = (MathHelper.cos(animStep * 0.3F) - 1) * runProgress; this.rightLeg.pitch = MathHelper.cos(animStep * 0.6F) * 1.4F * runProgress; this.leftLeg.pitch = MathHelper.cos(animStep * 0.6F + MathHelper.PI) * 1.4F * runProgress; this.rightArm.roll += MathHelper.cos(dt * 0.09F) * 0.05F + 0.05F; this.leftArm.roll -= MathHelper.cos(dt * 0.09F) * 0.05F + 0.05F; this.rightArm.pitch += MathHelper.sin(dt * 0.07F) * 0.05F; this.leftArm.pitch -= MathHelper.sin(dt * 0.07F) * 0.05F; }