Java Code Examples for net.minecraft.init.Items#LEAD

The following examples show how to use net.minecraft.init.Items#LEAD . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: TickDynamic   File: Entity.java    License: MIT License 4 votes vote down vote up
/**
 * Called when a user uses the creative pick block button on this entity.
 *
 * @param target The full target the player is looking at
 * @return A ItemStack to add to the player's inventory, Null if nothing should be added.
 */
public ItemStack getPickedResult(MovingObjectPosition target)
{
    if (this instanceof EntityPainting)
    {
        return new ItemStack(Items.painting);
    }
    else if (this instanceof EntityLeashKnot)
    {
        return new ItemStack(Items.lead);
    }
    else if (this instanceof EntityItemFrame)
    {
        ItemStack held = ((EntityItemFrame)this).getDisplayedItem();
        if (held == null)
        {
            return new ItemStack(Items.item_frame);
        }
        else
        {
            return held.copy();
        }
    }
    else if (this instanceof EntityMinecart)
    {
        return ((EntityMinecart)this).getCartItem();
    }
    else if (this instanceof EntityBoat)
    {
        return new ItemStack(Items.boat);
    }
    else
    {
        int id = EntityList.getEntityID(this);
        if (id > 0 && EntityList.entityEggs.containsKey(id))
        {
            return new ItemStack(Items.spawn_egg, 1, id);
        }
    }
    return null;
}