Custom data on Itemstack or Inventory

I need to put custom data on an itemstack or Inventory (either works).

My problem is that i have read over the documentation and scoured the forums, but i am unable to find anything that tells me how to do this. Maybe i am missing something.

So if it is not too much to ask, could someone be kind enough to give me a quick rundown or tutorial?

If it helps. I am making a inventory menu with pagination, I just need to know the current page so that the Next Page button knows what page is next :slight_smile:

I’m not too familiar with the API or coding for MC in general, but what if you create two new items with some nbt info set to the current page the player is on, so what “page number” would be handled in your code, and when the player hits next/previous in your code, The code would just add one or remove one from the current counter. Of course if it’s the first page it couldn’t have a previous, and if it’s the last page it can’t have a next.

Even better, instead of dealing with NBT which I don’t think is supported (not sure), maybe you can change the damage value of the item you are using.

What you could do is a few things:

There’s more on GitHub, but on the forums, this is as much I can provide for the moment.

I was looking into adding lore, but can i hide the lore?

It’s not possible to hide the lore currently.

If you’re looking to add invisible custom data, then you may want to look into making custom DataManipulators. You can follow the examples here.

2 Likes