Minecraft 1.8.9, Minecraft 16w02a, Minecraft 1.9, Minecraft 1.10.2, Minecraft 16w43a, Minecraft 16w44a, Minecraft 1.11 Pre-Release 1, Minecraft 1.12, 1.14.4, 1.15.2, 1.16 Release Candidate 1, 1.16, 1.16.4, 20w48a, 1.16.5, 21w06a, 21w11a, 21w13a, 21w14a, 21w15a, 21w16a, 21w17a, 21w18a, 21w19a, 1.17 Pre-release 4, 1.17, 1.17.1, 1.18.1
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:
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.
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.
-added gif to show that this still is an issue in the current version (16w44a)