diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-08-27 01:34:08 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-08-27 01:34:08 +1000 |
commit | 072f6322fb789703f163030edf4b60bf5a0201af (patch) | |
tree | 9d2d9c2ba6fe3bc5139a9868ee4eca95629fdd95 /src/Java/miscutil/xmod/ic2/item/IC2_ItemIC2.java | |
parent | f555ac2e146e572155e176131c23e73cd74684f1 (diff) | |
download | GT5-Unofficial-072f6322fb789703f163030edf4b60bf5a0201af.tar.gz GT5-Unofficial-072f6322fb789703f163030edf4b60bf5a0201af.tar.bz2 GT5-Unofficial-072f6322fb789703f163030edf4b60bf5a0201af.zip |
+ Attempted to add custom IC2 generators.
% Refactored the xmod package to be a parent, beside core. No longer is it a child, it needs room to grow.
Diffstat (limited to 'src/Java/miscutil/xmod/ic2/item/IC2_ItemIC2.java')
-rw-r--r-- | src/Java/miscutil/xmod/ic2/item/IC2_ItemIC2.java | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/Java/miscutil/xmod/ic2/item/IC2_ItemIC2.java b/src/Java/miscutil/xmod/ic2/item/IC2_ItemIC2.java new file mode 100644 index 0000000000..0c6a28a4bc --- /dev/null +++ b/src/Java/miscutil/xmod/ic2/item/IC2_ItemIC2.java @@ -0,0 +1,104 @@ +package miscutil.xmod.ic2.item; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +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; + +public class IC2_ItemIC2 +extends Item +{ + public IC2_ItemIC2(String internalName) + { + setUnlocalizedName(internalName); + setCreativeTab(AddToCreativeTab.tabMachines); + setTextureName(CORE.MODID + ":" + 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(CORE.MODID + ":" + 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(ItemStack itemStack) + { + return getUnlocalizedName(); + } + + @Override + public String getItemStackDisplayName(ItemStack itemStack) + { + return StatCollector.translateToLocal(getUnlocalizedName(itemStack)); + } + + public IC2_ItemIC2 setRarity(int aRarity) + { + this.rarity = aRarity; + return this; + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack stack) + { + return EnumRarity.values()[this.rarity]; + } + + private int rarity = 0; + protected IIcon[] textures; +} |