Affects Version/s: Minecraft 1.11.2, Minecraft 1.13, Minecraft 1.13.2, Minecraft 1.14.3, 1.15.2, 20w06a, 20w07a, 20w12a, 1.16 Pre-release 3, 1.16 Release Candidate 1, 1.16, 1.16.1, 1.16.2, 1.16.3, 1.16.4 Pre-release 1
Fix Version/s: None
Item entities turn invisible when dropped on the ground. The problem is intermittent, and I haven't found a way to reliably reproduce it. It doesn't seem to matter where the item entity comes from.
I've had items turn invisible both when tossing them out of my inventory and when being dropped from broken blocks.
It doesn't seem to matter what the item is. I've had it happen with seeds, lily pads and shulker boxes. The shulker boxes are especially worrying, because one invisible shulker box can result in the loss of a lot of valuable materials.
Code analysis. This bug is a continuation of
MC-11834, and also a race condition, so it's hard to consistently reproduce. One way to force it to happen is to set a breakpoint in the entity metadata packet handler, and then resume the main thread. This can be a bit awkward to set up, though:
- Set up and start a server (superflat is the easiest). Disable mob spawning, and kill all entities (due to
MC-51732this will need to be repeated a few times to eliminate slimes).
- Add -agentlib:jdwp=transport=dt_shmem,address=minecraft,server=y,suspend=n to the client JVM arguments.
- Launch the client.
- Open a command line, and run jdb -attach minecraft.
- In JDB, type threads and verify that (java.lang.Thread)0x1 Render thread running appears (that "Render thread" has ID 1).
- Connect to the server, and wait a few seconds.
- In JDB, type stop at ra:11 (where ra is ClientboundSetEntityDataPacket as of 1.16.4-pre1, and line 11 is handle). Note that this means that any entity metadata change will trigger the breakpoint, which includes sneaking and sprinting. If this is accidentally triggered, you will need to run resume several times.
- Spawn an item. This can be done by breaking a block or tossing an item in your inventory. Make sure that the item will land far enough away that it won't be picked up immediately.
- The game will freeze with the breakpoint hit in thread=Netty Client IO #2 (or similar).
- Type resume 1 in JDB to resume the render thread (which should advance one frame and then freeze again, or may unfreeze the game completely). This specifically needs to be done to ensure the item gets ticked before entity metadata is received, and is what actually reproduces the race condition.
- After a second, type resume to resume all threads. JDB will immediately say that the breakpoint was hit in thread=Render thread; type resume a second time to resume it.
- There will now be an invisible dropped item. Walking into it will still add it to the inventory.