Class NbtX
java.lang.Object
org.moddingx.libx.util.data.NbtX
Utilities to deal with NBT.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.resources.IdentifiergetIdentifier(net.minecraft.nbt.CompoundTag nbt, String key) Gets aIdentifierfrom aCompoundTagstored with a given key or null if there's no such identifier.static net.minecraft.resources.IdentifiergetIdentifier(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.Identifier defaultValue) Gets aIdentifierfrom aCompoundTagstored with a given key or the default value if there's no such identifier.static net.minecraft.resources.IdentifiergetIdentifier(net.minecraft.world.level.storage.ValueInput input, String key) Gets aIdentifierfrom aValueInputstored with a given key or null if there's no such identifier.static net.minecraft.resources.IdentifiergetIdentifier(net.minecraft.world.level.storage.ValueInput input, String key, net.minecraft.resources.Identifier defaultValue) Gets aIdentifierfrom aValueInputstored 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 aResourceKey.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 aResourceKey.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 aResourceKey.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 aResourceKey.static voidputIdentifier(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.Identifier id) Stores aIdentifierin aCompoundTagwith a given key.static voidputIdentifier(net.minecraft.world.level.storage.ValueOutput output, String key, net.minecraft.resources.Identifier id) Stores aIdentifierin aValueOutputwith a given key.static voidputResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<?> id) Stores the location of aResourceKey.static voidputResourceKey(net.minecraft.world.level.storage.ValueOutput output, String key, net.minecraft.resources.ResourceKey<?> id) Stores the location of aResourceKey.
-
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 aIdentifierin aCompoundTagwith a given key. -
putIdentifier
public static void putIdentifier(net.minecraft.world.level.storage.ValueOutput output, String key, net.minecraft.resources.Identifier id) Stores aIdentifierin aValueOutputwith a given key. -
getIdentifier
-
getIdentifier
-
getIdentifier
public static net.minecraft.resources.Identifier getIdentifier(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.Identifier defaultValue) Gets aIdentifierfrom aCompoundTagstored 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 aIdentifierfrom aValueInputstored 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 aResourceKey. 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 aResourceKey. 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 aResourceKey. This will only load the location, theRegistrymust 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 aResourceKey. This will only load the location, theRegistrymust 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 aResourceKey. This will only load the location, theRegistrymust 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 aResourceKey. This will only load the location, theRegistrymust be provided by the caller.- See Also:
-