    001    package net.minecraft.src;
    002
    003    public class ItemEmptyMap extends ItemMapBase
    004    {
    005        protected ItemEmptyMap(int par1)
    006        {
    007            super(par1);
    008            this.setCreativeTab(CreativeTabs.tabMisc);
    009        }
    010
    011        /**
    012         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
    013         */
    014        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    015        {
    016            ItemStack var4 = new ItemStack(Item.map, 1, par2World.getUniqueDataId("map"));
    017            String var5 = "map_" + var4.getItemDamage();
    018            MapData var6 = new MapData(var5);
    019            par2World.setItemData(var5, var6);
    020            var6.scale = 0;
    021            int var7 = 128 * (1 << var6.scale);
    022            var6.xCenter = (int)(Math.round(par3EntityPlayer.posX / (double)var7) * (long)var7);
    023            var6.zCenter = (int)(Math.round(par3EntityPlayer.posZ / (double)var7) * (long)var7);
    024            var6.dimension = (byte)par2World.provider.dimensionId;
    025            var6.markDirty();
    026            --par1ItemStack.stackSize;
    027
    028            if (par1ItemStack.stackSize <= 0)
    029            {
    030                return var4;
    031            }
    032            else
    033            {
    034                if (!par3EntityPlayer.inventory.addItemStackToInventory(var4.copy()))
    035                {
    036                    par3EntityPlayer.dropPlayerItem(var4);
    037                }
    038
    039                return par1ItemStack;
    040            }
    041        }
    042    }