mojira.dev
MC-95720

Client-server desync on seemingly invalid block placement

Placing a block in a position that is valid according to the client but invalid according to the server will make it disappear from the client-side inventory until the inventory spot where it was gets manually updated.
Instead, the server should tell the client that removing that item from the inventory client-side to mask lag was an incorrect action because the block didn't get placed.
Alternatively the underlying issue could be fixed that makes the server consider the block placement in these cases invalid in the first place, because it is never actually invalid block placement when this happens, but appears to be an interpolation issue.

This is an issue that has been present since the SMP/SSP-merge in Minecraft 1.3.1 and happens in survival all the time. However, it usually goes by unnoticed in survival because of the figures. (One in a stack of 30+ items missing isn't very obvious, especially if it gets added again as soon as you place another item from that stack.)
It is a huge issue in custom maps with a limited amount of blocks though.

New steps to reproduce in written form:
(see attached gif)
1. Get a block
2. Look down at an angle and sneak
3. Spam right click to make block placement attempts inside you while slowly moving backwards
4. Stop spamming right click as soon as the block disappears from your inventory but didn't get placed

Old steps to reproduce in video form:
https://youtu.be/HF9xrRwrNcA
Because of the seemingly random nature of this issue, I decided to make a video on how to reproduce it with relative consistency, as following written steps to reproduce could easily lead to the assumption that it is not reproducible.

Old steps to reproduce in written form:
1. Create some sort of stress for your server (can be singleplayer).
Frequent lighting updates work great. The more stress on your server, the more often you will be able to reproduce the issue. Note however that this can and does happen — albeit more rarely — without any stress on the server whatsoever.
2. Run towards a block
3. Place a block onto the block you are running towards right before you actually hit it.
4. Result: The block you should have placed didn't get placed, but is still missing from your client-side inventory.
Technically though it is still in your inventory and updating the inventory spot where it should be (by dropping it, clicking it, attempting to place it or by relogging) will make it re-appear.

Important:
This desync can and does happen in cases very different from the case in the steps to reproduce. It can and does happen on a flat floor, it can and does happen on ceilings and if there is a lot of stress on the server it can and does happen when you attempt to place blocks more than one block away from your character. The cases in the steps to reproduce are just the cases that are the easiest to reproduce.

Update:
-added gif to show that this still is an issue in the current version (16w44a)

Linked issues

MC-99148 When placing a block near to current position, the block is lost Resolved MC-117995 Shulker Box Vanishing Glitch Resolved MC-119324 Piston Disappearing Resolved MC-164239 Bed error when placing in a 2x1 place Resolved MC-174581 Placed blocks disappear Resolved

Attachments

Comments 26

Brian McNamara

Sound related to MC-12363

haschischtasche

Sound related to MC-12363

I guess it is a similar sort of desync as the end result is identical (wrong client-side inventory), and I can see an additional "update your inventory, client!"-message after the client failed to perform an action "band-aid-fixing" both issues.

But this report is about specific instances where the server thinks you couldn't place a block because you tried to place it inside your character model even though that can clearly not be the case, which is something that shouldn't happen in the first place, even if the band-aid-fix still makes sense. 😉

Relates to MC-99075

Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.

This is an automated comment on any open or reopened issue with out-of-date affected versions.

haschischtasche

Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.

Updated it. Again, (in singleplayer) this happens in any version since the 1.3.1 SSP/SMP merge.

16 more comments

Can confirm in Pre-release 4

The issue shown in the video using cobweb.mp4 is MC-224949.

Can confirm in 1.17.1.

Affects 1.18.2-pre1.

FlyingTiger1601

Affects 1.19

haschischtasche

(Unassigned)

Confirmed

Platform

Important

Networking

block, client, place, server

Minecraft 1.8.9, Minecraft 16w02a, Minecraft 1.9, Minecraft 1.10.2, Minecraft 16w43a, ..., 1.17.1, 1.18.1, 1.18.2 Pre-release 1, 1.19, 1.21

Retrieved