Jump to content

Recommended Posts

Posted

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!]--

Posted

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.

 

 

Posted

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!]--

Posted

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 :)

Posted

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.

Posted

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!]--

Posted

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 ;)

 

Posted

Thanks! I will get back to you if it works! Thanks for the reply  :D!

 

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!]--

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



×
×
  • Create New...

Important Information

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