mojira.dev
MCPE-190830

beforeEvents could cause fake water

Description

Through SAPI, we can cancel the occurrence of an event, but this does not work when the bucket is used for waterlogged blocks.

Even after the water bucket used on the waterlogged blocks and was cancelled, it still "placed" a fake water.

The main behavior of fake water are:

  1. it can't place air by /fill, /setblock, etc.;

  2. it can't flow;

  3. it can't be taken back by buckets;

  4. SAPI reads that the blocks that has fake water is isWaterlogged: false

  5. but it can slow down the players.

How to reproduce

Use SAPI @minecraft/[email protected]or higher version, and use the code below:

world.beforeEvents.playerInteractWithBlock.subscribe( event => {
    if ( event.itemStack.typeId === "minecraft:water_bucket" ) {
        event.cancel = true;
    }
} )

this will cause the event that place the water cancelled. If you place on a normal block, it will cancel the event correctly. but if you place it on a waterlogged block(like slabs, stairs), a fake water will be placed. Even you break that block, the water still keeps there.

Expected Behavior

If you place it on a waterlogged block, the event should be completely cancelled and no fake water should be there.

A Temporary Solution

Until this bug is fixed, we can set this block waterlogged and then not waterlogged, like:

world.beforeEvents.playerInteractWithBlock.subscribe( event => {
    if ( event.itemStack.typeId === "minecraft:water_bucket" ) {
        event.cancel = true;
        const block = event.block;
        system.run( () => {
            try {
                block.setWaterlogged(true);
                block.setWaterlogged(false);
            } catch {}
        } )
    }
} )

Hope this bug could be fixed soon!

Comments 1

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Could you please attach an addon showcasing the issue?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

YZBWDLT

(Unassigned)

Plausible

Multiple

Windows 11 24H2

1.21.62 Hotfix

Retrieved