public class NbtOps extends Object implements com.mojang.serialization.DynamicOps<Tag>
dynamics
for DataFixerUpper, allowing generalized serialization logic
shared across different type of data structures. Use INSTANCE
for the ops singleton.
For instance, dimension data may be stored as JSON in data packs, but they will be transported in packets as NBT. DataFixerUpper allows generalizing the dimension serialization logic to prevent duplicate code, where the NBT ops allow the DataFixerUpper dimension serialization logic to interact with Minecraft NBTs.
INSTANCE
Modifier and Type | Class and Description |
---|---|
(package private) class |
NbtOps.MapBuilder |
Modifier and Type | Field and Description |
---|---|
static NbtOps |
INSTANCE
An singleton of the NBT dynamic ops.
|
Modifier | Constructor and Description |
---|---|
protected |
NbtOps() |
Modifier and Type | Method and Description |
---|---|
<U> U |
convertTo(com.mojang.serialization.DynamicOps<U> dynamicOps,
Tag tag) |
Tag |
createBoolean(boolean bool) |
Tag |
createByte(byte byte2) |
Tag |
createByteList(ByteBuffer byteBuffer) |
Tag |
createDouble(double double2) |
Tag |
createFloat(float float2) |
Tag |
createInt(int int2) |
Tag |
createIntList(IntStream intStream) |
Tag |
createList(Stream<Tag> stream) |
Tag |
createLong(long long2) |
Tag |
createLongList(LongStream longStream) |
Tag |
createMap(Stream<com.mojang.datafixers.util.Pair<Tag,Tag>> stream) |
Tag |
createNumeric(Number number) |
Tag |
createShort(short short2) |
Tag |
createString(String string) |
Tag |
empty() |
com.mojang.serialization.DataResult<ByteBuffer> |
getByteBuffer(Tag tag) |
com.mojang.serialization.DataResult<IntStream> |
getIntStream(Tag tag) |
com.mojang.serialization.DataResult<Consumer<Consumer<Tag>>> |
getList(Tag tag) |
com.mojang.serialization.DataResult<LongStream> |
getLongStream(Tag tag) |
com.mojang.serialization.DataResult<com.mojang.serialization.MapLike<Tag>> |
getMap(Tag tag) |
com.mojang.serialization.DataResult<Consumer<BiConsumer<Tag,Tag>>> |
getMapEntries(Tag tag) |
com.mojang.serialization.DataResult<Stream<com.mojang.datafixers.util.Pair<Tag,Tag>>> |
getMapValues(Tag tag) |
com.mojang.serialization.DataResult<Number> |
getNumberValue(Tag tag) |
com.mojang.serialization.DataResult<Stream<Tag>> |
getStream(Tag tag) |
com.mojang.serialization.DataResult<String> |
getStringValue(Tag tag) |
com.mojang.serialization.RecordBuilder<Tag> |
mapBuilder() |
com.mojang.serialization.DataResult<Tag> |
mergeToList(Tag tag,
List<Tag> list) |
com.mojang.serialization.DataResult<Tag> |
mergeToList(Tag tag,
Tag tag2) |
com.mojang.serialization.DataResult<Tag> |
mergeToMap(Tag tag,
com.mojang.serialization.MapLike<Tag> mapLike) |
com.mojang.serialization.DataResult<Tag> |
mergeToMap(Tag tag,
Tag tag2,
Tag tag3) |
private static AbstractListTag<?> |
method_29144(byte byte2,
byte byte3) |
private static boolean |
method_29145(byte byte2,
byte byte3,
byte byte4) |
private static <T extends Tag> |
method_29150(AbstractListTag<T> abstractListTag,
Tag tag,
List<Tag> list) |
private static <T extends Tag> |
method_29151(AbstractListTag<T> abstractListTag,
Tag tag,
Tag tag2) |
Tag |
remove(Tag tag,
String string) |
String |
toString() |
public static final NbtOps INSTANCE
This ops does not compress maps (replace field name to value pairs with an ordered list of values in serialization). In fact, since Minecraft NBT lists can only contain elements of the same type, this op cannot compress maps.
public <U> U convertTo(com.mojang.serialization.DynamicOps<U> dynamicOps, Tag tag)
convertTo
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<Number> getNumberValue(Tag tag)
getNumberValue
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createNumeric(Number number)
createNumeric
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createByte(byte byte2)
createByte
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createShort(short short2)
createShort
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createInt(int int2)
createInt
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createLong(long long2)
createLong
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createFloat(float float2)
createFloat
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createDouble(double double2)
createDouble
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createBoolean(boolean bool)
createBoolean
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<String> getStringValue(Tag tag)
getStringValue
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createString(String string)
createString
in interface com.mojang.serialization.DynamicOps<Tag>
private static AbstractListTag<?> method_29144(byte byte2, byte byte3)
private static boolean method_29145(byte byte2, byte byte3, byte byte4)
private static <T extends Tag> void method_29151(AbstractListTag<T> abstractListTag, Tag tag, Tag tag2)
private static <T extends Tag> void method_29150(AbstractListTag<T> abstractListTag, Tag tag, List<Tag> list)
public com.mojang.serialization.DataResult<Tag> mergeToList(Tag tag, Tag tag2)
mergeToList
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<Tag> mergeToList(Tag tag, List<Tag> list)
mergeToList
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<Tag> mergeToMap(Tag tag, Tag tag2, Tag tag3)
mergeToMap
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<Tag> mergeToMap(Tag tag, com.mojang.serialization.MapLike<Tag> mapLike)
mergeToMap
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<Stream<com.mojang.datafixers.util.Pair<Tag,Tag>>> getMapValues(Tag tag)
getMapValues
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<Consumer<BiConsumer<Tag,Tag>>> getMapEntries(Tag tag)
getMapEntries
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<com.mojang.serialization.MapLike<Tag>> getMap(Tag tag)
getMap
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createMap(Stream<com.mojang.datafixers.util.Pair<Tag,Tag>> stream)
createMap
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<Stream<Tag>> getStream(Tag tag)
getStream
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<Consumer<Consumer<Tag>>> getList(Tag tag)
getList
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<ByteBuffer> getByteBuffer(Tag tag)
getByteBuffer
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createByteList(ByteBuffer byteBuffer)
createByteList
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<IntStream> getIntStream(Tag tag)
getIntStream
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createIntList(IntStream intStream)
createIntList
in interface com.mojang.serialization.DynamicOps<Tag>
public com.mojang.serialization.DataResult<LongStream> getLongStream(Tag tag)
getLongStream
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createLongList(LongStream longStream)
createLongList
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag createList(Stream<Tag> stream)
createList
in interface com.mojang.serialization.DynamicOps<Tag>
public Tag remove(Tag tag, String string)
remove
in interface com.mojang.serialization.DynamicOps<Tag>