PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.39k stars 2.2k forks source link

Cancelling Item drop inside invetory splits/moves the ItemStack #10856

Open dawon opened 1 month ago

dawon commented 1 month ago

Expected behavior

When Item drop is cancelled the item stack affected should not be changed in any way

Observed/Actual behavior

When item is dropped from inside inventory this is cancelled, the item is readded into selected slot instead of original itemstack/slot

Steps/models to reproduce

prepare plugin cancelling all PlayerDropItemEvents 1) get a stack of any item (/give @p minecraft:dirt 64) and have it in first slot 2) select any other slot 3.a) open inventory and drop one of the items using q and hovering the item stack 3.b) right-click the item and drop it outside of the inventory 3.c) left-click the item and drop it outside of inventory

Plugin and Datapack List

only the test plugin cancelling the drop events

Paper version

This server is running Paper version 1.20.6-137-master@bd5867a (2024-06-04T21:04:28Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT) You are running the latest version

Other

No response

electronicboy commented 1 month ago

The general issue here is that these events trigger too deep in the call stack to be able to properly revert what happened where the call occurred, we'd need to figure out how to safely pass the cancellation back up the stack so that the operation can actually be reverted

TonytheMacaroni commented 1 month ago

7727 addresses the issues in 3.b and 3.c. It doesn't address 3.a, though.