/
NLadder.java
56 lines (48 loc) · 1.4 KB
/
NLadder.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
package mods.natura.blocks;
import java.util.List;
import mods.natura.common.NaturaTab;
import net.minecraft.block.BlockLadder;
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 NLadder extends BlockLadder
{
public String[] textureNames;
public IIcon[] icons;
public NLadder(String[] textures)
{
super();
this.textureNames = textures;
this.setHardness(0.4F);
this.setStepSound(soundLadderFootstep);
this.setCreativeTab(NaturaTab.tab);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons (IIconRegister iconRegister)
{
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
return icons[meta / 4];
}
@Override
public void getSubBlocks (Item id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < icons.length; iter++)
{
list.add(new ItemStack(id, 1, iter * 4));
}
}
}