mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-14 22:56:31 +01:00
Add Tag#NBT write support
This commit is contained in:
parent
bf44625730
commit
5ddfff22f2
@ -33,10 +33,13 @@ public class Tag<T> {
|
||||
/**
|
||||
* Reads the complete tag holder compound.
|
||||
* <p>
|
||||
* Writing is not supported.
|
||||
* Writing will override all tags. Proceed with caution.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static final Tag<NBTCompound> NBT = new Tag<>(null, NBTCompound::deepClone, null, null);
|
||||
public static final Tag<NBTCompound> NBT = new Tag<>(null, NBTCompound::deepClone, (original, updated) -> {
|
||||
original.clear();
|
||||
updated.getKeys().forEach(s -> original.set(s, Objects.requireNonNull(updated.get(s))));
|
||||
}, null);
|
||||
|
||||
private final String key;
|
||||
private final Function<NBTCompound, T> readFunction;
|
||||
|
Loading…
Reference in New Issue
Block a user