Add generic NBT

This commit is contained in:
LeoDog896 2021-04-22 09:52:51 -04:00
parent c41c202589
commit 19e55f985e

View File

@ -82,16 +82,10 @@ public class ItemTag<T> {
(nbtCompound, value) -> nbtCompound.setString(key, value));
}
public static @NotNull ItemTag<NBTCompound> Compound(@NotNull String key) {
public static @NotNull ItemTag<NBT> NBT(@NotNull String key) {
return new ItemTag<>(key,
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 -> (NBTList<O>) nbtCompound.getList(key).deepClone(),
((nbtCompound, value) -> nbtCompound.set(key, value.deepClone())));
nbt -> nbt.get(key).deepClone(),
((nbt, value) -> nbt.set(key, value.deepClone())));
}
public static @NotNull ItemTag<int[]> IntArray(@NotNull String key) {