use of stevekung.mods.moreplanets.module.planets.nibiru.entity.EntityShlime in project MorePlanets by SteveKunG.
the class EntityEventHandler method onInteractEntity.
@SubscribeEvent
public void onInteractEntity(EntityInteract event) {
ItemStack itemStack = event.getItemStack();
Entity entity = event.getTarget();
if (!itemStack.isEmpty() && itemStack.getItem() == Items.DYE) {
EnumDyeColor color = EnumDyeColor.byDyeDamage(itemStack.getItemDamage() & 15);
if (entity instanceof EntityShlime) {
EntityShlime shlime = (EntityShlime) entity;
if (!shlime.getSheared() && shlime.getFleeceColor() != color) {
shlime.setFleeceColor(color);
if (!event.getEntityPlayer().capabilities.isCreativeMode) {
itemStack.shrink(1);
}
}
event.setResult(Result.ALLOW);
}
}
}
use of stevekung.mods.moreplanets.module.planets.nibiru.entity.EntityShlime in project MorePlanets by SteveKunG.
the class ItemDyeMP method itemInteractionForEntity.
@Override
public boolean itemInteractionForEntity(ItemStack itemStack, EntityPlayer player, EntityLivingBase target, EnumHand hand) {
if (target instanceof EntitySheep) {
EntitySheep entitysheep = (EntitySheep) target;
EnumDyeColor enumdyecolor = EnumDyeColor.BLUE;
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor) {
entitysheep.setFleeceColor(enumdyecolor);
itemStack.shrink(1);
}
return true;
}
if (target instanceof EntityShlime) {
EntityShlime entitysheep = (EntityShlime) target;
EnumDyeColor enumdyecolor = EnumDyeColor.BLUE;
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor) {
entitysheep.setFleeceColor(enumdyecolor);
itemStack.shrink(1);
}
return true;
} else {
return false;
}
}
Aggregations