Deepclone and cast

This commit is contained in:
LeoDog896 2021-04-14 18:19:07 -04:00
parent 7eb13de433
commit c41c202589

View File

@ -84,14 +84,14 @@ public class ItemTag<T> {
public static @NotNull ItemTag<NBTCompound> 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 <O extends NBT> @NotNull ItemTag<NBTList<O>> List(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getList(key),
((nbtCompound, value) -> nbtCompound.set(key, value)));
nbtCompound -> (NBTList<O>) nbtCompound.getList(key).deepClone(),
((nbtCompound, value) -> nbtCompound.set(key, value.deepClone())));
}
public static @NotNull ItemTag<int[]> IntArray(@NotNull String key) {