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

event playerInteractWithBlock being emitted more than once

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • None
    • 1.20.50.21 Preview
    • None
    • Unconfirmed
    • Windows

      When the event playerInteractWithBlock is emitted, it emits more than once for only one subscription
      I wrote the following code

       
      import {world} from "@minecraft/server";
      let i = 0;
      world.afterEvents.playerInteractWithBlock.subscribe(ev=>{
          world.sendMessage(`Hello ${i++}`);
      });
       
      When triggering the event, it emits about 4~5 times in a row(i had causes that it emitted 10 times in a row), which causes unexpected behavior and possibly lag. I don't understand exactly what happens cause when I have a holdeable item in hand it emits once, but if not, on average, it emits 4 times

            Cycro2636 Cycro2636
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: