-
Notifications
You must be signed in to change notification settings - Fork 497
/
ItemPipeWire.java
63 lines (52 loc) · 1.65 KB
/
ItemPipeWire.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
package buildcraft.transport;
import buildcraft.api.transport.PipeWire;
import buildcraft.core.ItemBuildCraft;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
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;
public class ItemPipeWire extends ItemBuildCraft {
private IIcon[] icons;
public ItemPipeWire() {
super();
setHasSubtypes(true);
setMaxDamage(0);
setPassSneakClick(true);
setUnlocalizedName("pipeWire");
}
@Override
public IIcon getIconFromDamage(int damage) {
return icons[damage];
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return "item." + PipeWire.fromOrdinal(stack.getItemDamage()).getTag();
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List itemList) {
for (PipeWire pipeWire : PipeWire.VALUES) {
itemList.add(pipeWire.getStack());
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
icons = new IIcon[PipeWire.VALUES.length];
for (PipeWire pipeWire : PipeWire.VALUES) {
icons[pipeWire.ordinal()] = par1IconRegister.registerIcon("buildcraft:" + pipeWire.getTag());
}
}
public void registerItemStacks() {
for (PipeWire pipeWire : PipeWire.VALUES) {
GameRegistry.registerCustomItemStack(pipeWire.getTag(), pipeWire.getStack());
}
}
}