diff --git a/src/main/java/net/minestom/server/item/ItemTag.java b/src/main/java/net/minestom/server/item/ItemTag.java index 50a7bca9f..7edd3c0e7 100644 --- a/src/main/java/net/minestom/server/item/ItemTag.java +++ b/src/main/java/net/minestom/server/item/ItemTag.java @@ -84,14 +84,14 @@ public class ItemTag { public static @NotNull ItemTag Compound(@NotNull String key) { return new ItemTag<>(key, - nbtCompound -> nbtCompound.getCompound(key), - ((nbtCompound, value) -> nbtCompound.set(key, value))); + nbtCompound -> nbtCompound.getCompound(key).deepClone(), + ((nbtCompound, value) -> nbtCompound.set(key, value.deepClone()))); } public static @NotNull ItemTag> List(@NotNull String key) { return new ItemTag<>(key, - nbtCompound -> nbtCompound.getList(key), - ((nbtCompound, value) -> nbtCompound.set(key, value))); + nbtCompound -> (NBTList) nbtCompound.getList(key).deepClone(), + ((nbtCompound, value) -> nbtCompound.set(key, value.deepClone()))); } public static @NotNull ItemTag IntArray(@NotNull String key) {