mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Compound and list tags
This commit is contained in:
parent
7d574317dc
commit
7eb13de433
@ -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,17 @@ public class ItemTag<T> {
|
||||
(nbtCompound, value) -> nbtCompound.setString(key, value));
|
||||
}
|
||||
|
||||
// TODO List/Compound
|
||||
public static @NotNull ItemTag<NBTCompound> Compound(@NotNull String key) {
|
||||
return new ItemTag<>(key,
|
||||
nbtCompound -> nbtCompound.getCompound(key),
|
||||
((nbtCompound, value) -> nbtCompound.set(key, value)));
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
public static @NotNull ItemTag<int[]> IntArray(@NotNull String key) {
|
||||
return new ItemTag<>(key,
|
||||
|
Loading…
Reference in New Issue
Block a user