Posted May 18, 201312 yr Hello, I'm trying to make it so my amulet item has a description under it, which is similar to the music disc where it says the disc number and name. I have the following code and there is a plus sign that adds that string to the actual name and the name becomes "Turns time to dayAmulet of Day" instead of "Amulet of Day" (with the string under it). This code is from the minecraft "Item" File and I dont know how to change it to not make it add itself to the name (unless its supposed to?) Code Block: public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {} public String getItemDisplayName(ItemStack par1ItemStack) { return ("Turns time to day" + StringTranslate.getInstance().translateNamedKey(this.getLocalizedName(par1ItemStack))).trim(); } Full Item Code: package mods.magicalAmulets.common; import java.awt.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.StringTranslate; import net.minecraft.world.World; public class ItemAmuletDay extends Item{ public ItemAmuletDay(int par1) { super(par1); this.setMaxStackSize(1); this.setCreativeTab(CreativeTabs.tabTools); } public EnumRarity getRarity(ItemStack is){ return EnumRarity.epic; } public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entity){ float var4 = 1.0F; int i = (int)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)var4); int j = (int)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)var4 + 1.62D - (double)entity.yOffset); int k = (int)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)var4); world.setWorldTime(0); return itemstack; } public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {} public String getItemDisplayName(ItemStack par1ItemStack) { return ("Turns time to day" + StringTranslate.getInstance().translateNamedKey(this.getLocalizedName(par1ItemStack))).trim(); } } Thanks!
May 18, 201312 yr here is an example of how to use it Im sure you can figure out from there public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add("Hello World!"); } http://r1306.hizliresim.com/1b/1/np1mm.png[/img]
May 18, 201312 yr here is an example of how to use it Im sure you can figure out from there public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add("Hello World!"); } Don't you need to @Override that? I may be wrong though...
May 18, 201312 yr Very interesting its really not working It was working in 1.5.1 in 1.5.2 its not working http://r1306.hizliresim.com/1b/1/np1mm.png[/img]
May 19, 201312 yr This works for me: @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add("Line I"); par3List.add("Line II"); } Thanks...!
May 19, 201312 yr Don't you need to @Override that? I may be wrong though... @Override is only an annotation. A fancy comment that makes the IDE do extra error checking. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.