BlockWorkbench .java

net.minecraft.block.BlockWorkbench (class, 78 lines): members: InterfaceCraftingTable, onBlockActivated. strings: "minecraft:crafting_table", ".name".

net.minecraft.blockclass78 linescommonextends Block2.2 KB

API Surface (6)

boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
String getName()
boolean hasCustomName()
IChatComponent getDisplayName()
Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
String getGuiID()

String literals (2)

".name"
"minecraft:crafting_table"

Full Source

BlockWorkbench.java78 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import net.minecraft.block.material.Material;
4
import net.minecraft.block.state.IBlockState;
5
import net.minecraft.creativetab.CreativeTabs;
6
import net.minecraft.entity.player.EntityPlayer;
7
import net.minecraft.entity.player.InventoryPlayer;
8
import net.minecraft.init.Blocks;
9
import net.minecraft.inventory.Container;
10
import net.minecraft.inventory.ContainerWorkbench;
11
import net.minecraft.stats.StatList;
12
import net.minecraft.util.BlockPos;
13
import net.minecraft.util.ChatComponentTranslation;
14
import net.minecraft.util.EnumFacing;
15
import net.minecraft.util.IChatComponent;
16
import net.minecraft.world.IInteractionObject;
17
import net.minecraft.world.World;
18
19
public class BlockWorkbench extends Block
20
{
21
    protected BlockWorkbench()
22
    {
23
        super(Material.wood);
24
        this.setCreativeTab(CreativeTabs.tabDecorations);
25
    }
26
27
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
28
    {
29
        if (worldIn.isRemote)
30
        {
31
            return true;
32
        }
33
        else
34
        {
35
            playerIn.displayGui(new BlockWorkbench.InterfaceCraftingTable(worldIn, pos));
36
            playerIn.triggerAchievement(StatList.field_181742_Z);
37
            return true;
38
        }
39
    }
40
41
    public static class InterfaceCraftingTable implements IInteractionObject
42
    {
43
        private final World world;
44
        private final BlockPos position;
45
46
        public InterfaceCraftingTable(World worldIn, BlockPos pos)
47
        {
48
            this.world = worldIn;
49
            this.position = pos;
50
        }
51
52
        public String getName()
53
        {
54
            return null;
55
        }
56
57
        public boolean hasCustomName()
58
        {
59
            return false;
60
        }
61
62
        public IChatComponent getDisplayName()
63
        {
64
            return new ChatComponentTranslation(Blocks.crafting_table.getUnlocalizedName() + ".name", new Object[0]);
65
        }
66
67
        public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
68
        {
69
            return new ContainerWorkbench(playerInventory, this.world, this.position);
70
        }
71
72
        public String getGuiID()
73
        {
74
            return "minecraft:crafting_table";
75
        }
76
    }
77
}
78

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