Merge pull request #244 from Project-Cepi/nbt-hep

Compound and list ItemTags
This commit is contained in:
TheMode 2021-04-22 16:01:48 +02:00 committed by GitHub
commit 844671daab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,9 @@
package net.minestom.server.item;
import org.jetbrains.annotations.NotNull;
import org.jglrxavpok.hephaistos.nbt.NBT;
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
import org.jglrxavpok.hephaistos.nbt.NBTList;
import java.util.function.BiConsumer;
import java.util.function.Function;
@ -80,7 +82,11 @@ public class ItemTag<T> {
(nbtCompound, value) -> nbtCompound.setString(key, value));
}
// TODO List/Compound
public static @NotNull ItemTag<NBT> NBT(@NotNull String key) {
return new ItemTag<>(key,
nbt -> nbt.get(key).deepClone(),
((nbt, value) -> nbt.set(key, value.deepClone())));
}
public static @NotNull ItemTag<int[]> IntArray(@NotNull String key) {
return new ItemTag<>(key,