}
@Override
public void onInteract(Entity entity, Entity other, Action action) {
if (action == Action.RIGHT_CLICK) {
Sheep sheep = other.get(Sheep.class);
if (sheep == null) {
return;
}
if (sheep.isSheared()) {
//TODO: Also return if this is a baby sheep
return;
}
short col = sheep.getColor().getData();
ItemStack itemStack = new ItemStack(VanillaMaterials.WOOL, col, GenericMath.getRandom().nextInt(3) + 1);
SheepShearedEvent event = VanillaPlugin.getInstance().getEngine().getEventManager().callEvent(new SheepShearedEvent(other, entity, itemStack));
if (event.isCancelled()) {
return;
}
sheep.setSheared(true);
Item.dropNaturally(other.getPhysics().getPosition(), event.getItemStack());
}
}