-
Notifications
You must be signed in to change notification settings - Fork 497
/
BlockAssemblyTable.java
103 lines (84 loc) · 2.52 KB
/
BlockAssemblyTable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package buildcraft.silicon;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import buildcraft.BuildCraftSilicon;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.DefaultProps;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
public class BlockAssemblyTable extends BlockContainer {
public BlockAssemblyTable(int i) {
super(i, Material.iron);
setBlockBounds(0, 0, 0, 1, 9F / 16F, 1);
setHardness(0.5F);
setCreativeTab(CreativeTabBuildCraft.tabBuildCraft);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
public boolean isACube() {
return false;
}
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
// Drop through if the player is sneaking
if (entityplayer.isSneaking())
return false;
if (!CoreProxy.proxy.isRenderWorld(world)) {
int meta = world.getBlockMetadata(i, j, k);
entityplayer.openGui(BuildCraftSilicon.instance, meta, world, i, j, k);
}
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
@Override
public Icon getBlockTextureFromSideAndMetadata(int i, int j) {
if (i == 1) {
return j == 0 ? 16 * 6 + 12 : 16 * 3 + 15;
} else if (i == 0) {
return 16 * 2 + 15;
} else {
return j == 0 ? 16 * 6 + 11 : 16 * 3 + 14;
}
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return metadata == 0 ? new TileAssemblyTable() : new TileAssemblyAdvancedWorkbench();
}
@Override
public TileEntity createNewTileEntity(World var1) {
return null;
}
@Override
public String getTextureFile() {
return DefaultProps.TEXTURE_BLOCKS;
}
@Override
public int damageDropped(int par1) {
return par1;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
par3List.add(new ItemStack(this, 1, 0));
par3List.add(new ItemStack(this, 1, 1));
}
}