-
Notifications
You must be signed in to change notification settings - Fork 755
/
MetalItemBlock.java
38 lines (31 loc) · 1.09 KB
/
MetalItemBlock.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
package tconstruct.items.blocks;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
public class MetalItemBlock extends ItemBlock
{
public static final String blockType[] = { "Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze", "Tin", "Aluminum", "AlBrass", "Alumite", "Steel", "Ender" };
public MetalItemBlock(int id)
{
super(id);
setMaxDamage(0);
setHasSubtypes(true);
}
public int getMetadata (int meta)
{
return meta;
}
public String getUnlocalizedName (ItemStack itemstack)
{
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
return (new StringBuilder()).append("StorageMetals.").append(blockType[pos]).toString();
}
@Override
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add(StatCollector.translateToLocal("metalblock.tooltip"));
}
}