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