Class NbtHelper

java.lang.Object
net.minecraft.nbt.NbtHelper

public final class NbtHelper
extends Object
  • Field Details

    • LOGGER

      private static final Logger LOGGER
  • Constructor Details

    • NbtHelper

      public NbtHelper()
  • Method Details

    • toGameProfile

      @Nullable public static com.mojang.authlib.GameProfile toGameProfile​(NbtCompound compound)
    • 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

      public static NbtIntArray fromUuid​(UUID uuid)
      Serializes a UUID into its equivalent NBT representation.
      Since:
      20w10a
    • toUuid

      public static UUID toUuid​(NbtElement element)
      Deserializes an NBT element into a UUID. The NBT element's data must have the same structure as the output of fromUuid(java.util.UUID).
      Throws:
      IllegalArgumentException - if element is not a valid representation of a UUID
      Since:
      20w10a
    • toBlockPos

      public static BlockPos toBlockPos​(NbtCompound compound)
    • fromBlockPos

      public static NbtCompound fromBlockPos​(BlockPos pos)
    • toBlockState

      public static BlockState toBlockState​(NbtCompound compound)
    • 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

      public static NbtCompound fromBlockState​(BlockState state)
    • 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 fixer
      fixTypes - the fix types
      compound - the NBT compound object to fix
      oldVersion - 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 fixer
      fixTypes - the fix types
      compound - the NBT compound object to fix
      oldVersion - the data version of the NBT compound object
      targetVersion - the data version to update the NBT compound object to