//nbt-manipulator/br.com.gamemods.nbtmanipulator/NbtCompound
NbtCompound
[jvm]
class NbtCompound : NbtTag, MutableMap<String, NbtTag>
A tag which contains a MutableMap structure associating Strings to NbtTags.
It’s the main heart of NBT files and usually contains complex structures.
The returned tags by this class will be linked, so modifications to it will also affect the compound value.
All get functions which are not prefixed with Nullable and get will throw a ClassCastException if the tag is mapped to a different class then the method used. For example if a given compound have an example=NbtInt(2) and you try to read it using NbtCompound.getShort, an exception will be thrown.
All get functions which are not prefixed with Nullable and get will throw NoSuchElementException if no value is mapped to the given name. This will change in the future.
All get list functions which returns lists of specific types will throw IllegalStateException if the list content does not match the requested type.
Parameters
jvm
value | A Map which contains all key-value mappings. |
Constructors
NbtCompound | [jvm] fun NbtCompound(value: Map<String, NbtTag>) Creates a new compound containing the same mappings as the given Map. |
NbtCompound | [jvm] fun NbtCompound() Creates an empty compound. |
NbtCompound | [jvm] fun NbtCompound(vararg tags: Pair<String, NbtTag>) Creates a compound which maps the Pair.first value to the Pair.second tag initially. |
NbtCompound | [jvm] fun NbtCompound(tags: Iterable<Pair<String, NbtTag>>) Creates a compound which maps the Pair.first value to the Pair.second tag initially. |
NbtCompound | [jvm] fun NbtCompound(value: String) |
Functions
Name | Summary |
---|---|
clear | [jvm] open override fun clear() |
compute | [jvm] open fun compute(p0: String, p1: BiFunction<in String, in NbtTag?, out NbtTag?>): NbtTag? |
computeIfAbsent | [jvm] open fun computeIfAbsent(p0: String, p1: Function<in String, out NbtTag>): NbtTag |
computeIfPresent | [jvm] open fun computeIfPresent(p0: String, p1: BiFunction<in String, in NbtTag, out NbtTag?>): NbtTag? |
containsKey | [jvm] open override fun containsKey(key: String): Boolean |
containsValue | [jvm] open override fun containsValue(value: NbtTag): Boolean |
copyFrom | [jvm] fun copyFrom(other: NbtCompound, tagKey: String, default: NbtTag? = null) Checks if the other compound have a given tag, if it has been placed it in this compound. |
copyTo | [jvm] fun copyTo(other: NbtCompound, tagKey: String, default: NbtTag? = null) Checks if the compound have a given tag, if it has been placed it in the other compound. |
deepCopy | [jvm] open override fun deepCopy(): NbtCompound Returns a new NbtCompound with all nested values copied deeply. |
equals | [jvm] open operator override fun equals(other: Any?): Boolean |
forEach | [jvm] open fun forEach(p0: BiConsumer<in String, in NbtTag>) |
get | [jvm] open operator override fun get(key: String): NbtTag? |
getBooleanByte | [jvm] fun getBooleanByte(key: String): Boolean Returns true if getByte returns 1, false otherwise. |
getByte | [jvm] fun getByte(key: String): Byte Returns the unwrapped byte value. |
getByteArray | [jvm] fun getByteArray(key: String): ByteArray Returns the unwrapped byte array value. The array will be linked and any modification will also change wrapper and the mapped value. |
getByteArrayList | [jvm] fun getByteArrayList(key: String): NbtList<NbtByteArray> Returns the NbtList of byte arrays mapped to that key. The tag and it’s value will be linked and any modification will also change the mapped value. |
getByteList | [jvm] fun getByteList(key: String): NbtList<NbtByte> Returns the NbtList of bytes mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getCompound | [jvm] fun getCompound(key: String): NbtCompound Returns the NbtCompound mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getCompoundList | [jvm] fun getCompoundList(key: String): NbtList<NbtCompound> Returns the NbtList of compounds mapped to that key. The tag and it’s values will be linked and any modification will also change the mapped value. |
getDouble | [jvm] fun getDouble(key: String): Double Returns the unwrapped double value. |
getDoubleList | [jvm] fun getDoubleList(key: String): NbtList<NbtDouble> Returns the NbtList of doubles mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getFloat | [jvm] fun getFloat(key: String): Float Returns the unwrapped float value. |
getFloatList | [jvm] fun getFloatList(key: String): NbtList<NbtFloat> Returns the NbtList of floats mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getInt | [jvm] fun getInt(key: String): Int Returns the unwrapped int value. |
getIntArray | [jvm] fun getIntArray(key: String): IntArray Returns the unwrapped int array value. The array will be linked and any modification will also change wrapper and the mapped value. |
getIntArrayList | [jvm] fun getIntArrayList(key: String): NbtList<NbtIntArray> Returns the NbtList of int arrays mapped to that key. The tag and it’s value will be linked and any modification will also change the mapped value. |
getIntList | [jvm] fun getIntList(key: String): NbtList<NbtInt> Returns the NbtList of integers mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getList | [jvm] fun getList(key: String): NbtList<*> Returns the NbtList mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getListOfList | [jvm] fun getListOfList(key: String): NbtList<NbtList<*>> Returns the NbtList of lists mapped to that key. The tag and it’s values will be linked and any modification will also change the mapped value. |
getLong | [jvm] fun getLong(key: String): Long Returns the unwrapped long value. |
getLongArray | [jvm] fun getLongArray(key: String): LongArray Returns the unwrapped long array value. The array will be linked and any modification will also change wrapper and the mapped value. |
getLongArrayList | [jvm] fun getLongArrayList(key: String): NbtList<NbtLongArray> Returns the NbtList of long arrays mapped to that key. The tag and it’s values will be linked and any modification will also change the mapped value. |
getLongList | [jvm] fun getLongList(key: String): NbtList<NbtLong> Returns the NbtList of longs mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableBooleanByte | [jvm] fun getNullableBooleanByte(key: String): Boolean Returns true if getByte returns 1, false otherwise. Will also return false if the value is not mapped. |
getNullableByte | [jvm] fun getNullableByte(key: String): Byte? Returns the unwrapped byte value or null if no value is mapped, or it is mapped to another type tag. |
getNullableByteArray | [jvm] fun getNullableByteArray(key: String): ByteArray? Returns the unwrapped byte array value. The array will be linked and any modification will also change wrapper and the mapped value. |
getNullableByteArrayList | [jvm] fun getNullableByteArrayList(key: String): NbtList<NbtByteArray>? Returns the NbtList of byte arrays mapped to that key. The tag and it’s value will be linked and any modification will also change the mapped value. |
getNullableByteList | [jvm] fun getNullableByteList(key: String): NbtList<NbtByte>? Returns the NbtList of bytes mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableCompound | [jvm] fun getNullableCompound(key: String): NbtCompound? Returns the NbtCompound mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableCompoundList | [jvm] fun getNullableCompoundList(key: String): NbtList<NbtCompound>? Returns the NbtList of compounds mapped to that key. The tag and it’s values will be linked and any modification will also change the mapped value. |
getNullableDouble | [jvm] fun getNullableDouble(key: String): Double? Returns the unwrapped double value or null if no value is mapped, or it is mapped to another type tag. |
getNullableDoubleList | [jvm] fun getNullableDoubleList(key: String): NbtList<NbtDouble>? Returns the NbtList of doubles mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableFloat | [jvm] fun getNullableFloat(key: String): Float? Returns the unwrapped float value or null if no value is mapped, or it is mapped to another type tag. |
getNullableFloatList | [jvm] fun getNullableFloatList(key: String): NbtList<NbtFloat>? Returns the NbtList of floats mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableInt | [jvm] fun getNullableInt(key: String): Int? Returns the unwrapped int value or null if no value is mapped, or it is mapped to another type tag. |
getNullableIntArray | [jvm] fun getNullableIntArray(key: String): IntArray? Returns the unwrapped int array value. The array will be linked and any modification will also change wrapper and the mapped value. |
getNullableIntArrayList | [jvm] fun getNullableIntArrayList(key: String): NbtList<NbtIntArray>? Returns the NbtList of int arrays mapped to that key. The tag and it’s value will be linked and any modification will also change the mapped value. |
getNullableIntList | [jvm] fun getNullableIntList(key: String): NbtList<NbtInt>? Returns the NbtList of integers mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableList | [jvm] fun getNullableList(key: String): NbtList<*>? Returns the NbtList mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableListOfList | [jvm] fun getNullableListOfList(key: String): NbtList<NbtList<*>>? Returns the NbtList of lists mapped to that key. The tag and it’s values will be linked and any modification will also change the mapped value. |
getNullableLong | [jvm] fun getNullableLong(key: String): Long? Returns the unwrapped long value or null if no value is mapped, or it is mapped to another type tag. |
getNullableLongArray | [jvm] fun getNullableLongArray(key: String): LongArray? Returns the unwrapped long array value. The array will be linked and any modification will also change wrapper and the mapped value. |
getNullableLongArrayList | [jvm] fun getNullableLongArrayList(key: String): NbtList<NbtLongArray>? Returns the NbtList of long arrays mapped to that key. The tag and it’s values will be linked and any modification will also change the mapped value. |
getNullableLongList | [jvm] fun getNullableLongList(key: String): NbtList<NbtLong>? Returns the NbtList of longs mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableShort | [jvm] fun getNullableShort(key: String): Short? Returns the unwrapped short value or null if no value is mapped, or it is mapped to another type tag. |
getNullableShortList | [jvm] fun getNullableShortList(key: String): NbtList<NbtShort>? Returns the NbtList of shorts mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getNullableString | [jvm] fun getNullableString(key: String): String? Returns the unwrapped string value or null if no value is mapped, or it is mapped to another type tag. |
getNullableStringList | [jvm] fun getNullableStringList(key: String): NbtList<NbtString>? Returns the NbtList of strings mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getOrDefault | [jvm] open fun getOrDefault(key: String, defaultValue: NbtTag): NbtTag |
getShort | [jvm] fun getShort(key: String): Short Returns the unwrapped short value. |
getShortList | [jvm] fun getShortList(key: String): NbtList<NbtShort> Returns the NbtList of shorts mapped to that key. The tag will be linked and any modification will also change the mapped value. |
getString | [jvm] fun getString(key: String): String Returns the unwrapped string value. |
getStringList | [jvm] fun getStringList(key: String): NbtList<NbtString> Returns the NbtList of strings mapped to that key. The tag will be linked and any modification will also change the mapped value. |
hashCode | [jvm] open override fun hashCode(): Int |
isEmpty | [jvm] open override fun isEmpty(): Boolean |
merge | [jvm] open fun merge(p0: String, p1: NbtTag, p2: BiFunction<in NbtTag, in NbtTag, out NbtTag?>): NbtTag? |
put | [jvm] open override fun put(key: String, value: NbtTag): NbtTag? |
putAll | [jvm] open override fun putAll(from: Map<out String, NbtTag>) |
putIfAbsent | [jvm] open fun putIfAbsent(p0: String, p1: NbtTag): NbtTag? |
remove | [jvm] open override fun remove(key: String): NbtTag? open fun remove(key: String, value: NbtTag): Boolean |
replace | [jvm] open fun replace(p0: String, p1: NbtTag): NbtTag? open fun replace(p0: String, p1: NbtTag, p2: NbtTag): Boolean |
replaceAll | [jvm] open fun replaceAll(p0: BiFunction<in String, in NbtTag, out NbtTag>) |
require | [jvm] fun require(key: String): NbtTag Returns the value corresponding to the given key, or throw an exception if such a key is not present in the compound. |
set | [jvm] operator fun set(key: String, value: NbtTag) Directly maps a NbtTag to a key. The value must not be NbtEnd. The given tag will be linked, so modifications to it will also affect the compound value. [jvm] operator fun set(key: String, value: Boolean) Maps a NbtByte1 if the value is true and 0 otherwise. [jvm] operator fun set(key: String, value: Byte) Maps a NbtByte with the given value. [jvm] operator fun set(key: String, value: ByteArray) operator fun set(key: String, value: IntArray) operator fun set(key: String, value: LongArray) Maps a NbtByteArray with the given value. The array instance will be linked so any modification will also change the tag value. [jvm] operator fun set(key: String, value: Double) operator fun set(key: String, value: String) Maps a NbtDouble with the given value. [jvm] operator fun set(key: String, value: Float) Maps a NbtFloat with the given value. [jvm] operator fun set(key: String, value: Int) Maps a NbtInt with the given value. [jvm] operator fun set(key: String, value: Long) Maps a NbtLong with the given value. [jvm] operator fun set(key: String, value: Short) Maps a NbtShort with the given value. |
toString | [jvm] override fun toString(): String A technical string representation of this tag, containing the tag type, and it’s value, appropriated for developer inspections. |
Properties
Name | Summary |
---|---|
entries | [jvm] open override val entries: MutableSet<MutableMap.MutableEntry<String, NbtTag>> |
keys | [jvm] open override val keys: MutableSet<String> |
size | [jvm] open override val size: Int |
stringValue | [jvm] open override val stringValue: String Returns a string representation of the tag’s value. |
values | [jvm] open override val values: MutableCollection<NbtTag> |