Jump to content

[1.7.2] How To Add Lore To Items


MagnumMike55

Recommended Posts

Hello everybody. I've been searching around the minecraft code to try to find out how to add lore to my items and i've found nothing. So if anyone could point out the direction to go to learn how to do this, I would appretiate it :D. Also I would like to know how to add color to the item name and lore. BTW I'm not bad at coding, but i'm still learning.

 

EX:

 

Item Name: Fish

Desc: a regular fish only found in water.

Hello everyone! I'm the developer and owner of a mod called MagZ Aquatic Life Experience. Right now it's being worked on, but when it's released, check it out!

 

--[Also Check Out My Website!]--

Link to comment
Share on other sites

The best way to understadn and learn is to look up Item.class.

It has all the methods and info you are looking for.

 

For the color part you can use EnumChatFormatting.ANYCOLOR.

An example:

EnumChatFormatting.GREEN+"This is green"+EnumChatFormatting.RED+"This will be red".

You can use EnumChatFormatting.RESET to break the color any further.

 

 

Link to comment
Share on other sites

Im not seeing it. Can you possibly say the line it begins on? Sorry if I sound like a noob  :P

 

Hello everyone! I'm the developer and owner of a mod called MagZ Aquatic Life Experience. Right now it's being worked on, but when it's released, check it out!

 

--[Also Check Out My Website!]--

Link to comment
Share on other sites

In your IDE go to Referenced Libraries>forgeSrc>net,minecraft.item>Item.class

There you can see every method you can imagine with some additional info.

 

The starting line is "public".

Joking aside you can use CTRL + F to search the class so you can find everything a lot easier.

 

Hope i helped :)

Link to comment
Share on other sites

There's two ways of doing this. In your item class there is an addInformation method which contains a List variable. You can then add your own tooltip to the list (as a String).

 

The other way to do this, which (I believe) is the only if you want to add tooltips to vanilla items, is using the ItemToolTipEvent.

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

Link to comment
Share on other sites

Thanks for the reply! But i'm still kinda in a pickle  :P. I'm thinking it would be appropriate To make a different public String since i'm not asking to make the name, so I did this:

    public String getItemDescriptionName(ItemStack par1ItemStack) {
    	    	
    }

 

But now I don't know what to do the add the letters and line for my description. Do I just copy whats from the actual public String inside the addInformation method, or what? Sorry for being a big newb  :P.

Hello everyone! I'm the developer and owner of a mod called MagZ Aquatic Life Experience. Right now it's being worked on, but when it's released, check it out!

 

--[Also Check Out My Website!]--

Link to comment
Share on other sites

Anywhere between where your item's class is defined and where it ends, you can put this code. Note that you can add as many par3Lists as you want to create new lines of the description, and also that it doesn't auto-wrap (hence why I've split the text up onto two lines):

 

public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {

par3List.add("A regular fish only");

par3List.add("found in water");

}

 

For a specifically coloured name I've been using the section symbol in my en_us.lang file followed by the letter that defines the colour, like so:

 

§eFish

 

That probably isn't the best way to do it, but it works!

 

-Toastrackenigma

 

P.S. Note that for some reason that Eclipse (on my Mac) doesn't encode the section symbol correctly; I would suggest just typing all of the contents of the en_us.lang file in a separate text editor (like notepad or textedit) to make it work ;)

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It all began with a chance encounter with a testimonial shared by Olivia, a fellow traveler on the winding road of cryptocurrency. Her words spoke of a miraculous recovery orchestrated by Wizard Web Recovery, a beacon of hope in the murky waters of online fraud. Intrigued by her story, I reached out to Wizard Web Recovery, hoping they could work their magic on my blocked crypto recovery. With bated breath, I shared my plight, providing evidence of my dilemma and praying for a solution. To my astonishment, a prompt response came, swift and reassuring. Wizard Web Recovery wasted no time in assessing my situation, guiding me through the process with patience and expertise. and then like a ray of sunshine breaking through the clouds, came the news I had longed for – a new private key had been generated, restoring my precious bitcoins. It was a moment of jubilation, a triumph over adversity that filled me with newfound hope. At that moment, I realized the true power of Wizard Web Recovery, not just as skilled technicians, but as guardians of trust in the digital realm. With their assistance, I reclaimed what was rightfully mine, turning despair into determination and paving the way for a brighter future. But their capabilities did not end there. Delving deeper into their expertise, I discovered that Wizard Web Recovery possessed a wealth of knowledge in reclaiming lost stolen cryptocurrency, and even exposing fraudulent investment schemes. So to all those who find themselves entangled in the web of online fraud, take heart. With the guidance of Wizard Web Recovery, there is a path to redemption.     Write Mail; ( Wizard webrecovery AT  vprogrammer. net ) 
    • It all began with a chance encounter with a testimonial shared by Olivia, a fellow traveler on the winding road of cryptocurrency. Her words spoke of a miraculous recovery orchestrated by Wizard Web Recovery, a beacon of hope in the murky waters of online fraud. Intrigued by her story, I reached out to Wizard Web Recovery, hoping they could work their magic on my blocked crypto recovery. With bated breath, I shared my plight, providing evidence of my dilemma and praying for a solution. To my astonishment, a prompt response came, swift and reassuring. Wizard Web Recovery wasted no time in assessing my situation, guiding me through the process with patience and expertise. and then like a ray of sunshine breaking through the clouds, came the news I had longed for – a new private key had been generated, restoring my precious bitcoins. It was a moment of jubilation, a triumph over adversity that filled me with newfound hope. At that moment, I realized the true power of Wizard Web Recovery, not just as skilled technicians, but as guardians of trust in the digital realm. With their assistance, I reclaimed what was rightfully mine, turning despair into determination and paving the way for a brighter future. But their capabilities did not end there. Delving deeper into their expertise, I discovered that Wizard Web Recovery possessed a wealth of knowledge in reclaiming lost stolen cryptocurrency, and even exposing fraudulent investment schemes. So to all those who find themselves entangled in the web of online fraud, take heart. With the guidance of Wizard Web Recovery, there is a path to redemption.    
    • How can I add drops when killing an entity? Now there are no drops. How can I add an @override to change the attack speed to 1.6 and show "when in main hand...attack damage,...attack speed"? also, how can I make the item enchantable? 
    • Ok. Thanks. by the way, will this crash in any circumstances? public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) { if (entity instanceof LivingEntity){ LivingEntity victim = (LivingEntity) entity; if(!victim.isDeadOrDying() && victim.getHealth()>0){ victim.setHealth(0); return true; } } return false; }  
    • You shouldn't be extracting the mod .jar, just place it in your mods folder.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.