Package org.moddingx.libx.util.data
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.ResourceLocationgetResource(net.minecraft.nbt.CompoundTag nbt, String key) Gets aResourceLocationfrom aCompoundTagstored with a given key or null if there's no such resource location.static net.minecraft.resources.ResourceLocationgetResource(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceLocation defaultValue) Gets aResourceLocationfrom aCompoundTagstored with a given key or the default value if there's no such resource location.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 voidputResource(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceLocation rl) Stores aResourceLocationin aCompoundTagwith a given key.static voidputResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<?> rl) Stores the location of aResourceKey.
-
Constructor Details
-
NbtX
public NbtX()
-
-
Method Details
-
putResource
public static void putResource(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceLocation rl) Stores aResourceLocationin aCompoundTagwith a given key. -
getResource
@Nullable public static net.minecraft.resources.ResourceLocation getResource(net.minecraft.nbt.CompoundTag nbt, String key) Gets aResourceLocationfrom aCompoundTagstored with a given key or null if there's no such resource location. -
getResource
public static net.minecraft.resources.ResourceLocation getResource(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceLocation defaultValue) Gets aResourceLocationfrom aCompoundTagstored with a given key or the default value if there's no such resource location. -
putResourceKey
public static void putResourceKey(net.minecraft.nbt.CompoundTag nbt, String key, net.minecraft.resources.ResourceKey<?> rl) 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
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:
-