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