use of net.minecraft.server.v1_16_R3.ItemStack in project WildLoaders by BG-Software-LLC.
the class NMSAdapter_v1_8_R3 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_16_R3.ItemStack 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_16_R3.ItemStack 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_16_R3.ItemStack in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method dropItemAsPlayer.
@Override
public void dropItemAsPlayer(HumanEntity humanEntity, org.bukkit.inventory.ItemStack bukkitItem) {
EntityHuman entityHuman = ((CraftHumanEntity) humanEntity).getHandle();
ItemStack itemStack = CraftItemStack.asNMSCopy(bukkitItem);
entityHuman.drop(itemStack, false);
}
use of net.minecraft.server.v1_16_R3.ItemStack 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");
}
Aggregations