AtomicStryker / atomicstrykers-minecraft-mods

Repository for my open source Minecraft Mods
https://atomicstryker.github.io/
181 stars 97 forks source link

Multi Mine: Breaking water-logged block and replacing it causes new block to drop #520

Closed MarioSMB closed 2 months ago

MarioSMB commented 2 months ago

When I break a waterlogged block, I'm able to place a new block in that location, but as soon as I switch to a pickaxe the new block suddenly gets broken.

Here is a video demonstrating the behaviour:
https://youtu.be/Tbkba87bST8

I don't have to be looking at the block for it to be broken when I switch back to the pickaxe.

AtomicStryker commented 2 months ago

It doesn't appear to have anything to do with switching or the pickaxe. If i break a waterlogged block and place another block, then wait a second, it disappears.

Debugger says this is ServerPlayer.gameMode ticking and executing a delayed block break. This is a side effect of the last fix ... in blocking destroyBlock, i prevent the server from resetting its own internal block destruction from 100% to 0. So for every level tick, it keeps trying to destroy the last targeted block.

That logic has a sanity reset itself, but that only works if the target block has become air, and this is not the case here because the broken waterlogged block became partially water. It's basically a vanilla bug triggered by my doing...

The fix is Multi Mine hacking into this serverside block tracking and resetting it.

AtomicStryker commented 2 months ago

https://github.com/AtomicStryker/atomicstrykers-minecraft-mods/commit/0f4fad98d897809faf2440e6ad54d5c48a49acb6

MarioSMB commented 2 months ago

Thank you for the quick developments, I've given that a test along with the Exchanging modifier and so far haven't encountered any further issues.