Package net.minecraft.nbt
Class NbtOps
java.lang.Object
net.minecraft.nbt.NbtOps
- All Implemented Interfaces:
com.mojang.serialization.DynamicOps<NbtElement>
Used to handle Minecraft NBTs within
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.
- See Also:
- Mappings:
Namespace Name official rp
intermediary net/minecraft/class_2509
named net/minecraft/nbt/NbtOps
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
private static class
private static class
private static class
private static class
private static class
private class
private static interface
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<U> U
convertTo
(com.mojang.serialization.DynamicOps<U> dynamicOps, NbtElement nbtElement) createBoolean
(boolean bool) createByte
(byte byte2) createByteList
(ByteBuffer byteBuffer) createDouble
(double double2) createFloat
(float float2) createInt
(int int2) createIntList
(IntStream intStream) createList
(Stream<NbtElement> stream) createLong
(long long2) createLongList
(LongStream longStream) createMap
(Stream<com.mojang.datafixers.util.Pair<NbtElement, NbtElement>> stream) private static Optional<NbtOps.Merger>
createMerger
(NbtElement nbt) createNumeric
(Number number) createShort
(short short2) createString
(String string) empty()
com.mojang.serialization.DataResult<ByteBuffer>
getByteBuffer
(NbtElement nbtElement) com.mojang.serialization.DataResult<IntStream>
getIntStream
(NbtElement nbtElement) com.mojang.serialization.DataResult<Consumer<Consumer<NbtElement>>>
getList
(NbtElement nbtElement) com.mojang.serialization.DataResult<LongStream>
getLongStream
(NbtElement nbtElement) com.mojang.serialization.DataResult<com.mojang.serialization.MapLike<NbtElement>>
getMap
(NbtElement nbtElement) com.mojang.serialization.DataResult<Consumer<BiConsumer<NbtElement,
NbtElement>>> getMapEntries
(NbtElement nbtElement) com.mojang.serialization.DataResult<Stream<com.mojang.datafixers.util.Pair<NbtElement,
NbtElement>>> getMapValues
(NbtElement nbtElement) com.mojang.serialization.DataResult<Number>
getNumberValue
(NbtElement nbtElement) com.mojang.serialization.DataResult<Stream<NbtElement>>
getStream
(NbtElement nbtElement) com.mojang.serialization.DataResult<String>
getStringValue
(NbtElement nbtElement) com.mojang.serialization.RecordBuilder<NbtElement>
com.mojang.serialization.DataResult<NbtElement>
mergeToList
(NbtElement nbtElement, List<NbtElement> list) com.mojang.serialization.DataResult<NbtElement>
mergeToList
(NbtElement nbtElement, NbtElement nbtElement2) com.mojang.serialization.DataResult<NbtElement>
mergeToMap
(NbtElement nbtElement, com.mojang.serialization.MapLike<NbtElement> mapLike) com.mojang.serialization.DataResult<NbtElement>
mergeToMap
(NbtElement nbtElement, NbtElement nbtElement2, NbtElement nbtElement3) remove
(NbtElement nbtElement, String string) toString()
private static NbtElement
unpackMarker
(NbtCompound nbt) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mojang.serialization.DynamicOps
compressMaps, convertList, convertMap, createMap, emptyList, emptyMap, get, getBooleanValue, getGeneric, getNumberValue, listBuilder, mergeToMap, mergeToPrimitive, set, update, updateGeneric, withDecoder, withEncoder, withParser
-
Field Details
-
INSTANCE
An singleton of the NBT dynamic ops.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.
- Mappings:
Namespace Name Mixin selector official a
Lrp;a:Lrp;
intermediary field_11560
Lnet/minecraft/class_2509;field_11560:Lnet/minecraft/class_2509;
named INSTANCE
Lnet/minecraft/nbt/NbtOps;INSTANCE:Lnet/minecraft/nbt/NbtOps;
-
MARKER_KEY
- See Also:
- Mappings:
Namespace Name Mixin selector official b
Lrp;b:Ljava/lang/String;
intermediary field_40667
Lnet/minecraft/class_2509;field_40667:Ljava/lang/String;
named MARKER_KEY
Lnet/minecraft/nbt/NbtOps;MARKER_KEY:Ljava/lang/String;
-
-
Constructor Details
-
NbtOps
protected NbtOps()
-
-
Method Details
-
empty
- Specified by:
empty
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a()Lrx;
intermediary method_10668
Lnet/minecraft/class_2509;method_10668()Lnet/minecraft/class_2520;
named empty
Lnet/minecraft/nbt/NbtOps;empty()Lnet/minecraft/nbt/NbtElement;
-
convertTo
- Specified by:
convertTo
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Lcom/mojang/serialization/DynamicOps;Lrx;)Ljava/lang/Object;
intermediary method_29146
Lnet/minecraft/class_2509;method_29146(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/class_2520;)Ljava/lang/Object;
named convertTo
Lnet/minecraft/nbt/NbtOps;convertTo(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/nbt/NbtElement;)Ljava/lang/Object;
-
getNumberValue
- Specified by:
getNumberValue
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_10645
Lnet/minecraft/class_2509;method_10645(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getNumberValue
Lnet/minecraft/nbt/NbtOps;getNumberValue(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
createNumeric
- Specified by:
createNumeric
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Ljava/lang/Number;)Lrx;
intermediary method_10660
Lnet/minecraft/class_2509;method_10660(Ljava/lang/Number;)Lnet/minecraft/class_2520;
named createNumeric
Lnet/minecraft/nbt/NbtOps;createNumeric(Ljava/lang/Number;)Lnet/minecraft/nbt/NbtElement;
-
createByte
- Specified by:
createByte
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(B)Lrx;
intermediary method_10640
Lnet/minecraft/class_2509;method_10640(B)Lnet/minecraft/class_2520;
named createByte
Lnet/minecraft/nbt/NbtOps;createByte(B)Lnet/minecraft/nbt/NbtElement;
-
createShort
- Specified by:
createShort
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(S)Lrx;
intermediary method_10635
Lnet/minecraft/class_2509;method_10635(S)Lnet/minecraft/class_2520;
named createShort
Lnet/minecraft/nbt/NbtOps;createShort(S)Lnet/minecraft/nbt/NbtElement;
-
createInt
- Specified by:
createInt
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(I)Lrx;
intermediary method_10661
Lnet/minecraft/class_2509;method_10661(I)Lnet/minecraft/class_2520;
named createInt
Lnet/minecraft/nbt/NbtOps;createInt(I)Lnet/minecraft/nbt/NbtElement;
-
createLong
- Specified by:
createLong
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(J)Lrx;
intermediary method_10654
Lnet/minecraft/class_2509;method_10654(J)Lnet/minecraft/class_2520;
named createLong
Lnet/minecraft/nbt/NbtOps;createLong(J)Lnet/minecraft/nbt/NbtElement;
-
createFloat
- Specified by:
createFloat
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(F)Lrx;
intermediary method_10662
Lnet/minecraft/class_2509;method_10662(F)Lnet/minecraft/class_2520;
named createFloat
Lnet/minecraft/nbt/NbtOps;createFloat(F)Lnet/minecraft/nbt/NbtElement;
-
createDouble
- Specified by:
createDouble
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(D)Lrx;
intermediary method_10652
Lnet/minecraft/class_2509;method_10652(D)Lnet/minecraft/class_2520;
named createDouble
Lnet/minecraft/nbt/NbtOps;createDouble(D)Lnet/minecraft/nbt/NbtElement;
-
createBoolean
- Specified by:
createBoolean
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Z)Lrx;
intermediary method_23253
Lnet/minecraft/class_2509;method_23253(Z)Lnet/minecraft/class_2520;
named createBoolean
Lnet/minecraft/nbt/NbtOps;createBoolean(Z)Lnet/minecraft/nbt/NbtElement;
-
getStringValue
- Specified by:
getStringValue
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official b
Lrp;b(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_10656
Lnet/minecraft/class_2509;method_10656(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getStringValue
Lnet/minecraft/nbt/NbtOps;getStringValue(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
createString
- Specified by:
createString
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Ljava/lang/String;)Lrx;
intermediary method_10639
Lnet/minecraft/class_2509;method_10639(Ljava/lang/String;)Lnet/minecraft/class_2520;
named createString
Lnet/minecraft/nbt/NbtOps;createString(Ljava/lang/String;)Lnet/minecraft/nbt/NbtElement;
-
mergeToList
public com.mojang.serialization.DataResult<NbtElement> mergeToList(NbtElement nbtElement, NbtElement nbtElement2) - Specified by:
mergeToList
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Lrx;Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_29156
Lnet/minecraft/class_2509;method_29156(Lnet/minecraft/class_2520;Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named mergeToList
Lnet/minecraft/nbt/NbtOps;mergeToList(Lnet/minecraft/nbt/NbtElement;Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
mergeToList
public com.mojang.serialization.DataResult<NbtElement> mergeToList(NbtElement nbtElement, List<NbtElement> list) - Specified by:
mergeToList
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Lrx;Ljava/util/List;)Lcom/mojang/serialization/DataResult;
intermediary method_29155
Lnet/minecraft/class_2509;method_29155(Lnet/minecraft/class_2520;Ljava/util/List;)Lcom/mojang/serialization/DataResult;
named mergeToList
Lnet/minecraft/nbt/NbtOps;mergeToList(Lnet/minecraft/nbt/NbtElement;Ljava/util/List;)Lcom/mojang/serialization/DataResult;
-
mergeToMap
public com.mojang.serialization.DataResult<NbtElement> mergeToMap(NbtElement nbtElement, NbtElement nbtElement2, NbtElement nbtElement3) - Specified by:
mergeToMap
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Lrx;Lrx;Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_29157
Lnet/minecraft/class_2509;method_29157(Lnet/minecraft/class_2520;Lnet/minecraft/class_2520;Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named mergeToMap
Lnet/minecraft/nbt/NbtOps;mergeToMap(Lnet/minecraft/nbt/NbtElement;Lnet/minecraft/nbt/NbtElement;Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
mergeToMap
public com.mojang.serialization.DataResult<NbtElement> mergeToMap(NbtElement nbtElement, com.mojang.serialization.MapLike<NbtElement> mapLike) - Specified by:
mergeToMap
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Lrx;Lcom/mojang/serialization/MapLike;)Lcom/mojang/serialization/DataResult;
intermediary method_29154
Lnet/minecraft/class_2509;method_29154(Lnet/minecraft/class_2520;Lcom/mojang/serialization/MapLike;)Lcom/mojang/serialization/DataResult;
named mergeToMap
Lnet/minecraft/nbt/NbtOps;mergeToMap(Lnet/minecraft/nbt/NbtElement;Lcom/mojang/serialization/MapLike;)Lcom/mojang/serialization/DataResult;
-
getMapValues
public com.mojang.serialization.DataResult<Stream<com.mojang.datafixers.util.Pair<NbtElement,NbtElement>>> getMapValues(NbtElement nbtElement) - Specified by:
getMapValues
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official c
Lrp;c(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_10669
Lnet/minecraft/class_2509;method_10669(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getMapValues
Lnet/minecraft/nbt/NbtOps;getMapValues(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
getMapEntries
public com.mojang.serialization.DataResult<Consumer<BiConsumer<NbtElement,NbtElement>>> getMapEntries(NbtElement nbtElement) - Specified by:
getMapEntries
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official d
Lrp;d(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_29162
Lnet/minecraft/class_2509;method_29162(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getMapEntries
Lnet/minecraft/nbt/NbtOps;getMapEntries(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
getMap
public com.mojang.serialization.DataResult<com.mojang.serialization.MapLike<NbtElement>> getMap(NbtElement nbtElement) - Specified by:
getMap
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official e
Lrp;e(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_29163
Lnet/minecraft/class_2509;method_29163(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getMap
Lnet/minecraft/nbt/NbtOps;getMap(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
createMap
- Specified by:
createMap
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Ljava/util/stream/Stream;)Lrx;
intermediary method_10655
Lnet/minecraft/class_2509;method_10655(Ljava/util/stream/Stream;)Lnet/minecraft/class_2520;
named createMap
Lnet/minecraft/nbt/NbtOps;createMap(Ljava/util/stream/Stream;)Lnet/minecraft/nbt/NbtElement;
-
unpackMarker
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Lre;)Lrx;
intermediary method_46232
Lnet/minecraft/class_2509;method_46232(Lnet/minecraft/class_2487;)Lnet/minecraft/class_2520;
named unpackMarker
Lnet/minecraft/nbt/NbtOps;unpackMarker(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/nbt/NbtElement;
-
getStream
- Specified by:
getStream
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official f
Lrp;f(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_10664
Lnet/minecraft/class_2509;method_10664(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getStream
Lnet/minecraft/nbt/NbtOps;getStream(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
getList
public com.mojang.serialization.DataResult<Consumer<Consumer<NbtElement>>> getList(NbtElement nbtElement) - Specified by:
getList
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official g
Lrp;g(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_29164
Lnet/minecraft/class_2509;method_29164(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getList
Lnet/minecraft/nbt/NbtOps;getList(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
getByteBuffer
- Specified by:
getByteBuffer
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official h
Lrp;h(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_10646
Lnet/minecraft/class_2509;method_10646(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getByteBuffer
Lnet/minecraft/nbt/NbtOps;getByteBuffer(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
createByteList
- Specified by:
createByteList
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Ljava/nio/ByteBuffer;)Lrx;
intermediary method_10657
Lnet/minecraft/class_2509;method_10657(Ljava/nio/ByteBuffer;)Lnet/minecraft/class_2520;
named createByteList
Lnet/minecraft/nbt/NbtOps;createByteList(Ljava/nio/ByteBuffer;)Lnet/minecraft/nbt/NbtElement;
-
getIntStream
- Specified by:
getIntStream
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official i
Lrp;i(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_10651
Lnet/minecraft/class_2509;method_10651(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getIntStream
Lnet/minecraft/nbt/NbtOps;getIntStream(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
createIntList
- Specified by:
createIntList
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Ljava/util/stream/IntStream;)Lrx;
intermediary method_10663
Lnet/minecraft/class_2509;method_10663(Ljava/util/stream/IntStream;)Lnet/minecraft/class_2520;
named createIntList
Lnet/minecraft/nbt/NbtOps;createIntList(Ljava/util/stream/IntStream;)Lnet/minecraft/nbt/NbtElement;
-
getLongStream
- Specified by:
getLongStream
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official j
Lrp;j(Lrx;)Lcom/mojang/serialization/DataResult;
intermediary method_10637
Lnet/minecraft/class_2509;method_10637(Lnet/minecraft/class_2520;)Lcom/mojang/serialization/DataResult;
named getLongStream
Lnet/minecraft/nbt/NbtOps;getLongStream(Lnet/minecraft/nbt/NbtElement;)Lcom/mojang/serialization/DataResult;
-
createLongList
- Specified by:
createLongList
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Ljava/util/stream/LongStream;)Lrx;
intermediary method_10643
Lnet/minecraft/class_2509;method_10643(Ljava/util/stream/LongStream;)Lnet/minecraft/class_2520;
named createLongList
Lnet/minecraft/nbt/NbtOps;createLongList(Ljava/util/stream/LongStream;)Lnet/minecraft/nbt/NbtElement;
-
createList
- Specified by:
createList
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official b
Lrp;b(Ljava/util/stream/Stream;)Lrx;
intermediary method_10665
Lnet/minecraft/class_2509;method_10665(Ljava/util/stream/Stream;)Lnet/minecraft/class_2520;
named createList
Lnet/minecraft/nbt/NbtOps;createList(Ljava/util/stream/Stream;)Lnet/minecraft/nbt/NbtElement;
-
remove
- Specified by:
remove
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
- Mappings:
Namespace Name Mixin selector official a
Lrp;a(Lrx;Ljava/lang/String;)Lrx;
intermediary method_10648
Lnet/minecraft/class_2509;method_10648(Lnet/minecraft/class_2520;Ljava/lang/String;)Lnet/minecraft/class_2520;
named remove
Lnet/minecraft/nbt/NbtOps;remove(Lnet/minecraft/nbt/NbtElement;Ljava/lang/String;)Lnet/minecraft/nbt/NbtElement;
-
toString
-
mapBuilder
- Specified by:
mapBuilder
in interfacecom.mojang.serialization.DynamicOps<NbtElement>
-
createMerger
- Mappings:
Namespace Name Mixin selector official k
Lrp;k(Lrx;)Ljava/util/Optional;
intermediary method_46235
Lnet/minecraft/class_2509;method_46235(Lnet/minecraft/class_2520;)Ljava/util/Optional;
named createMerger
Lnet/minecraft/nbt/NbtOps;createMerger(Lnet/minecraft/nbt/NbtElement;)Ljava/util/Optional;
-