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 CompoundTagfromBlockPos(BlockPos pos)static CompoundTagfromBlockState(BlockState state)static CompoundTagfromGameProfile(CompoundTag tag, com.mojang.authlib.GameProfile profile)static IntArrayTagfromUuid(UUID uuid)Serializes aUUIDinto its equivalent NBT representation.static booleanmatches(Tag standard, Tag subject, boolean equalValue)private static <T extends Comparable<T>>
StringnameValue(Property<T> property, Comparable<?> value)static BlockPostoBlockPos(CompoundTag tag)static BlockStatetoBlockState(CompoundTag tag)static com.mojang.authlib.GameProfiletoGameProfile(CompoundTag tag)static UUIDtoUuid(Tag tag)Deserializes a tag into aUUID.static CompoundTagupdate(com.mojang.datafixers.DataFixer fixer, DataFixTypes fixTypes, CompoundTag tag, int oldVersion)Uses the data fixer to update a tag to the latest data version.static CompoundTagupdate(com.mojang.datafixers.DataFixer fixer, DataFixTypes fixTypes, CompoundTag tag, int oldVersion, int targetVersion)Uses the data fixer to update a tag.private static <S extends State<?, S>, T extends Comparable<T>>
SwithProperty(S state, Property<T> property, String key, CompoundTag propertiesTag, CompoundTag mainTag)
-
Field Details
-
LOGGER
-
-
Constructor Details
-
NbtHelper
public NbtHelper()
-
-
Method Details
-
toGameProfile
-
fromGameProfile
-
matches
-
fromUuid
Serializes aUUIDinto its equivalent NBT representation.- Since:
- 20w10a
-
toUuid
Deserializes a tag into aUUID. The tag's data must have the same structure as the output offromUuid(java.util.UUID).- Throws:
IllegalArgumentException- iftagis 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, CompoundTag propertiesTag, CompoundTag mainTag) -
fromBlockState
-
nameValue
private static <T extends Comparable<T>> String nameValue(Property<T> property, Comparable<?> value) -
update
public static CompoundTag update(com.mojang.datafixers.DataFixer fixer, DataFixTypes fixTypes, CompoundTag tag, int oldVersion)Uses the data fixer to update a tag to the latest data version.- Parameters:
fixer- the data fixerfixTypes- the fix typestag- the tag to fixoldVersion- the data version of the compound tag
-
update
public static CompoundTag update(com.mojang.datafixers.DataFixer fixer, DataFixTypes fixTypes, CompoundTag tag, int oldVersion, int targetVersion)Uses the data fixer to update a tag.- Parameters:
fixer- the data fixerfixTypes- the fix typestag- the tag to fixoldVersion- the data version of the compound tagtargetVersion- the data version to update the tag to
-