-
Notifications
You must be signed in to change notification settings - Fork 754
/
ToolForgeBlock.java
140 lines (121 loc) · 3.71 KB
/
ToolForgeBlock.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package tconstruct.blocks;
import java.util.List;
import mantle.blocks.abstracts.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.client.block.TableForgeRender;
import tconstruct.common.TProxyCommon;
import tconstruct.common.TRepo;
import tconstruct.library.TConstructRegistry;
public class ToolForgeBlock extends InventoryBlock
{
public ToolForgeBlock(Material material)
{
super(material);
this.func_149647_a(TConstructRegistry.blockTab);
this.func_149711_c(2f);
this.func_149672_a(Block.field_149777_j);
}
String[] textureNames = { "toolforge_iron", "toolforge_gold", "toolforge_diamond", "toolforge_emerald", "toolforge_cobalt", "toolforge_ardite", "toolforge_manyullyn", "toolforge_copper",
"toolforge_bronze", "toolforge_tin", "toolforge_aluminum", "toolforge_alubrass", "toolforge_alumite", "toolforge_steel" };
/* Rendering */
@Override
public String[] getTextureNames ()
{
return textureNames;
}
IIcon textureTop;
@Override
public void func_149651_a (IIconRegister iconRegister)
{
super.func_149651_a(iconRegister);
textureTop = iconRegister.registerIcon("tinker:toolforge_top");
}
@Override
public IIcon func_149691_a (int side, int meta)
{
if (side == 1)
{
return textureTop;
}
if (side == 0)
{
switch (meta)
{
case 0:
return Blocks.iron_block.func_149691_a(side, 0);
case 1:
return Blocks.gold_block.func_149691_a(side, 0);
case 2:
return Blocks.diamond_block.func_149691_a(side, 0);
case 3:
return Blocks.emerald_block.func_149691_a(side, 0);
default:
return TRepo.metalBlock.func_149691_a(side, meta - 4);
}
}
return this.icons[meta];
}
@Override
public boolean func_149686_d ()
{
return false;
}
@Override
public boolean func_149662_c ()
{
return false;
}
@Override
public boolean isSideSolid (IBlockAccess world, int x, int y, int z, ForgeDirection side)
{
return side == ForgeDirection.UP;
}
@Override
public int func_149645_b ()
{
return TableForgeRender.model;
}
@Override
public boolean func_149646_a (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
return new ToolForgeLogic();
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
int md = world.getBlockMetadata(x, y, z);
return TProxyCommon.toolForgeID;
}
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
@Override
public void func_149666_a (Item b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < textureNames.length; iter++)
{
list.add(new ItemStack(b, 1, iter));
}
}
}