
walkmc.nbt.SlotAdapter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of walk-server Show documentation
Show all versions of walk-server Show documentation
A spigot fork to kotlin structure and news.
package walkmc.nbt
import net.minecraft.server.*
import walkmc.Slot
/**
* A tag adapter for adapting [Slot].
*/
object SlotAdapter : TagAdapter {
override fun load(key: String, tag: NBTTagCompound): Slot {
val compound = tag.getCompound(key)
return Slot(compound.getByte("Slot").toInt(), compound.getItem("Item"))
}
override fun save(key: String, value: Slot, tag: NBTTagCompound) {
tag.set(key, NBTTagCompound().apply {
setByte("Slot", value.slot.toByte())
setItem("Item", value.item)
})
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy