Package net.minecraft.nbt
Class NbtHelper
java.lang.Object
net.minecraft.nbt.NbtHelper
- Mappings:
Namespace Name official owintermediary net/minecraft/class_2512named net/minecraft/nbt/NbtHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Comparator<NbtList>private static final charprivate static final Splitterprivate static final Stringprivate static final Splitterstatic final Stringprivate static final Comparator<NbtList>private static final intprivate static final intprivate static final charprivate static final org.slf4j.Loggerprivate static final char -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilderappendFormattedString(StringBuilder stringBuilder, NbtElement nbt, int depth, boolean withArrayContents) private static StringBuilderappendIndent(int depth, StringBuilder stringBuilder) static NbtCompoundfromBlockPos(BlockPos pos) static NbtCompoundfromBlockState(BlockState state) static NbtCompoundfromFluidState(FluidState state) (package private) static NbtCompoundfromNbtProviderFormat(NbtCompound compound) (package private) static NbtCompoundstatic NbtCompoundfromNbtProviderString(String string) Returns thestringparsed as an NBT provider-formatted NBT compound.static NbtIntArraySerializes aUUIDinto its equivalent NBT representation.static booleanmatches(@Nullable NbtElement standard, @Nullable NbtElement subject, boolean equalValue) private static <T extends Comparable<T>>
StringnameValue(Property<T> property, Comparable<?> value) static BlockPostoBlockPos(NbtCompound compound) static BlockStatetoBlockState(NbtCompound compound) static StringReturns the human-readable, non-deserializable representation ofnbt.static StringtoFormattedString(NbtElement nbt, boolean withArrayContents) Returns the human-readable, non-deserializable representation ofnbt.static @Nullable com.mojang.authlib.GameProfiletoGameProfile(NbtCompound compound) (package private) static NbtCompoundtoNbtProviderFormat(NbtCompound compound) (package private) static StringtoNbtProviderFormattedPalette(NbtCompound compound) static StringtoNbtProviderString(NbtCompound compound) Returns the string representation ofcompoundas used by the NBT provider in the data generator.static TexttoPrettyPrintedText(NbtElement element) static UUIDtoUuid(NbtElement element) Deserializes an NBT element into aUUID.static NbtCompoundupdate(com.mojang.datafixers.DataFixer fixer, DataFixTypes fixTypes, NbtCompound compound, int oldVersion) Uses the data fixer to update an NBT compound object to the latest data version.static NbtCompoundupdate(com.mojang.datafixers.DataFixer fixer, DataFixTypes fixTypes, NbtCompound compound, int oldVersion, int targetVersion) Uses the data fixer to update an NBT compound object.private static <S extends State<?,S>, T extends Comparable<T>>
SwithProperty(S state, Property<T> property, String key, NbtCompound properties, NbtCompound root) static NbtCompoundwriteGameProfile(NbtCompound compound, com.mojang.authlib.GameProfile profile)
-
Field Details
-
BLOCK_POS_COMPARATOR
- Mappings:
Namespace Name Mixin selector official bLow;b:Ljava/util/Comparator;intermediary field_27816Lnet/minecraft/class_2512;field_27816:Ljava/util/Comparator;named BLOCK_POS_COMPARATORLnet/minecraft/nbt/NbtHelper;BLOCK_POS_COMPARATOR:Ljava/util/Comparator;
-
ENTITY_POS_COMPARATOR
- Mappings:
Namespace Name Mixin selector official cLow;c:Ljava/util/Comparator;intermediary field_27817Lnet/minecraft/class_2512;field_27817:Ljava/util/Comparator;named ENTITY_POS_COMPARATORLnet/minecraft/nbt/NbtHelper;ENTITY_POS_COMPARATOR:Ljava/util/Comparator;
-
DATA_KEY
- See Also:
- Mappings:
Namespace Name Mixin selector official aLow;a:Ljava/lang/String;intermediary field_33224Lnet/minecraft/class_2512;field_33224:Ljava/lang/String;named DATA_KEYLnet/minecraft/nbt/NbtHelper;DATA_KEY:Ljava/lang/String;
-
LEFT_CURLY_BRACKET
private static final char LEFT_CURLY_BRACKET- See Also:
- Mappings:
Namespace Name Mixin selector official dLow;d:Cintermediary field_33225Lnet/minecraft/class_2512;field_33225:Cnamed LEFT_CURLY_BRACKETLnet/minecraft/nbt/NbtHelper;LEFT_CURLY_BRACKET:C
-
RIGHT_CURLY_BRACKET
private static final char RIGHT_CURLY_BRACKET- See Also:
- Mappings:
Namespace Name Mixin selector official eLow;e:Cintermediary field_33226Lnet/minecraft/class_2512;field_33226:Cnamed RIGHT_CURLY_BRACKETLnet/minecraft/nbt/NbtHelper;RIGHT_CURLY_BRACKET:C
-
COMMA
- See Also:
- Mappings:
Namespace Name Mixin selector official fLow;f:Ljava/lang/String;intermediary field_33227Lnet/minecraft/class_2512;field_33227:Ljava/lang/String;named COMMALnet/minecraft/nbt/NbtHelper;COMMA:Ljava/lang/String;
-
COLON
private static final char COLON- See Also:
- Mappings:
Namespace Name Mixin selector official gLow;g:Cintermediary field_33228Lnet/minecraft/class_2512;field_33228:Cnamed COLONLnet/minecraft/nbt/NbtHelper;COLON:C
-
COMMA_SPLITTER
- Mappings:
Namespace Name Mixin selector official hLow;h:Lcom/google/common/base/Splitter;intermediary field_27818Lnet/minecraft/class_2512;field_27818:Lcom/google/common/base/Splitter;named COMMA_SPLITTERLnet/minecraft/nbt/NbtHelper;COMMA_SPLITTER:Lcom/google/common/base/Splitter;
-
COLON_SPLITTER
- Mappings:
Namespace Name Mixin selector official iLow;i:Lcom/google/common/base/Splitter;intermediary field_27819Lnet/minecraft/class_2512;field_27819:Lcom/google/common/base/Splitter;named COLON_SPLITTERLnet/minecraft/nbt/NbtHelper;COLON_SPLITTER:Lcom/google/common/base/Splitter;
-
LOGGER
private static final org.slf4j.Logger LOGGER- Mappings:
Namespace Name Mixin selector official jLow;j:Lorg/slf4j/Logger;intermediary field_11582Lnet/minecraft/class_2512;field_11582:Lorg/slf4j/Logger;named LOGGERLnet/minecraft/nbt/NbtHelper;LOGGER:Lorg/slf4j/Logger;
-
field_33229
private static final int field_33229- See Also:
- Mappings:
Namespace Name Mixin selector official kLow;k:Iintermediary field_33229Lnet/minecraft/class_2512;field_33229:Inamed field_33229Lnet/minecraft/nbt/NbtHelper;field_33229:I
-
field_33230
private static final int field_33230- See Also:
- Mappings:
Namespace Name Mixin selector official lLow;l:Iintermediary field_33230Lnet/minecraft/class_2512;field_33230:Inamed field_33230Lnet/minecraft/nbt/NbtHelper;field_33230:I
-
-
Constructor Details
-
NbtHelper
private NbtHelper()
-
-
Method Details
-
toGameProfile
@Nullable public static @Nullable com.mojang.authlib.GameProfile toGameProfile(NbtCompound compound) - Mappings:
Namespace Name Mixin selector official aLow;a(Lok;)Lcom/mojang/authlib/GameProfile;intermediary method_10683Lnet/minecraft/class_2512;method_10683(Lnet/minecraft/class_2487;)Lcom/mojang/authlib/GameProfile;named toGameProfileLnet/minecraft/nbt/NbtHelper;toGameProfile(Lnet/minecraft/nbt/NbtCompound;)Lcom/mojang/authlib/GameProfile;
-
writeGameProfile
public static NbtCompound writeGameProfile(NbtCompound compound, com.mojang.authlib.GameProfile profile) - Mappings:
Namespace Name Mixin selector official aLow;a(Lok;Lcom/mojang/authlib/GameProfile;)Lok;intermediary method_10684Lnet/minecraft/class_2512;method_10684(Lnet/minecraft/class_2487;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/class_2487;named writeGameProfileLnet/minecraft/nbt/NbtHelper;writeGameProfile(Lnet/minecraft/nbt/NbtCompound;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/nbt/NbtCompound;
-
matches
public static boolean matches(@Nullable @Nullable NbtElement standard, @Nullable @Nullable NbtElement subject, boolean equalValue) - Mappings:
Namespace Name Mixin selector official aLow;a(Lpd;Lpd;Z)Zintermediary method_10687Lnet/minecraft/class_2512;method_10687(Lnet/minecraft/class_2520;Lnet/minecraft/class_2520;Z)Znamed matchesLnet/minecraft/nbt/NbtHelper;matches(Lnet/minecraft/nbt/NbtElement;Lnet/minecraft/nbt/NbtElement;Z)Z
-
fromUuid
Serializes aUUIDinto its equivalent NBT representation.- Since:
- 20w10a
- Mappings:
Namespace Name Mixin selector official aLow;a(Ljava/util/UUID;)Loo;intermediary method_25929Lnet/minecraft/class_2512;method_25929(Ljava/util/UUID;)Lnet/minecraft/class_2495;named fromUuidLnet/minecraft/nbt/NbtHelper;fromUuid(Ljava/util/UUID;)Lnet/minecraft/nbt/NbtIntArray;
-
toUuid
Deserializes an NBT element into aUUID. The NBT element's data must have the same structure as the output offromUuid(java.util.UUID).- Throws:
IllegalArgumentException- ifelementis not a valid representation of a UUID- Since:
- 20w10a
- Mappings:
Namespace Name Mixin selector official aLow;a(Lpd;)Ljava/util/UUID;intermediary method_25930Lnet/minecraft/class_2512;method_25930(Lnet/minecraft/class_2520;)Ljava/util/UUID;named toUuidLnet/minecraft/nbt/NbtHelper;toUuid(Lnet/minecraft/nbt/NbtElement;)Ljava/util/UUID;
-
toBlockPos
- Mappings:
Namespace Name Mixin selector official bLow;b(Lok;)Lgj;intermediary method_10691Lnet/minecraft/class_2512;method_10691(Lnet/minecraft/class_2487;)Lnet/minecraft/class_2338;named toBlockPosLnet/minecraft/nbt/NbtHelper;toBlockPos(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/util/math/BlockPos;
-
fromBlockPos
- Mappings:
Namespace Name Mixin selector official aLow;a(Lgj;)Lok;intermediary method_10692Lnet/minecraft/class_2512;method_10692(Lnet/minecraft/class_2338;)Lnet/minecraft/class_2487;named fromBlockPosLnet/minecraft/nbt/NbtHelper;fromBlockPos(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/nbt/NbtCompound;
-
toBlockState
- Mappings:
Namespace Name Mixin selector official cLow;c(Lok;)Lcov;intermediary method_10681Lnet/minecraft/class_2512;method_10681(Lnet/minecraft/class_2487;)Lnet/minecraft/class_2680;named toBlockStateLnet/minecraft/nbt/NbtHelper;toBlockState(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/block/BlockState;
-
withProperty
private static <S extends State<?,S>, S withPropertyT extends Comparable<T>> (S state, Property<T> property, String key, NbtCompound properties, NbtCompound root) - Mappings:
Namespace Name Mixin selector official aLow;a(Lcox;Lcpy;Ljava/lang/String;Lok;Lok;)Lcox;intermediary method_10682Lnet/minecraft/class_2512;method_10682(Lnet/minecraft/class_2688;Lnet/minecraft/class_2769;Ljava/lang/String;Lnet/minecraft/class_2487;Lnet/minecraft/class_2487;)Lnet/minecraft/class_2688;named withPropertyLnet/minecraft/nbt/NbtHelper;withProperty(Lnet/minecraft/state/State;Lnet/minecraft/state/property/Property;Ljava/lang/String;Lnet/minecraft/nbt/NbtCompound;Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/state/State;
-
fromBlockState
- Mappings:
Namespace Name Mixin selector official aLow;a(Lcov;)Lok;intermediary method_10686Lnet/minecraft/class_2512;method_10686(Lnet/minecraft/class_2680;)Lnet/minecraft/class_2487;named fromBlockStateLnet/minecraft/nbt/NbtHelper;fromBlockState(Lnet/minecraft/block/BlockState;)Lnet/minecraft/nbt/NbtCompound;
-
fromFluidState
- Mappings:
Namespace Name Mixin selector official aLow;a(Ldix;)Lok;intermediary method_36115Lnet/minecraft/class_2512;method_36115(Lnet/minecraft/class_3610;)Lnet/minecraft/class_2487;named fromFluidStateLnet/minecraft/nbt/NbtHelper;fromFluidState(Lnet/minecraft/fluid/FluidState;)Lnet/minecraft/nbt/NbtCompound;
-
nameValue
private static <T extends Comparable<T>> String nameValue(Property<T> property, Comparable<?> value) - Mappings:
Namespace Name Mixin selector official aLow;a(Lcpy;Ljava/lang/Comparable;)Ljava/lang/String;intermediary method_10685Lnet/minecraft/class_2512;method_10685(Lnet/minecraft/class_2769;Ljava/lang/Comparable;)Ljava/lang/String;named nameValueLnet/minecraft/nbt/NbtHelper;nameValue(Lnet/minecraft/state/property/Property;Ljava/lang/Comparable;)Ljava/lang/String;
-
toFormattedString
Returns the human-readable, non-deserializable representation ofnbt.This does not include contents of
NbtByteArray,NbtIntArray, andNbtLongArray. To include them, calltoFormattedString(NbtElement, boolean)withwithArrayContentsparameter set to true.- Returns:
- the human-readable, non-deserializable representation of
nbt - See Also:
- Mappings:
Namespace Name Mixin selector official bLow;b(Lpd;)Ljava/lang/String;intermediary method_36118Lnet/minecraft/class_2512;method_36118(Lnet/minecraft/class_2520;)Ljava/lang/String;named toFormattedStringLnet/minecraft/nbt/NbtHelper;toFormattedString(Lnet/minecraft/nbt/NbtElement;)Ljava/lang/String;
-
toFormattedString
Returns the human-readable, non-deserializable representation ofnbt.- Parameters:
withArrayContents- whether to include contents ofNbtByteArray,NbtIntArray, andNbtLongArray- Returns:
- the human-readable, non-deserializable representation of
nbt - Mappings:
Namespace Name Mixin selector official aLow;a(Lpd;Z)Ljava/lang/String;intermediary method_36117Lnet/minecraft/class_2512;method_36117(Lnet/minecraft/class_2520;Z)Ljava/lang/String;named toFormattedStringLnet/minecraft/nbt/NbtHelper;toFormattedString(Lnet/minecraft/nbt/NbtElement;Z)Ljava/lang/String;
-
appendFormattedString
public static StringBuilder appendFormattedString(StringBuilder stringBuilder, NbtElement nbt, int depth, boolean withArrayContents) - Mappings:
Namespace Name Mixin selector official aLow;a(Ljava/lang/StringBuilder;Lpd;IZ)Ljava/lang/StringBuilder;intermediary method_36116Lnet/minecraft/class_2512;method_36116(Ljava/lang/StringBuilder;Lnet/minecraft/class_2520;IZ)Ljava/lang/StringBuilder;named appendFormattedStringLnet/minecraft/nbt/NbtHelper;appendFormattedString(Ljava/lang/StringBuilder;Lnet/minecraft/nbt/NbtElement;IZ)Ljava/lang/StringBuilder;
-
appendIndent
- Mappings:
Namespace Name Mixin selector official aLow;a(ILjava/lang/StringBuilder;)Ljava/lang/StringBuilder;intermediary method_36114Lnet/minecraft/class_2512;method_36114(ILjava/lang/StringBuilder;)Ljava/lang/StringBuilder;named appendIndentLnet/minecraft/nbt/NbtHelper;appendIndent(ILjava/lang/StringBuilder;)Ljava/lang/StringBuilder;
-
update
public static NbtCompound update(com.mojang.datafixers.DataFixer fixer, DataFixTypes fixTypes, NbtCompound compound, int oldVersion) Uses the data fixer to update an NBT compound object to the latest data version.- Parameters:
fixer- the data fixerfixTypes- the fix typescompound- the NBT compound object to fixoldVersion- the data version of the NBT compound object- Mappings:
Namespace Name Mixin selector official aLow;a(Lcom/mojang/datafixers/DataFixer;Lakd;Lok;I)Lok;intermediary method_10688Lnet/minecraft/class_2512;method_10688(Lcom/mojang/datafixers/DataFixer;Lnet/minecraft/class_4284;Lnet/minecraft/class_2487;I)Lnet/minecraft/class_2487;named updateLnet/minecraft/nbt/NbtHelper;update(Lcom/mojang/datafixers/DataFixer;Lnet/minecraft/datafixer/DataFixTypes;Lnet/minecraft/nbt/NbtCompound;I)Lnet/minecraft/nbt/NbtCompound;
-
update
public static NbtCompound update(com.mojang.datafixers.DataFixer fixer, DataFixTypes fixTypes, NbtCompound compound, int oldVersion, int targetVersion) Uses the data fixer to update an NBT compound object.- Parameters:
fixer- the data fixerfixTypes- the fix typescompound- the NBT compound object to fixoldVersion- the data version of the NBT compound objecttargetVersion- the data version to update the NBT compound object to- Mappings:
Namespace Name Mixin selector official aLow;a(Lcom/mojang/datafixers/DataFixer;Lakd;Lok;II)Lok;intermediary method_10693Lnet/minecraft/class_2512;method_10693(Lcom/mojang/datafixers/DataFixer;Lnet/minecraft/class_4284;Lnet/minecraft/class_2487;II)Lnet/minecraft/class_2487;named updateLnet/minecraft/nbt/NbtHelper;update(Lcom/mojang/datafixers/DataFixer;Lnet/minecraft/datafixer/DataFixTypes;Lnet/minecraft/nbt/NbtCompound;II)Lnet/minecraft/nbt/NbtCompound;
-
toPrettyPrintedText
- Mappings:
Namespace Name Mixin selector official cLow;c(Lpd;)Lqk;intermediary method_32270Lnet/minecraft/class_2512;method_32270(Lnet/minecraft/class_2520;)Lnet/minecraft/class_2561;named toPrettyPrintedTextLnet/minecraft/nbt/NbtHelper;toPrettyPrintedText(Lnet/minecraft/nbt/NbtElement;)Lnet/minecraft/text/Text;
-
toNbtProviderString
Returns the string representation ofcompoundas used by the NBT provider in the data generator.The passed
compoundwill be sorted and modified in-place to make it more human-readable e.g. by convertingNbtCompoundin thepalettesNbtListto its short string representation. Therefore the returned value is not an accurate representation of the original NBT.- Returns:
- the string representation of
compoundas used by the NBT provider in the data generator - See Also:
- Mappings:
Namespace Name Mixin selector official dLow;d(Lok;)Ljava/lang/String;intermediary method_32271Lnet/minecraft/class_2512;method_32271(Lnet/minecraft/class_2487;)Ljava/lang/String;named toNbtProviderStringLnet/minecraft/nbt/NbtHelper;toNbtProviderString(Lnet/minecraft/nbt/NbtCompound;)Ljava/lang/String;
-
fromNbtProviderString
public static NbtCompound fromNbtProviderString(String string) throws com.mojang.brigadier.exceptions.CommandSyntaxException Returns thestringparsed as an NBT provider-formatted NBT compound.This method first parses the string as an NBT, then performs several conversions from human-readable
NbtCompounditems to the actual values used in-game.- Returns:
- the
stringparsed as an NBT provider-formatted NBT compound - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException- See Also:
- Mappings:
Namespace Name Mixin selector official aLow;a(Ljava/lang/String;)Lok;intermediary method_32260Lnet/minecraft/class_2512;method_32260(Ljava/lang/String;)Lnet/minecraft/class_2487;named fromNbtProviderStringLnet/minecraft/nbt/NbtHelper;fromNbtProviderString(Ljava/lang/String;)Lnet/minecraft/nbt/NbtCompound;
-
toNbtProviderFormat
- Mappings:
Namespace Name Mixin selector official eLow;e(Lok;)Lok;intermediary method_32273Lnet/minecraft/class_2512;method_32273(Lnet/minecraft/class_2487;)Lnet/minecraft/class_2487;named toNbtProviderFormatLnet/minecraft/nbt/NbtHelper;toNbtProviderFormat(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/nbt/NbtCompound;
-
fromNbtProviderFormat
- Mappings:
Namespace Name Mixin selector official fLow;f(Lok;)Lok;intermediary method_32275Lnet/minecraft/class_2512;method_32275(Lnet/minecraft/class_2487;)Lnet/minecraft/class_2487;named fromNbtProviderFormatLnet/minecraft/nbt/NbtHelper;fromNbtProviderFormat(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/nbt/NbtCompound;
-
toNbtProviderFormattedPalette
- Mappings:
Namespace Name Mixin selector official gLow;g(Lok;)Ljava/lang/String;intermediary method_32277Lnet/minecraft/class_2512;method_32277(Lnet/minecraft/class_2487;)Ljava/lang/String;named toNbtProviderFormattedPaletteLnet/minecraft/nbt/NbtHelper;toNbtProviderFormattedPalette(Lnet/minecraft/nbt/NbtCompound;)Ljava/lang/String;
-
fromNbtProviderFormattedPalette
- Mappings:
Namespace Name Mixin selector official bLow;b(Ljava/lang/String;)Lok;intermediary method_32267Lnet/minecraft/class_2512;method_32267(Ljava/lang/String;)Lnet/minecraft/class_2487;named fromNbtProviderFormattedPaletteLnet/minecraft/nbt/NbtHelper;fromNbtProviderFormattedPalette(Ljava/lang/String;)Lnet/minecraft/nbt/NbtCompound;
-