Expected behavior
When cancelling the EntityPickupItemEvent, villagers should not pick up the item.
Observed/Actual behavior
It works well when they pickup a new item, however if the item they pickup is modifying another item in the inventory (for example, they have 1 bread and they pick another one), the item is still added (or in other words, the modified item is not reverted as well)
Steps/models to reproduce
Get a villager with 1 bread in the inventory, drop another bread and check the inventory.
Here is an image of the inventory when the villager tries to pick up a new item:
https://gyazo.com/e1e322a55ae27ff8add97c6e0b54365b
The first line is before the villager tried to pickup the item, the other lines are a few times after he tried to pick it up. He can't pick up more items when the item in the inventory is 64 items.
Plugin list
A plugin that stops the villagers from picking up items (custom coded, code is shown below)
Paper version
This server is running Paper version git-Paper-779 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
You are running the latest version
Previous version: git-Paper-674 (MC: 1.16.5)
Agreements
Other
Cancel pickup event:
@EventHandler
public void onEntityPickup(EntityPickupItemEvent e){
if(e.getEntityType() == EntityType.VILLAGER)
e.setCancelled(true);
}
Expected behavior
When cancelling the EntityPickupItemEvent, villagers should not pick up the item.
Observed/Actual behavior
It works well when they pickup a new item, however if the item they pickup is modifying another item in the inventory (for example, they have 1 bread and they pick another one), the item is still added (or in other words, the modified item is not reverted as well)
Steps/models to reproduce
Get a villager with 1 bread in the inventory, drop another bread and check the inventory.
Here is an image of the inventory when the villager tries to pick up a new item:
https://gyazo.com/e1e322a55ae27ff8add97c6e0b54365b
The first line is before the villager tried to pickup the item, the other lines are a few times after he tried to pick it up. He can't pick up more items when the item in the inventory is 64 items.
Plugin list
A plugin that stops the villagers from picking up items (custom coded, code is shown below)
Paper version
This server is running Paper version git-Paper-779 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
You are running the latest version
Previous version: git-Paper-674 (MC: 1.16.5)
Agreements
Other
Cancel pickup event: