Java Code Examples for net.minecraft.entity.passive.EntitySheep#setFleeceColor()

The following examples show how to use net.minecraft.entity.passive.EntitySheep#setFleeceColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemResource.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase yEntityLivingBase) {
    if (yEntityLivingBase instanceof EntitySheep && stack.getItemDamage() == 1) {
        EntitySheep entitysheep = (EntitySheep) yEntityLivingBase;

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != 15) {
            entitysheep.setFleeceColor(15);
            --stack.stackSize;
        }

        return true;
    } else {
        return false;
    }
}