mojira.dev
MCPE-183098

Cancelling water placement doesn't work properly (Script API)

Hey,
I hope this is the right place to report this, but while experimenting with the Script API i found a problem.
When trying to cancel the placement of water using scripting (world.beforeEvents.itemUseOn), it works perfectly fine, unless it is placed on a block that can be waterlogged, there, it will just normally place the water. I've attached a world with a script that allows to test the issue, as well as a video showing the issue
**

How to Reproduce:

  1. Create a world with a behavior pack and add a script that includes the following code (or use the attached world file):

world.beforeEvents.itemUseOn.subscribe((event) => {  
if (event.itemStack.typeId === "minecraft:water_bucket") { 
event.cancel = true; 
} 
});
  1. Join the world and try placing water, you will see the expected result

  2. Try placing water on a waterloggable block (fence, slab, etc.)

Observed Result:
The waterloggable block will be waterlogged, even though the item use was cancelled.
Expected Result:
The waterloggable block should not be waterlogged.

Attachments

Comments 2

Confirmed in Android 

powh

(Unassigned)

1429021

Community Consensus

Multiple

Windows 11

Script-API

1.21.0

Retrieved