-
Notifications
You must be signed in to change notification settings - Fork 753
/
TConstructBlock.java
75 lines (64 loc) · 1.83 KB
/
TConstructBlock.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
package tconstruct.blocks;
import java.util.List;
import mantle.blocks.MantleBlock;
import tconstruct.library.TConstructRegistry;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TConstructBlock extends MantleBlock
{
public String[] textureNames;
public IIcon[] icons;
public TConstructBlock( Material material, float hardness, String[] tex)
{
super( material);
func_149711_c(hardness);
this.func_149647_a(TConstructRegistry.blockTab);
textureNames = tex;
}
@Override
public int damageDropped (int meta)
{
return meta;
}
@Override
@SideOnly(Side.CLIENT)
public void func_149651_a (IIconRegister iconRegister)
{
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon func_149691_a (int side, int meta)
{
return meta < icons.length ? icons[meta] : icons[0];
}
@SideOnly(Side.CLIENT)
public int getSideTextureIndex (int side)
{
if (side == 0)
return 2;
if (side == 1)
return 0;
return 1;
}
//TODO getSubBlocks
@Override
public void func_149666_a (Item block, CreativeTabs tab, List list)
{
for (int iter = 0; iter < icons.length; iter++)
{
list.add(new ItemStack(block, 1, iter));
}
}
}