Mojira Archive
MCPE-182172

Event playerInteractWithBlock called multiple times

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.

 

Unresolved

Quaival

2024-05-30, 09:32 PM

2024-06-05, 05:13 PM

3

2

Confirmed

1246351

Script-API

1.21.10.21 Preview

-