Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-136964

Event entity_acquired_item does not fire in multiple cases

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.17.10, 1.18.0
    • None
    • Plausible
    • Windows

      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

       

            eigenmishi Marisha Parker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: