001    package net.minecraft.src;
002    
003    public class ItemPainting extends Item
004    {
005        public ItemPainting(int par1)
006        {
007            super(par1);
008            this.setCreativeTab(CreativeTabs.tabDecorations);
009        }
010    
011        /**
012         * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
013         * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
014         */
015        public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
016        {
017            if (par7 == 0)
018            {
019                return false;
020            }
021            else if (par7 == 1)
022            {
023                return false;
024            }
025            else
026            {
027                byte var11 = 0;
028    
029                if (par7 == 4)
030                {
031                    var11 = 1;
032                }
033    
034                if (par7 == 3)
035                {
036                    var11 = 2;
037                }
038    
039                if (par7 == 5)
040                {
041                    var11 = 3;
042                }
043    
044                if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
045                {
046                    return false;
047                }
048                else
049                {
050                    EntityPainting var12 = new EntityPainting(par3World, par4, par5, par6, var11);
051    
052                    if (var12.onValidSurface())
053                    {
054                        if (!par3World.isRemote)
055                        {
056                            par3World.spawnEntityInWorld(var12);
057                        }
058    
059                        --par1ItemStack.stackSize;
060                    }
061    
062                    return true;
063                }
064            }
065        }
066    }