Clone ItemStack before modifying NBT data in BaseWindow#redrawItem

This commit is contained in:
NichtStudioCode 2022-04-30 14:19:42 +02:00
parent 6a74920f75
commit bf82b93dbf

@ -68,6 +68,9 @@ public abstract class BaseWindow implements Window {
// This makes every item unique to prevent Shift-DoubleClick "clicking" multiple items at the same time.
if (itemStack.hasItemMeta()) {
// clone ItemStack in order to not modify the original
itemStack = itemStack.clone();
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.getPersistentDataContainer().set(SLOT_KEY, PersistentDataType.BYTE, (byte) index);
itemStack.setItemMeta(itemMeta);