@Override
public void tick() {
if (--this.eatTicks == 0) {
int blockLocX = MathHelper.floor(this.entityMySheep.locX);
int blockLocY = MathHelper.floor(this.entityMySheep.locY);
int blockLocZ = MathHelper.floor(this.entityMySheep.locZ);
if (this.world.getType(blockLocX, blockLocY, blockLocZ) == Blocks.LONG_GRASS) {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.entityMySheep.getBukkitEntity(), this.entityMySheep.world.getWorld().getBlockAt(blockLocX, blockLocY, blockLocZ), Material.AIR).isCancelled()) {
this.world.triggerEffect(2001, blockLocX, blockLocY, blockLocZ, Block.getId(Blocks.LONG_GRASS) + 4096);
this.world.setAir(blockLocX, blockLocY, blockLocZ);
this.entityMySheep.getMyPet().setSheared(false);
}
} else if (this.world.getType(blockLocX, blockLocY - 1, blockLocZ) == Blocks.GRASS) {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.entityMySheep.getBukkitEntity(), this.entityMySheep.world.getWorld().getBlockAt(blockLocX, blockLocY - 1, blockLocZ), Material.DIRT).isCancelled()) {
this.world.triggerEffect(2001, blockLocX, blockLocY - 1, blockLocZ, Block.getId(Blocks.GRASS));
this.world.setTypeAndData(blockLocX, blockLocY - 1, blockLocZ, Blocks.DIRT, 0, 2);
this.entityMySheep.getMyPet().setSheared(false);
}
}
}
}
}