Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Items in crafting table get duplicated if result slot is set manually

Open Frogperson opened this issue 6 years ago • 5 comments

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

Frogperson avatar Jan 24 '19 13:01 Frogperson

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.

stale[bot] avatar Dec 03 '20 05:12 stale[bot]

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.

stale[bot] avatar Dec 10 '20 05:12 stale[bot]

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.

Frogperson avatar Feb 06 '21 18:02 Frogperson

Still replicable on the latest (22aaf913686c8518e375deb01c6cde74942d3ac2) 1.17.1 version of paper. Updated the tags respectively.

lynxplay avatar Nov 26 '21 17:11 lynxplay

Can reproduce as of 1.19.1

Owen1212055 avatar Aug 06 '22 23:08 Owen1212055