Reputation: 41
How do I set an ItemStack in an anvil inventory? I need the method to be supported for versions 1.8.8-1.14.4. I can create the inventory, but can't set items. This is what I have:
void open(Player player) {
Inventory createKitGUI = Bukkit.createInventory(null, InventoryType.ANVIL);
createKitGUI.setItem(1, new ItemStack(XMaterial.PAPER.parseMaterial()));
player.openInventory(createKitGUI);
}
I've tried setting in slots 0 and 1 but it doesn't work. 0 and 1 are the first 2 slots in the anvil inventory.
Upvotes: 4
Views: 4730
Reputation: 1243
WHY YOU CANNOT DO THIS WITHOUT NMS
After further research I've found out this:
So your only chance is to implement an NMS solution.
ANVIL GUI
If you don't want to dive into NMS development then you can use the following API called AnvilGUI by WesJD. Here you have the documentation of this API.
Upvotes: 3