Skip to content

CraftAbstractInventoryView returns wrong Slot number in Crafter views #12864

@codeHusky

Description

@codeHusky

Like the Crafting Table, the Crafter menu uses different ID ordering than normal over the network. Unlike the Crafting table, the Crafter is weird.
https://minecraft.wiki/w/Java_Edition_protocol/Inventory#Crafter

Exact test conditions are checking getClickedInventory() instanceOf PlayerInventory, e.getClick().isRightClick(), as well as getCursor().getType() == Material.AIR, though I don't believe those are important.

The following code will fail with the current implementation, placing the item in the wrong place during an InventoryClickEvent.

InventoryClickEvent event; // example
// ... 
event.getInventory().setItem(event.getSlot(), new ItemStack(Material.DIAMOND));
// OR
event.setCurrentItem(new ItemStack(Material.DIAMOND));
Image Image

Verified issue against aa4ef06 (1.21.8) but probably affects versions since Crafter was introduced

This server is running Paper version 1.21.8-4-main@aa4ef06 (2025-07-17T23:33:28Z) (Implementing API version 1.21.8-R0.1-SNAPSHOT)
You are running the latest version

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.version: 1.21.11Game version 1.21.11version: 1.21.8Game version 1.21.8

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions