use of net.minecraft.server.v1_13_R2.NBTTagCompound in project WildLoaders by BG-Software-LLC.
the class NMSAdapter_v1_7_R4 method setTag.
@Override
public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack itemStack, String key, String value) {
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
tagCompound.set(key, new NBTTagString(value));
nmsItem.setTag(tagCompound);
return CraftItemStack.asBukkitCopy(nmsItem);
}
use of net.minecraft.server.v1_13_R2.NBTTagCompound in project WildLoaders by BG-Software-LLC.
the class NMSAdapter_v1_7_R4 method getTag.
@Override
public long getTag(org.bukkit.inventory.ItemStack itemStack, String key, long def) {
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
if (!tagCompound.hasKeyOfType(key, 4))
return def;
return tagCompound.getLong(key);
}
use of net.minecraft.server.v1_13_R2.NBTTagCompound in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method deserialize.
private static InventoryHolder deserialize(NBTTagCompound tagCompound) {
InventoryHolder inventory = new InventoryHolder(tagCompound.getInt("Size"), "Chest");
NBTTagList itemsList = tagCompound.getList("Items", 10);
for (int i = 0; i < itemsList.size(); i++) {
NBTTagCompound nbtTagCompound = itemsList.getCompound(i);
inventory.setItem(nbtTagCompound.getByte("Slot"), CraftItemStack.asBukkitCopy(ItemStack.a(nbtTagCompound)));
}
return inventory;
}
use of net.minecraft.server.v1_13_R2.NBTTagCompound in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method getChestName.
@Override
public String getChestName(org.bukkit.inventory.ItemStack itemStack) {
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tagCompound = nmsItem.getTag();
return tagCompound == null || !tagCompound.hasKey("chest-name") ? null : tagCompound.getString("chest-name");
}
use of net.minecraft.server.v1_13_R2.NBTTagCompound in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method setItemTag.
private org.bukkit.inventory.ItemStack setItemTag(org.bukkit.inventory.ItemStack itemStack, String key, String value) {
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tagCompound = nmsItem.getOrCreateTag();
tagCompound.setString(key, value);
return CraftItemStack.asCraftMirror(nmsItem);
}
Aggregations