org.jglrxavpok.hephaistos.nbt.NBTInt.kt Maven / Gradle / Ivy
package org.jglrxavpok.hephaistos.nbt
import java.io.DataInputStream
import java.io.DataOutputStream
class NBTInt constructor(value: Int) : NBTNumber(value) {
override val ID = NBTType.TAG_Int
// help Java compiler to find the correct type (boxed vs primitive types)
fun getValue(): Int = value
override fun writeContents(destination: DataOutputStream) {
destination.writeInt(value)
}
override fun toSNBT(): String {
return "$value"
}
companion object: NBTReaderCompanion {
override fun readContents(source: DataInputStream): NBTInt {
return NBTInt(source.readInt())
}
}
}