mojira.dev
MC-5694

High efficiency tools / fast mining destroys some blocks client-side only

The bug

Mining lots of blocks at once by holding your mouse while equipped with a tool capable of instamining blocks (efficiency 5 diamond shovel vs dirt, for example) will leave some blocks on the server, but the client thinks they're gone.

This bug can occur on a server running 20 TPS constantly. It only occurs when the time to break a block is instant, e.g. with a diamond pickaxe on Nether rack or high-Efficiency diamond shovel on dirt. While the block in question disappears from the client's view (it is not rendered anymore and is removed from clientside collision), the server says it's still there and pushes the players' movement back when the client tries to move within the block's space. This can be a quite tricky and dangerous situation, especially when taking down a pillar below you: You fall into the ghost block again and again (many times a second) and cannot move. Client and server arrive at no consensus over whether the block is still there or not. Reloading the chunks on the client by pressing F3+A does not resolve this. It can be resolved by trying to place a new block in the old location. This of course fails server-side, the new block is not placed, but the old one reappears client-side. It can also be resolved by rejoining the server.

How to reproduce (with provided structure)

Partwise by @unknown

  1. Download the attached structure

[media]
  1. and place it in the structures folder of your world folder

  2. Stand on the command block, and switch your gamemode to Survival

    /gamemode survival
  3. Press the button

  4. Hold down the block breaking key (default: left click) and move forward without rotating
    → The red sandstone block became a ghost-block

How to reproduce

See

[media]

for the video version

  1. Build a two block wide sandstone tower

  2. Give yourself an efficiency pickaxe

    /give @p diamond_pickaxe 1 0 {ench:[{id:32s,lvl:5s}]}
  3. Move to the top of the tower and stand in the middle of the two blocks

  4. Switch to Survival mode

    /gamemode survival
  5. Look at one block

  6. Hold down the block breaking key (default: left click) and move towards the block you are looking at
    → While falling you get stuck in a ghost block

Code analysis

Based on 1.12 decompiled using MCP 9.40 PRE 1

It looks like this bug is caused by the server thinking that the player is not on ground and therefore cannot instamine a block while the client thinks it can. This can be seen when setting a breakpoint in net.minecraft.server.management.PlayerInteractionManager.onBlockClicked(BlockPos, EnumFacing) for the specific block position where a ghost block will be (see "How to reproduce (with provided structure)") and then following the method calls to EntityPlayer.getDigSpeed(IBlockState).

For lagging servers or clients this another cause could likely be the method net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(CPacketPlayerDigging) which is not sending a SPacketBlockChange packet to resync the block if the block position is too far away from the player.


Suggested fix by @unknown can be found in

[media]

; explanation can be found in this comment

Linked issues

MC-1749 You sometimes get stuck on a block Resolved MC-3804 While moving, Steve 'sticks' and can't keep going. Resolved MC-5286 Block Corners Resolved MC-77303 Invisible blocks in singleplayer Resolved MC-91112 Invisible mined block in the nether Resolved

Attachments

Comments 66

Duplicate of MC-858.

Martin Bittermann

Not a duplicate of MC-858.

I can confirm this bug on vanilla 1.8.x servers. This happens often to me when mining blocks with instant-speed in Survival. It's a server-client synchronization issue and has little to nothing to do with lag.

To make the distinction clear: MC-858 describes the internal server having low TPS and therefore registering the block-breaking action from the client very late. This leads to the client re-displaying the block again, until it gets the confirmation from the server that its actually broken, seconds later, or not at all. At the end, the block is either broken or still there, on both client and server.

This bug (MC-5694) is different in that it can occur on a server running 20 TPS constantly. It only occurs when the time to break a block is instant, e.g. with a diamond pickaxe on Nether rack or high-Efficiency diamond shovel on dirt. While the block in question disappears from the client's view (it is not rendered anymore and is removed from clientside collision), the server says it's still there and pushes the players' movement back when the client tries to move within the block's space. This can be a quite tricky and dangerous situation, especially when taking down a pillar below you: You fall into the ghost block again and again (many times a second) and cannot move. Client and server arrive at no consensus over whether the block is still there or not. Reloading the chunks on the client by pressing F3+A does not resolve this. It can be resolved by trying to place a new block in the old location. This of course fails server-side, the new block is not placed, but the old one reappears client-side. It can also be resolved by rejoining the server.
So this is a persistent client-server asynchronicity and must be fixed independently from the (in my opinion) non-bug MC-858.

By the way, MC-7409 is a duplicate of this.

[Mod] redstonehelper

@unknown: Thanks, I split them up and made you the reporter of both tickets since the original reporters are both inactive.

Confirmed for 15w47c

Confirmed for 15w49b

56 more comments

Can confirm, the issue is back in 1.14.4, tested with no mods / full vanilla.

As the other commenters said above me, this bug is back in the game.
Should I make another ticket for it?

Please see MC-156852 if you have this issue in 1.14.4.

Confirmed 1.15.2

Both this issue and a clone of it (MC-156852) have been resolved as fixed, in 17w50a and 19w34a respectively. If you're still experiencing it, create a new issue, with updated steps to reproduce, please.

Martin Jensinger

Martin Bittermann

Erik Broes

Confirmed

block-breaking, client-side, efficiency, ghost-block, haste

Minecraft 1.4.6, Minecraft 15w42a, Minecraft 15w47a, Minecraft 15w49b, Minecraft 15w50a, ..., Minecraft 1.12 Pre-Release 7, Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2

Minecraft 17w50a

Retrieved