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