triumph-gui icon indicating copy to clipboard operation
triumph-gui copied to clipboard

Ability to disable the nbt tag

Open vkicpeross opened this issue 2 years ago • 6 comments

I would like to request add the possibility to disable the nbt tag for a specific items or all of items

vkicpeross avatar Oct 22 '22 08:10 vkicpeross

A NBT tag is set to differentiate gui items from other items. What's your reason for this?

iGabyTM avatar Oct 22 '22 09:10 iGabyTM

When a player receives a set items this set do not merge with other items

vkicpeross avatar Oct 22 '22 09:10 vkicpeross

Then create a new item, the nbt is applied only to items set in GUIs

iGabyTM avatar Oct 22 '22 09:10 iGabyTM

Player gets this set from the menu with the nbt tag so I have to disable nbt tag for the items

vkicpeross avatar Oct 22 '22 09:10 vkicpeross

you have to create new items, is not possible to disable this

iGabyTM avatar Oct 22 '22 09:10 iGabyTM

For anyone looking here for a solution to this problem (which is, to my understanding, about removing the NBT tag added by triumph-gui to items so that you can let players remove items from the inventory and put them in their own inventory), you can do that by changing the ItemStack in the InventoryClickEvent listener.

For example, assuming original is the initial ItemStack:

GuiItem gui = ItemBuilder.from(original.clone()).asGuiItem();
gui.setAction(event -> {
    // ...
    event.setCurrentItem(original); // the important part
    event.setCancelled(false); // assuming you're cancelling all events in the default action
    // ...
});

TheKinrar avatar Dec 03 '22 08:12 TheKinrar