Jump to content

Reading Item lore & colorcode


Recommended Posts


Just a quick question; I've already tried playing around with the NBT compounds, but I can't seem to find out how to effectively save the lore of an itemstack in a String list. If anyone has an answer, I'd be delighted to hear it!

Also, is it somehow possible to determine which colorcode was used in an itemname? I tried checking for the sign, e.g.


but it doesn't seem to work.

Link to comment
Share on other sites

You need to use


. Then you can use


to obtain the color (or null). But I am not sure this includes manually specified colors via color codes, so you need to scan for those as well inside



Tried it using

if (item.getEntityItem().getChatComponent().getChatStyle().getColor().equals(TextFormatting.DARK_PURPLE)) {

, but without success

Link to comment
Share on other sites

Ok, where is this purple coming from? What kinda ItemStack is it?

All kind of items, ranging from weapons to slabs; the name is written in color, and as I didn't figure out how to properly read the lore yet, the only way to determine the "rarity" (RPG-server) of the item is to check the color.

Link to comment
Share on other sites

What do you mean by lore? The display name?

Lore is strings to be shown on tooltips stored in the itemstack, and frequently used by bukkit plugin developers.

They stores every information about the itemstack there.

(It's the only way to do that in plugin. Might be abstraction disaster)


This is an example item; In order to know which "rarity" it has, I can either read the color (Aqua = "Legendary") or the lore, which states "Legendary Item"

Is it generated by a plugin? Or another mod?

If it's a mod, there is definitely better way.

If it's a plugin, item.getTagCompound().getCompoundTag("display").getTagList("Lore", 8); gives the nbt list with strings which represents the lore.

use #tagCount which means the size of the list, and #getStringTagAt(i) to get the i-th lore string.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.

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.


  • Create New...

Important Information

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