Jump to content

Recommended Posts

Posted

Hello!

I have been working on a custom item system where a lot of item properties exist, like vitality, dexterity and many others.
This works fine by adding to the NBT of the ItemStack and I can also query the values just fine, however I have a problem displaying these to the user.
My mod runs exclusively on the server side, so I can't use ItemTooltipEvent sadly, but that is exactly what I would have needed.
I assume I could change the lore and do tricks with that to have it show, but I couldn't get the lore to show properly, I was trying to put my data into the NBT tag.
And I also can't remove the default information thing that items display, like armors have "+x Armor" which is awful for my use case as I implement my own armor system.

I also need to be able to generate these descriptions on the fly, real time, because I want to be able to change how attributes work/are displayed.
So as an example if I put +1 Vitality on an item, and want to display it as "+2 To Life" not as vitality, but then I change my mind, and want to update how item information is displayed.
This may sound dumb, but I want to be able to patch items and their properties and if their description is just a static string, even if I change how the underlying data works, I can't change the description.
Take that example, what if I decide to change vitality to give +3 life per point not 2, I wouldn't need to change the item's data at all, just the description.

I hope I was clear, I'll be around if I need to clear anything up,
Thanks

Posted

I was hoping there was some method to catch when the client is looking for the description and instead of going through the standard way of getting it from the NBT I could supply it with different data, but then the whole NBT is passed to the client, and it decides on how to display it if I understand correctly so yeah out of luck, I will look into regenerating the item Lore some way when something changes

Posted

Yeah well I see, as for using the lore tag...
How do I produce this structure in the NBT?

{display:{Lore:['{"text":"foo"}','{"text":"bar"}']}}

The CompoundNBT interface is quite different from json libraries I am used to, I cant figure out how can I add a json object array to lore

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.