ItemEmptyMap .java

net.minecraft.item.ItemEmptyMap (class, 48 lines): members: onItemRightClick. strings: "map_". imports: MapData, StatList, CreativeTabs, Items.

net.minecraft.itemclass48 linescommonextends ItemMapBase1.5 KB

API Surface (1)

ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)

String literals (1)

"map_"

Code Graph: Dependencies (8)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ItemEmptyMap.java48 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.item;
2
3
import net.minecraft.creativetab.CreativeTabs;
4
import net.minecraft.entity.player.EntityPlayer;
5
import net.minecraft.init.Items;
6
import net.minecraft.stats.StatList;
7
import net.minecraft.world.World;
8
import net.minecraft.world.storage.MapData;
9
10
public class ItemEmptyMap extends ItemMapBase
11
{
12
    protected ItemEmptyMap()
13
    {
14
        this.setCreativeTab(CreativeTabs.tabMisc);
15
    }
16
17
    /**
18
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
19
     */
20
    public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
21
    {
22
        ItemStack itemstack = new ItemStack(Items.filled_map, 1, worldIn.getUniqueDataId("map"));
23
        String s = "map_" + itemstack.getMetadata();
24
        MapData mapdata = new MapData(s);
25
        worldIn.setItemData(s, mapdata);
26
        mapdata.scale = 0;
27
        mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale);
28
        mapdata.dimension = (byte)worldIn.provider.getDimensionId();
29
        mapdata.markDirty();
30
        --itemStackIn.stackSize;
31
32
        if (itemStackIn.stackSize <= 0)
33
        {
34
            return itemstack;
35
        }
36
        else
37
        {
38
            if (!playerIn.inventory.addItemStackToInventory(itemstack.copy()))
39
            {
40
                playerIn.dropPlayerItemWithRandomChoice(itemstack, false);
41
            }
42
43
            playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
44
            return itemStackIn;
45
        }
46
    }
47
}
48

Deobfuscated MCP 1.8.9 source of ItemEmptyMap from Marcelektro/MavenMCP-1.8.9 (net/minecraft/item/ItemEmptyMap.java), stored verbatim.