Renamed nbt package to general data package

This commit is contained in:
bluefireoly
2020-08-31 18:04:07 +02:00
parent 3e718b5fed
commit 7c1d4bae73
3 changed files with 3 additions and 3 deletions

View File

@@ -0,0 +1,26 @@
package net.axay.kspigot.data
import net.axay.kspigot.annotations.NMS_General
import net.minecraft.server.v1_16_R2.NBTTagCompound
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack
import org.bukkit.entity.Entity
import org.bukkit.inventory.ItemStack
@NMS_General
var Entity.nbtData: NBTData
get() {
val nbtTagCompound = NBTTagCompound()
(this as CraftEntity).handle.load(nbtTagCompound)
return NBTData(nbtTagCompound)
}
set(value) {
(this as CraftEntity).handle.save(value.nbtTagCompound)
}
@NMS_General
val ItemStack.nbtData: NBTData get() {
CraftItemStack.asNMSCopy(this).let {
return if (it.hasTag()) NBTData(it.tag) else NBTData()
}
}