MutableNBTCompound

class MutableNBTCompound @JvmOverloads() constructor(tags: MutableMap<String, NBT>) : NBTCompoundLike

Constructors

MutableNBTCompound
Link copied to clipboard
fun MutableNBTCompound(nbt: NBTCompound)

Functions

asMapView
Link copied to clipboard
open override fun asMapView(): Map<String, NBT>
Returns a Map representing this compound.
clear
Link copied to clipboard
fun clear()
Removes all elements from this compound.
contains
Link copied to clipboard
open operator fun contains(key: String): Boolean
Checks if the compound contains the given key.
containsKey
Link copied to clipboard
open fun containsKey(key: String): Boolean
Returns true if the compound contains the specified key.
containsValue
Link copied to clipboard
open fun containsValue(value: NBT): Boolean
Returns true if the compound maps one or more keys to the specified value.
copyFrom
Link copied to clipboard
fun copyFrom(from: Map<String, NBT>): MutableNBTCompound
Replaces all the contents of the compound with the given tags
fun copyFrom(from: NBTCompoundLike): MutableNBTCompound
Replaces all the contents of the compound with the given tags
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
forEach
Link copied to clipboard
open fun forEach(p0: Consumer<in Map.Entry<String, NBT>>)
open fun forEach(action: BiConsumer<String, NBT>)
Performs the given action on each entry.
open fun forEach(action: (CompoundEntry) -> Unit)
Performs the given action on each entry.
get
Link copied to clipboard
open operator override fun get(key: String): NBT?
Returns the value corresponding to the given key, or null if such a key is not present in the compound.
getAsByte
Link copied to clipboard
open fun getAsByte(key: String): Byte?
Calls getNumber and cast to the desired type.
getAsDouble
Link copied to clipboard
open fun getAsDouble(key: String): Double?
Calls getNumber and cast to the desired type.
getAsFloat
Link copied to clipboard
open fun getAsFloat(key: String): Float?
Calls getNumber and cast to the desired type.
getAsInt
Link copied to clipboard
open fun getAsInt(key: String): Int?
Calls getNumber and cast to the desired type.
getAsLong
Link copied to clipboard
open fun getAsLong(key: String): Long?
Calls getNumber and cast to the desired type.
getAsShort
Link copied to clipboard
open fun getAsShort(key: String): Short?
Calls getNumber and cast to the desired type.
getBoolean
Link copied to clipboard
open fun getBoolean(key: String): Boolean?
Returns the value associated to the given key, if any.
getByte
Link copied to clipboard
open fun getByte(key: String): Byte?
Returns the value associated to the given key, if any.
getByteArray
Link copied to clipboard
open fun getByteArray(key: String): ImmutableByteArray?
Returns the value associated to the given key, if any.
getCompound
Link copied to clipboard
open fun getCompound(key: String): NBTCompound?
Returns the value associated to the given key, if any.
getDouble
Link copied to clipboard
open fun getDouble(key: String): Double?
Returns the value associated to the given key, if any.
getFloat
Link copied to clipboard
open fun getFloat(key: String): Float?
Returns the value associated to the given key, if any.
getInt
Link copied to clipboard
open fun getInt(key: String): Int?
Returns the value associated to the given key, if any.
getIntArray
Link copied to clipboard
open fun getIntArray(key: String): ImmutableIntArray?
Returns the value associated to the given key, if any.
getList
Link copied to clipboard
open fun <T : NBT> getList(key: String): NBTList<T>?
Returns the value associated to the given key, if any.
getLong
Link copied to clipboard
open fun getLong(key: String): Long?
Returns the value associated to the given key, if any.
getLongArray
Link copied to clipboard
open fun getLongArray(key: String): ImmutableLongArray?
Returns the value associated to the given key, if any.
getNumber
Link copied to clipboard
open fun getNumber(key: String): Number?
Returns the value associated to the given key, if any.
getOrElse
Link copied to clipboard
open fun getOrElse(key: String, defaultValue: NBT): NBT
Returns the value associated to the given key, if any.
getOrPut
Link copied to clipboard
fun getOrPut(key: String, defaultValue: () -> NBT): NBT
Returns the value for the given key.
getShort
Link copied to clipboard
open fun getShort(key: String): Short?
Returns the value associated to the given key, if any.
getString
Link copied to clipboard
open fun getString(key: String): String?
Returns the value associated to the given key, if any.
hashCode
Link copied to clipboard
open override fun hashCode(): Int
isEmpty
Link copied to clipboard
open fun isEmpty(): Boolean
Returns true if the compound is empty (contains no elements), false otherwise.
iterator
Link copied to clipboard
open operator override fun iterator(): MutableIterator<MutableCompoundEntry>
Returns a MutableIterator over the mutable entries in the MutableNBTCompound.
plus
Link copied to clipboard
open operator override fun plus(other: NBTCompoundLike): MutableNBTCompound
Creates a new mutable compound by replacing or adding entries to this compound from another compound.
plusAssign
Link copied to clipboard
operator fun plusAssign(p: Pair<String, NBT>)
Updates this compound with the given key/value pair.
operator fun plusAssign(other: Map<String, NBT>)
Updates this compound with key/value pairs from the specified compound other.
operator fun plusAssign(other: NBTCompoundLike)
Updates this compound with key/value pairs from the specified compound other.
put
Link copied to clipboard
fun put(key: String, value: NBT): NBT?
Associates the specified value with the specified key in the compound.
putAll
Link copied to clipboard
fun putAll(from: Map<String, NBT>): MutableNBTCompound
Updates this compound with key/value pairs from the specified compound from.
fun putAll(from: NBTCompoundLike): MutableNBTCompound
Updates this compound with key/value pairs from the specified compound from.
remove
Link copied to clipboard
fun remove(key: String): NBT?
Removes the specified key and its corresponding value from this compound.
fun remove(key: String, value: NBT): Boolean
Removes the entry for the specified key only if it is mapped to the specified value.
set
Link copied to clipboard
operator fun set(key: String, value: NBT): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls put)
setAll
Link copied to clipboard
fun setAll(from: Map<String, NBT>): MutableNBTCompound
Updates this compound with key/value pairs from the specified compound from.
fun setAll(from: NBTCompoundLike): MutableNBTCompound
Updates this compound with key/value pairs from the specified compound from.
setByte
Link copied to clipboard
fun setByte(key: String, value: Byte): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setByteArray
Link copied to clipboard
fun setByteArray(key: String, value: ByteArray): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
fun setByteArray(key: String, value: ImmutableByteArray): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setDouble
Link copied to clipboard
fun setDouble(key: String, value: Double): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setFloat
Link copied to clipboard
fun setFloat(key: String, value: Float): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setInt
Link copied to clipboard
fun setInt(key: String, value: Int): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setIntArray
Link copied to clipboard
fun setIntArray(key: String, value: IntArray): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
fun setIntArray(key: String, value: ImmutableIntArray): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setLong
Link copied to clipboard
fun setLong(key: String, value: Long): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setLongArray
Link copied to clipboard
fun setLongArray(key: String, value: LongArray): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
fun setLongArray(key: String, value: ImmutableLongArray): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setShort
Link copied to clipboard
fun setShort(key: String, value: Short): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
setString
Link copied to clipboard
fun setString(key: String, value: String): MutableNBTCompound
Sets (and overwrites previous) tag associated to the given key (shorthand method that in turn calls set)
spliterator
Link copied to clipboard
open fun spliterator(): Spliterator<CompoundEntry>
toCompound
Link copied to clipboard
open override fun toCompound(): NBTCompound
Creates a NBTCompound.
toMutableCompound
Link copied to clipboard
open override fun toMutableCompound(): MutableNBTCompound
Returns a new mutable map containing all key-value pairs from the original compound.
toSNBT
Link copied to clipboard
open fun toSNBT(): String
Same semantics than NBT#toSNBT
toString
Link copied to clipboard
open override fun toString(): String

Properties

entries
Link copied to clipboard
open val entries: Set<CompoundEntry>
Returns a read-only Set of all key/value pairs in this compound.
keys
Link copied to clipboard
open val keys: Set<String>
Returns a read-only Set of all keys in this compound.
size
Link copied to clipboard
open val size: Int
Returns the number of key/value pairs in the compound.
values
Link copied to clipboard
open val values: Collection<NBT>
Returns a read-only Collection of all values in this compound.