Class NbtHelpers
java.lang.Object
org.cyclops.integrateddynamics.core.helper.NbtHelpers
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.nbt.ByteArrayTag
getListNbtByte
(ValueTypeList.ValueList<?, ?> value, net.minecraft.network.chat.Component operatorName) Create an NBT byte array from the given integer value list.static net.minecraft.nbt.IntArrayTag
getListNbtInt
(ValueTypeList.ValueList<?, ?> value, net.minecraft.network.chat.Component operatorName) Create an NBT int array from the given integer value list.static net.minecraft.nbt.LongArrayTag
getListNbtLong
(ValueTypeList.ValueList<?, ?> value, net.minecraft.network.chat.Component operatorName) Create an NBT long array from the given long value list.static net.minecraft.nbt.ListTag
getListNbtTag
(ValueTypeList.ValueList<?, ?> value, net.minecraft.network.chat.Component operatorName) Create an NBT List from the given NBT value list.static net.minecraft.nbt.CompoundTag
intersection
(net.minecraft.nbt.CompoundTag... tags) Create a new NBT tag that contains the entries that are present in all given tags.static net.minecraft.nbt.CompoundTag
minus
(net.minecraft.nbt.CompoundTag a, net.minecraft.nbt.CompoundTag b) Create a new NBT tag that contains all entries of the first tag minus the entries of the second tag.static boolean
nbtMatchesSubset
(net.minecraft.nbt.CompoundTag a, net.minecraft.nbt.CompoundTag b, boolean recursive) Check if the first tag is a subset of the second tag.static net.minecraft.nbt.CompoundTag
union
(net.minecraft.nbt.CompoundTag... tags) Create a new NBT tag that contains all entries from the given tags.
-
Constructor Details
-
NbtHelpers
public NbtHelpers()
-
-
Method Details
-
nbtMatchesSubset
public static boolean nbtMatchesSubset(net.minecraft.nbt.CompoundTag a, net.minecraft.nbt.CompoundTag b, boolean recursive) Check if the first tag is a subset of the second tag.- Parameters:
a
- An NBT tag.b
- An NBT tag.recursive
- If tags and list should be checked recursively. (list must be in the same order)- Returns:
- If tag a is a subset (or equal) of tag b.
-
union
public static net.minecraft.nbt.CompoundTag union(net.minecraft.nbt.CompoundTag... tags) Create a new NBT tag that contains all entries from the given tags. If multiple tags contain the same entry, the entry from the latest tag will be given preference. If nested tags are present, these will be combined recursively.- Parameters:
tags
- NBT tags.- Returns:
- A new tag containing the combined entries from the given tags.
-
intersection
public static net.minecraft.nbt.CompoundTag intersection(net.minecraft.nbt.CompoundTag... tags) Create a new NBT tag that contains the entries that are present in all given tags. If nested tags are present, these will be intersected recursively.- Parameters:
tags
- NBT tags.- Returns:
- A new tag containing the intersected entries from the given tags.
-
minus
public static net.minecraft.nbt.CompoundTag minus(net.minecraft.nbt.CompoundTag a, net.minecraft.nbt.CompoundTag b) Create a new NBT tag that contains all entries of the first tag minus the entries of the second tag. If nested tags are present, these will be operated recursively.- Parameters:
a
- an NBT tag.b
- an NBT tag.- Returns:
- A new tag containing the entries of a minus b.
-
getListNbtTag
public static net.minecraft.nbt.ListTag getListNbtTag(ValueTypeList.ValueList<?, ?> value, net.minecraft.network.chat.Component operatorName) Create an NBT List from the given NBT value list.- Parameters:
value
- An NBT value list.operatorName
- An operator name for error reporting.- Returns:
- An NBT list.
-
getListNbtByte
public static net.minecraft.nbt.ByteArrayTag getListNbtByte(ValueTypeList.ValueList<?, ?> value, net.minecraft.network.chat.Component operatorName) Create an NBT byte array from the given integer value list.- Parameters:
value
- An integer value list.operatorName
- An operator name for error reporting.- Returns:
- An NBT byte array.
-
getListNbtInt
public static net.minecraft.nbt.IntArrayTag getListNbtInt(ValueTypeList.ValueList<?, ?> value, net.minecraft.network.chat.Component operatorName) Create an NBT int array from the given integer value list.- Parameters:
value
- An integer value list.operatorName
- An operator name for error reporting.- Returns:
- An NBT int array.
-
getListNbtLong
public static net.minecraft.nbt.LongArrayTag getListNbtLong(ValueTypeList.ValueList<?, ?> value, net.minecraft.network.chat.Component operatorName) Create an NBT long array from the given long value list.- Parameters:
value
- A long value list.operatorName
- An operator name for error reporting.- Returns:
- An NBT long list.
-