Java Code Examples for net.minecraft.init.Items.GOLD_NUGGET

The following are Jave code examples for showing how to use GOLD_NUGGET of the net.minecraft.init.Items class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Torched   File: EntityTorchFirework.java   View Source Code Vote up 4 votes
@Override
public boolean processInitialInteract(EntityPlayer player, EnumHand hand)
{
    if(!world.isRemote && !activating)
    {
        ItemStack is = player.getHeldItem(hand);
        if(is.getItem() == Item.getItemFromBlock(Blocks.TORCH) && getTorches() < 512)
        {
            addTorches(1);
            if(!player.capabilities.isCreativeMode)
            {
                is.shrink(1);
                if(is.isEmpty())
                {
                    player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY);
                }
            }
            player.swingArm(hand);
            return true;
        }
        else if(is.getItem() == Items.GUNPOWDER && getGP() < 512)
        {
            addGP(1);
            if(!player.capabilities.isCreativeMode)
            {
                is.shrink(1);
                if(is.isEmpty())
                {
                    player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY);
                }
            }
            player.swingArm(hand);
            return true;
        }
        else if(is.getItem() == Items.FLINT_AND_STEEL)
        {
            activating = true;
            if(!player.capabilities.isCreativeMode)
            {
                is.setItemDamage(is.getItemDamage() + 1);
            }
            initiator = player;
            player.swingArm(hand);
            return true;
        }
        else if(is.getItem() == Items.GOLD_NUGGET && getSplits() < 16)
        {
            addSplit();
            if(!player.capabilities.isCreativeMode)
            {
                is.shrink(1);
                if(is.isEmpty())
                {
                    player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY);
                }
            }
            player.swingArm(hand);
            return true;
        }
    }
    if(world.isRemote && (player.getHeldItem(hand).getItem() == Item.getItemFromBlock(Blocks.TORCH) || player.getHeldItem(hand).getItem() == Items.GUNPOWDER || player.getHeldItem(hand).getItem() == Items.FLINT_AND_STEEL || player.getHeldItem(hand).getItem() == Items.GOLD_NUGGET))
    {
        player.swingArm(hand);
        return true;
    }
    return false;
}