mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 08:58:20 +01:00
Merge pull request #244 from Project-Cepi/nbt-hep
Compound and list ItemTags
This commit is contained in:
commit
844671daab
@ -1,7 +1,9 @@
|
|||||||
package net.minestom.server.item;
|
package net.minestom.server.item;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jglrxavpok.hephaistos.nbt.NBT;
|
||||||
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||||
|
import org.jglrxavpok.hephaistos.nbt.NBTList;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -80,7 +82,11 @@ public class ItemTag<T> {
|
|||||||
(nbtCompound, value) -> nbtCompound.setString(key, value));
|
(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) {
|
public static @NotNull ItemTag<int[]> IntArray(@NotNull String key) {
|
||||||
return new ItemTag<>(key,
|
return new ItemTag<>(key,
|
||||||
|
Loading…
Reference in New Issue
Block a user