mojira.dev
MCPE-136964

Event entity_acquired_item does not fire in multiple cases

Hello, I have been testing various server events listed as part of the scripting API, and I noticed that there are several cases where entity_acquired_item does not fire when it should.

The following item acquisition events do not fire when listening for this event:

  • Crafting an item

  • Picking up an item from a chest

  • Trading with a villager or merchant

As far as I could tell, only the pick_up acquistion event makes this server event fire. This seems like a bug since multiple acquisition types are suggested to be available for the acquisition_method property of the event data, and the documentation explicitly lists villager trading as an example of when this event should fire.

Sample code for testing (server script):

const acquireItemSystem = server.registerSystem(0, 0);
acquireItemSystem.initialize = function() {
  this.listenForEvent('minecraft:entity_acquired_item', eventData => this.onItemAcquired(eventData));
}
acquireItemSystem.onItemAcquired = function (eventData) {
  this.sendChatMessage(`Entity ${eventData.data.entity.id} acquired item ${eventData.data.item_stack.item} via ${eventData.data.acquisition_method}`);
}
acquireItemSystem .sendChatMessage = function (message) {
    let eventData = this.createEventData("minecraft:display_chat_event");
    if (eventData) {
        eventData.data.message = message;
        this.broadcastEvent("minecraft:display_chat_event", eventData);
    }
};

There is a reproduction case with instructions in this git repo: https://github.com/intrepidOlivia/entity_acquired_item_bug_repro

 

Attachments

Comments 3

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Is this still an issue in the latest version? If yes, can you please add it to the affected versions (or mention it if you are not the reporter)?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

This bug is still reproducing with version 1.18.0.

I have updated this task to include code and instructions for reproduction in a git repo: https://github.com/intrepidOlivia/entity_acquired_item_bug_repro

And I have also attached a video of the problem occurring.

Closing as Invalid, this scripting API is no longer supported (see the Intro to Scripting article for more information).

Marisha Parker

(Unassigned)

Plausible

Windows

Windows 10

1.17.10, 1.18.0

Retrieved