Class NbtX

java.lang.Object
org.moddingx.libx.util.data.NbtX

public class NbtX extends Object
Utilities to deal with NBT.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.resources.Identifier
    getIdentifier(net.minecraft.nbt.CompoundTag nbt, String key)
    Gets a Identifier from a CompoundTag stored with a given key or null if there's no such identifier.
    static net.minecraft.resources.Identifier
    getIdentifier(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.Identifier defaultValue)
    Gets a Identifier from a CompoundTag stored with a given key or the default value if there's no such identifier.
    static net.minecraft.resources.Identifier
    getIdentifier(net.minecraft.world.level.storage.ValueInput input, String key)
    Gets a Identifier from a ValueInput stored with a given key or null if there's no such identifier.
    static net.minecraft.resources.Identifier
    getIdentifier(net.minecraft.world.level.storage.ValueInput input, String key, net.minecraft.resources.Identifier defaultValue)
    Gets a Identifier from a ValueInput stored with a given key or the default value if there's no such identifier.
    static <T> net.minecraft.resources.ResourceKey<T>
    getResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry)
    Gets a ResourceKey.
    static <T> net.minecraft.resources.ResourceKey<T>
    getResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry, net.minecraft.resources.ResourceKey<T> defaultValue)
    Gets a ResourceKey.
    static <T> net.minecraft.resources.ResourceKey<T>
    getResourceKey(net.minecraft.world.level.storage.ValueInput input, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry)
    Gets a ResourceKey.
    static <T> net.minecraft.resources.ResourceKey<T>
    getResourceKey(net.minecraft.world.level.storage.ValueInput input, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry, net.minecraft.resources.ResourceKey<T> defaultValue)
    Gets a ResourceKey.
    static void
    putIdentifier(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.Identifier id)
    Stores a Identifier in a CompoundTag with a given key.
    static void
    putIdentifier(net.minecraft.world.level.storage.ValueOutput output, String key, net.minecraft.resources.Identifier id)
    Stores a Identifier in a ValueOutput with a given key.
    static void
    putResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<?> id)
    Stores the location of a ResourceKey.
    static void
    putResourceKey(net.minecraft.world.level.storage.ValueOutput output, String key, net.minecraft.resources.ResourceKey<?> id)
    Stores the location of a ResourceKey.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NbtX

      public NbtX()
  • Method Details

    • putIdentifier

      public static void putIdentifier(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.Identifier id)
      Stores a Identifier in a CompoundTag with a given key.
    • putIdentifier

      public static void putIdentifier(net.minecraft.world.level.storage.ValueOutput output, String key, net.minecraft.resources.Identifier id)
      Stores a Identifier in a ValueOutput with a given key.
    • getIdentifier

      @Nullable public static net.minecraft.resources.Identifier getIdentifier(net.minecraft.nbt.CompoundTag nbt, String key)
      Gets a Identifier from a CompoundTag stored with a given key or null if there's no such identifier.
    • getIdentifier

      @Nullable public static net.minecraft.resources.Identifier getIdentifier(net.minecraft.world.level.storage.ValueInput input, String key)
      Gets a Identifier from a ValueInput stored with a given key or null if there's no such identifier.
    • getIdentifier

      public static net.minecraft.resources.Identifier getIdentifier(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.Identifier defaultValue)
      Gets a Identifier from a CompoundTag stored with a given key or the default value if there's no such identifier.
    • getIdentifier

      public static net.minecraft.resources.Identifier getIdentifier(net.minecraft.world.level.storage.ValueInput input, String key, net.minecraft.resources.Identifier defaultValue)
      Gets a Identifier from a ValueInput stored with a given key or the default value if there's no such identifier.
    • putResourceKey

      public static void putResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<?> id)
      Stores the location of a ResourceKey. This will not store the registry.
      See Also:
    • putResourceKey

      public static void putResourceKey(net.minecraft.world.level.storage.ValueOutput output, String key, net.minecraft.resources.ResourceKey<?> id)
      Stores the location of a ResourceKey. This will not store the registry.
      See Also:
    • getResourceKey

      @Nullable public static <T> net.minecraft.resources.ResourceKey<T> getResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry)
      Gets a ResourceKey. This will only load the location, the Registry must be provided by the caller.
      See Also:
    • getResourceKey

      @Nullable public static <T> net.minecraft.resources.ResourceKey<T> getResourceKey(net.minecraft.world.level.storage.ValueInput input, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry)
      Gets a ResourceKey. This will only load the location, the Registry must be provided by the caller.
      See Also:
    • getResourceKey

      public static <T> net.minecraft.resources.ResourceKey<T> getResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry, net.minecraft.resources.ResourceKey<T> defaultValue)
      Gets a ResourceKey. This will only load the location, the Registry must be provided by the caller.
      See Also:
    • getResourceKey

      public static <T> net.minecraft.resources.ResourceKey<T> getResourceKey(net.minecraft.world.level.storage.ValueInput input, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registry, net.minecraft.resources.ResourceKey<T> defaultValue)
      Gets a ResourceKey. This will only load the location, the Registry must be provided by the caller.
      See Also: