Package com.petrolpark.util
Class NBTHelper
java.lang.Object
com.petrolpark.util.NBTHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanequalIgnoring(net.minecraft.nbt.CompoundTag tag1, net.minecraft.nbt.CompoundTag tag2, String... ignoredKeys) static final <T> Tread(net.minecraft.core.HolderLookup.Provider registries, com.mojang.serialization.Codec<T> codec, net.minecraft.nbt.Tag tag) static intreadBogglePattern(net.minecraft.nbt.CompoundTag tag, String key) Deprecated.static <T> List<T> readCompoundList(net.minecraft.nbt.ListTag tag, Function<net.minecraft.nbt.CompoundTag, T> reader) static <OBJECT> OBJECTreadDataRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> dataRegistryKey) Deprecated.static <E extends Enum<E>>
Estatic <OBJECT> OBJECTreadRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey) Deprecated.static <OBJECT> OBJECTreadRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, net.minecraft.core.RegistryAccess registryAccess) Read a registered object (datapack or global).static <OBJECT> OBJECTreadRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, net.minecraft.world.level.Level level) Read a registered object (datapack or global).static net.minecraft.world.phys.Vec3readVec3(net.minecraft.nbt.ListTag tag, net.minecraft.core.BlockPos origin) static IllegalStateExceptionstatic final <T> net.minecraft.nbt.Tagwrite(net.minecraft.core.HolderLookup.Provider registries, com.mojang.serialization.Codec<T> codec, T object) static Consumer<net.minecraft.nbt.Tag> static voidwriteBogglePattern(net.minecraft.nbt.CompoundTag tag, String key, int binaryMatrix) Deprecated.static <T> net.minecraft.nbt.ListTagwriteCompoundList(List<T> list, Function<T, net.minecraft.nbt.CompoundTag> writer) static <OBJECT> voidwriteDataRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> dataRegistryKey, OBJECT dataObject) Deprecated.static <E extends Enum<E>>
voidstatic <OBJECT> voidwriteRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, net.minecraft.core.RegistryAccess registryAccess, OBJECT object) Write a registered object (datapack or global).static <OBJECT> voidwriteRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, net.minecraft.world.level.Level level, OBJECT object) Write a registered object (datapack or global).static <OBJECT> voidwriteRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, OBJECT object) Deprecated.static net.minecraft.nbt.ListTagwriteVec3(net.minecraft.world.phys.Vec3 vec, net.minecraft.core.BlockPos origin)
-
Constructor Details
-
NBTHelper
public NBTHelper()
-
-
Method Details
-
equalIgnoring
public static boolean equalIgnoring(net.minecraft.nbt.CompoundTag tag1, net.minecraft.nbt.CompoundTag tag2, String... ignoredKeys) -
write
public static final <T> net.minecraft.nbt.Tag write(net.minecraft.core.HolderLookup.Provider registries, com.mojang.serialization.Codec<T> codec, T object) -
read
public static final <T> T read(net.minecraft.core.HolderLookup.Provider registries, com.mojang.serialization.Codec<T> codec, net.minecraft.nbt.Tag tag) -
writeAt
-
readCompoundList
-
writeCompoundList
-
readEnum
-
writeEnum
-
readVec3
public static net.minecraft.world.phys.Vec3 readVec3(net.minecraft.nbt.ListTag tag, net.minecraft.core.BlockPos origin) -
writeVec3
public static net.minecraft.nbt.ListTag writeVec3(net.minecraft.world.phys.Vec3 vec, net.minecraft.core.BlockPos origin) -
readBogglePattern
Deprecated. -
writeBogglePattern
@Deprecated public static void writeBogglePattern(net.minecraft.nbt.CompoundTag tag, String key, int binaryMatrix) Deprecated. -
readRegistryObject
public static <OBJECT> OBJECT readRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, net.minecraft.world.level.Level level) Read a registered object (datapack or global).- Type Parameters:
OBJECT- Class of the object/registry- Parameters:
tag-key-registryKey-level-- Returns:
nullif the ResourceLocation is invalid
-
writeRegistryObject
public static <OBJECT> void writeRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, net.minecraft.world.level.Level level, OBJECT object) Write a registered object (datapack or global).- Type Parameters:
OBJECT- Class of the object/registry- Parameters:
tag-key-registryKey-level-object-
-
readRegistryObject
public static <OBJECT> OBJECT readRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, net.minecraft.core.RegistryAccess registryAccess) Read a registered object (datapack or global).- Type Parameters:
OBJECT- Class of the object/registry- Parameters:
tag-key-registryKey-registryAccess-- Returns:
nullif the ResourceLocation is invalid
-
writeRegistryObject
public static <OBJECT> void writeRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, net.minecraft.core.RegistryAccess registryAccess, OBJECT object) Write a registered object (datapack or global).- Type Parameters:
OBJECT- Class of the object/registry- Parameters:
tag-key-registryKey-registryAccess-object-
-
readRegistryObject
@Deprecated public static <OBJECT> OBJECT readRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey) Deprecated.Read a global (non-datapack sensitive) registered object.- Type Parameters:
OBJECT- Class of the object/registry- Parameters:
tag-key-registryKey-- Returns:
nullif the ResourceLocation is invalid
-
writeRegistryObject
@Deprecated public static <OBJECT> void writeRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> registryKey, OBJECT object) Deprecated.Write a global (non-datapack sensitive) registered object.- Type Parameters:
OBJECT- Class of the object/registry- Parameters:
tag-key-registryKey-object-
-
readDataRegistryObject
@Deprecated public static <OBJECT> OBJECT readDataRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> dataRegistryKey) Deprecated.Read a datapack-sensitive registered object.- Type Parameters:
OBJECT- Class of the object/registry- Parameters:
tag-key-dataRegistryKey-- Returns:
nullif the ResourceLocation is invalid
-
writeDataRegistryObject
@Deprecated public static <OBJECT> void writeDataRegistryObject(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<OBJECT>> dataRegistryKey, OBJECT dataObject) Deprecated.Write a datapack-sensitive registered object.- Type Parameters:
OBJECT- Class of the object/registry- Parameters:
tag-key-dataRegistryKey-dataObject-
-
registryNotLoadedException
-