mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 17:37:42 +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.
|
* Reads the complete tag holder compound.
|
||||||
* <p>
|
* <p>
|
||||||
* Writing is not supported.
|
* Writing will override all tags. Proceed with caution.
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Experimental
|
@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 String key;
|
||||||
private final Function<NBTCompound, T> readFunction;
|
private final Function<NBTCompound, T> readFunction;
|
||||||
|
Loading…
Reference in New Issue
Block a user