use of net.minecraft.server.v1_16_R1.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_R1.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_R1.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");
}
use of net.minecraft.server.v1_16_R1.ItemStack 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);
}
use of net.minecraft.server.v1_16_R1.ItemStack in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_16_R3 method createDesignItem.
@Override
public void createDesignItem(com.bgsoftware.wildchests.objects.inventory.CraftWildInventory craftWildInventory, org.bukkit.inventory.ItemStack itemStack) {
ItemStack designItem = CraftItemStack.asNMSCopy(itemStack == null || itemStack.getType() == Material.AIR ? new org.bukkit.inventory.ItemStack(Material.BLACK_STAINED_GLASS_PANE) : itemStack.clone());
designItem.setCount(1);
designItem.a("DesignItem", NBTTagByte.a(true));
WildInventory inventory = ((CraftWildInventory) craftWildInventory).getInventory();
inventory.setItem(0, designItem, false);
inventory.setItem(1, designItem, false);
inventory.setItem(3, designItem, false);
inventory.setItem(4, designItem, false);
}
Aggregations