Posted May 4, 201312 yr I'm making a multiple item, and i managed to set different icons for it, but i'm stuck at names... Here's the code. package net.railowar.src; import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemWideRails extends Item { public static final String[] wNames = new String[] {"Straight", "Right", "Left", "S", "Z"}; public static final String[] wTex = new String[] {"rails", "rails_r", "rails_l", "rails_s", "rails_z"}; @SideOnly(Side.CLIENT) private Icon[] ico; public ItemWideRails(int par1) { super(par1); this.setHasSubtypes(true); this.setMaxDamage(0); this.maxStackSize = 1; setCreativeTab(CreativeTabs.tabTransport); setUnlocalizedName("Rails"); } @SideOnly(Side.CLIENT) public Icon getIconFromDamage(int par1) { int j = MathHelper.clamp_int(par1, 0, 4); return this.ico[j]; } public String getUnlocalizedName(ItemStack par1ItemStack) { int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 4); return super.getUnlocalizedName() + "." + wNames[i]; } @SideOnly(Side.CLIENT) public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) { for (int j = 0; j < 5; ++j) { par3List.add(new ItemStack(par1, 1, j)); } } @SideOnly(Side.CLIENT) public void updateIcons(IconRegister par1IconRegister) { this.ico = new Icon[wTex.length]; for (int i = 0; i < wTex.length; ++i) { this.ico[i] = par1IconRegister.registerIcon("RoW:" + wTex[i]); } } } Please, help. If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
May 4, 201312 yr Author So, no ideas? If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
May 4, 201312 yr In your item constructor, put: LanguageRegistry.addName(this, "Your Item Name Here"); EDIT: Ah, wait, I missed a word - let me get back to you on this. EDIT 2: Check this out - it looks like you need to pass in the names one at a time while also passing in an ItemStack with the desired damage value: http://www.minecraftforge.net/wiki/Metadata_Based_Subblocks#Block_and_Language_Registration
May 4, 201312 yr Author Thanks, that helped. If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.