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

Event playerInteractWithBlock called multiple times

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21.10.21 Preview
    • Confirmed
    • Multiple
    • 1246351

      Following on from MCPE-176244 I am experiencing a similar issue.

      The event playerInteractWithBlock is called multiple times when a player interacts with a block. This applies to both world's BeforeEvents and AfterEvents.

      I have used this script to show the problem:

       

      import { world, system, BlockPermutation } from "@minecraft/server";
      let i = 0;
      world.beforeEvents.playerInteractWithBlock.subscribe((event) => {
          world.sendMessage("Before Event " + (i++));
      });
      world.afterEvents.playerInteractWithBlock.subscribe((event) => {
          world.sendMessage("After Event " + (i++));
      });
      

       

      Steps to Recreate

      1. Create a world with the attached Behavior Pack and Beta APIs enabled.
      2. Interact with any block.
      3. The Before Event message appears a few times (between 3-7)
        • Not as expected - expectation is this message appears only once.
      4. The After Event message appears a few times (between 3-7)
        • Not as expected - expectation is this message appears only once.
      5. Point at at any block and hold down the interact button - I was using the right-mouse button to observe this.
      6. The Before and After Event messages appear multiple times, in batches of 3 or 4 each. They do not stop until the button is released.
        • Not as expected - expectation is one Before message followed by one After message, and no more.
      7. Place an object that has an interaction, for example a Door.
      8. Interact with the object.
      9. One Before message appears, followed by one After message.
        • Working as expected.

       

        1. Minecraft Preview 30_05_2024 19_09_17.png
          414 kB
          Quaival

            Quaival Quaival
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: