Posted September 26, 201410 yr i have this item but when i print out the UnlocalizedName it says item.null item class package com.baublelicious.items; import java.util.List; import javax.swing.Icon; import com.baublelicious.baublelicious; import com.baublelicious.iconhelper; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; 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.IIcon; import net.minecraft.world.World; public class ItemMagicCore extends ItemMod { public IIcon[] icons = new IIcon[256]; public static final String[] TYPES = { "tier1", "tier2", "tier3" }; public ItemMagicCore(){ super(); setHasSubtypes(true); } @Override public void getSubItems(Item item, CreativeTabs tabs, List itemList) { for(int counter = 0; counter <= 2; ++counter) { itemList.add(new ItemStack(item, 1, counter)); } } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { System.out.print(getUnlocalizedName()); return par1ItemStack; } @Override public String getUnlocalizedName(ItemStack item) { return "item." + TYPES[item.getItemDamage()].toLowerCase() + "MagicCore"; } } main item class package com.baublelicious.items; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import com.baublelicious.baublelicious; import com.baublelicious.iconhelper; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemMod extends Item { public ItemMod() { super(); setCreativeTab(baublelicious.TabBaublelicious); } @Override public Item setUnlocalizedName(String par1Str) { GameRegistry.registerItem(this, par1Str); return super.setUnlocalizedName(par1Str); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister par1IconRegister) { itemIcon = iconhelper.forItem(par1IconRegister, this); } }
September 26, 201410 yr In your constructor add this.setUnlocalizedName("yourItem"); which will result in item.yourItem . Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
September 26, 201410 yr What do you mean with that? Do you different names for different metadata? Or something else? Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
September 26, 201410 yr @Override public String getUnlocalizedName(ItemStack item) { // System.out.println(getUnlocalizedName() + "." + // names[getDamage(item)]); return getUnlocalizedName() + "." + this.names[getDamage(item)]; } you then have a String array called Names and in the getSubTypes just add each name into the array add the subtype names, then you can add them into your .lang file with the "item.unlocalizedname.subname.name" I crossed out my error, I am working with another modder across the world, and he reformatted my code. which made me miss the fact that I just declare my string array at the start. Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
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.