Package net.minecraft.nbt
Class NbtHelper
java.lang.Object
net.minecraft.nbt.NbtHelper
public final class NbtHelper extends Object
-
Field Summary
-
Constructor Summary
Constructors Constructor Description NbtHelper() -
Method Summary
Modifier and Type Method Description static NbtCompoundfromBlockPos(BlockPos pos)static NbtCompoundfromBlockState(BlockState state)static NbtIntArrayfromUuid(UUID uuid)Serializes aUUIDinto its equivalent NBT representation.static booleanmatches(NbtElement standard, 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 com.mojang.authlib.GameProfiletoGameProfile(NbtCompound compound)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
-
LOGGER
-
-
Constructor Details
-
NbtHelper
public NbtHelper()
-
-
Method Details
-
toGameProfile
-
writeGameProfile
public static NbtCompound writeGameProfile(NbtCompound compound, com.mojang.authlib.GameProfile profile) -
matches
public static boolean matches(@Nullable NbtElement standard, @Nullable NbtElement subject, boolean equalValue) -
fromUuid
Serializes aUUIDinto its equivalent NBT representation.- Since:
- 20w10a
-
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
-
toBlockPos
-
fromBlockPos
-
toBlockState
-
withProperty
private static <S extends State<?, S>, T extends Comparable<T>> S withProperty(S state, Property<T> property, String key, NbtCompound properties, NbtCompound root) -
fromBlockState
-
nameValue
private static <T extends Comparable<T>> String nameValue(Property<T> property, Comparable<?> value) -
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
-
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
-