Paper
                                
                                 Paper copied to clipboard
                                
                                    Paper copied to clipboard
                            
                            
                            
                        Items in crafting table get duplicated if result slot is set manually
What behaviour is expected:
If there is no recipe for the items in the crafting grid, taking items out of the result slot of the crafting inventory should leave the items in the crafting grid alone.
What behaviour is observed:
After taking an item out of the result slot, the items in the crafting grid are first decremented by one and then doubled. https://i.imgur.com/vZUlwIN.png https://i.imgur.com/k0hneCD.png
Steps/models to reproduce:
Put a stack of 2-64 items into a crafting table
Set the result slot using either .setResult() or .setItem()
Take the item of the result slot while leaving the crafting grid alone
Plugin list:
Only the plugin I'm using to test this
Paper build number:
504
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in a long time. If the issue still applies to the most recent supported version, please open a new issue referencing this original issue.
This is still an issue in Paper 1.16.5 build 463. Here's some example code for reproducing:
    @EventHandler
    public void onCraft(PrepareItemCraftEvent event) {
        for (ItemStack itemStack : event.getInventory().getContents()) {
            if (itemStack.isSimilar(new ItemStack(Material.STICK))) {
                event.getInventory().setResult(new ItemStack(Material.IRON_HELMET));
            }
        }
    }
In this example putting 1 stick in the crafting grid works correctly, but if you have 2 or more in a stack the sticks get duplicated.
Still replicable on the latest (22aaf913686c8518e375deb01c6cde74942d3ac2) 1.17.1 version of paper. Updated the tags respectively.
Can reproduce as of 1.19.1