use of net.minecraft.entity.passive.EntityWolf in project takumicraft by TNTModders.
the class EntityWolfCreeper method takumiExplodeEvent.
@Override
public boolean takumiExplodeEvent(Detonate event) {
List<EntityWolf> list = new ArrayList<>();
for (Entity entity : event.getAffectedEntities()) {
if (entity instanceof EntityWolf) {
list.add((EntityWolf) entity);
}
}
event.getAffectedEntities().removeAll(list);
return true;
}
use of net.minecraft.entity.passive.EntityWolf in project BiomesOPlenty by Glitchfiend.
the class DyeEventHandler method entityInteract.
@SubscribeEvent
public void entityInteract(PlayerInteractEvent.EntityInteract event) {
ItemStack stack = event.getEntityPlayer().getHeldItem(event.getHand());
if (stack == null) {
return;
}
Item item = stack.getItem();
EnumDyeColor dyeColor;
if (item == BOPItems.black_dye) {
dyeColor = EnumDyeColor.BLACK;
} else if (item == BOPItems.blue_dye) {
dyeColor = EnumDyeColor.BLUE;
} else if (item == BOPItems.brown_dye) {
dyeColor = EnumDyeColor.BROWN;
} else if (item == BOPItems.green_dye) {
dyeColor = EnumDyeColor.GREEN;
} else if (item == BOPItems.white_dye) {
dyeColor = EnumDyeColor.WHITE;
} else {
return;
}
Entity target = event.getTarget();
if (target instanceof EntityWolf) {
EntityWolf wolf = (EntityWolf) target;
if (dyeColor != wolf.getCollarColor()) {
wolf.setCollarColor(dyeColor);
if (!event.getEntityPlayer().capabilities.isCreativeMode) {
stack.setCount(stack.getCount() - 1);
}
event.setResult(Result.ALLOW);
}
} else if (target instanceof EntitySheep) {
EntitySheep sheep = (EntitySheep) target;
if (!sheep.getSheared() && dyeColor != sheep.getFleeceColor()) {
sheep.setFleeceColor(dyeColor);
if (!event.getEntityPlayer().capabilities.isCreativeMode) {
stack.setCount(stack.getCount() - 1);
}
event.setResult(Result.ALLOW);
}
}
}
Aggregations