blob: 98846e69507d37fd0f339ef1ac7742caac290cdc (
plain)
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
|
package gtPlusPlus.xmod.ic2.item;
import static gregtech.api.enums.Mods.GTPlusPlus;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.creative.AddToCreativeTab;
public class IC2_ItemIC2 extends Item {
public IC2_ItemIC2(final String internalName) {
this.setUnlocalizedName(internalName);
this.setCreativeTab(AddToCreativeTab.tabMachines);
this.setTextureName(GTPlusPlus.ID + ":" + internalName);
GameRegistry.registerItem(this, internalName);
}
public String getTextureFolder() {
return null;
}
/*
* public String getTextureName(int index) { if ((!this.hasSubtypes) && (index > 0)) { return null; } String name =
* getUnlocalizedName(new ItemStack(this, 1, index)); if ((name != null) && (name.length() > 4)) { return
* name.substring(4); } return name; }
* @Override
* @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { int indexCount = 0; while
* (getTextureName(indexCount) != null) { indexCount++; if (indexCount > 32767) { throw new
* RuntimeException("More Item Icons than actually possible @ " + getUnlocalizedName()); } } this.textures = new
* IIcon[indexCount]; for (int index = 0; index < indexCount; index++) { this.textures[index] =
* iconRegister.registerIcon(GTPlusPlus.ID + ":" + getUnlocalizedName()); } }
* @Override
* @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int meta) { if (meta < this.textures.length) { return
* this.textures[meta]; } return this.textures.length < 1 ? null : this.textures[0]; }
*/
@Override
public String getUnlocalizedName() {
return super.getUnlocalizedName();
}
@Override
public String getUnlocalizedName(final ItemStack itemStack) {
return this.getUnlocalizedName();
}
@Override
public String getItemStackDisplayName(final ItemStack itemStack) {
return StatCollector.translateToLocal(this.getUnlocalizedName(itemStack));
}
public IC2_ItemIC2 setRarity(final int aRarity) {
this.rarity = aRarity;
return this;
}
@Override
@SideOnly(Side.CLIENT)
public EnumRarity getRarity(final ItemStack stack) {
return EnumRarity.values()[this.rarity];
}
private int rarity = 0;
protected IIcon[] textures;
}
|