PhiPro and I did some investigation into the cause of this bug and think we know both the cause and an easy fix. This hopefully also resolves MC-142214 and MC-142332. The basic issue is that when the client processes a ChunkDataClientPacket it does not properly remove the tile entities that are in that chunk. In particular, the tile entities are left in a few key lists like World.tickingBlockEntities, and therefore they continue to tick and produce smoke. This can lead to many duplicated tile entities at the same location (causing lag by creating many particles) or smoke particles being created from blocks that no longer contain campfires. In agreement with the other bug reports, this requires many blocks within the same chunk as the campfire to be updated (to trigger the ChunkDataClientPacket).
The relevant code is below (using the mappings from fabric for 19w05a):
In WorldChunk.method_12224(PacketByteBuf, CompoundTag, int, boolean), (called by ClientPlayNetworkHandler.onChunkData > ClientChunkManager.method_16020 > WorldChunk.method_12224) the following code appears:
This code removes the entities from the chunk's block entity map, but leaves them in a few important lists. To fix this, we should call world.removeBlockEntity on the positions for each of the tile entities instead of using the iterator.remove method. To avoid ConcurrentModificationException s, one possibility is to make a list of the affected coordinates. Alternatively, it might be possible to call world.removeBlockEntity immediately after iterator_1.remove()
PhiPro and I did some investigation into the cause of this bug and think we know both the cause and an easy fix. This hopefully also resolves MC-142214 and MC-142332. The basic issue is that when the client processes a ChunkDataClientPacket it does not properly remove the tile entities that are in that chunk. In particular, the tile entities are left in a few key lists like World.tickingBlockEntities, and therefore they continue to tick and produce smoke. This can lead to many duplicated tile entities at the same location (causing lag by creating many particles) or smoke particles being created from blocks that no longer contain campfires. In agreement with the other bug reports, this requires many blocks within the same chunk as the campfire to be updated (to trigger the ChunkDataClientPacket).
The relevant code is below (using the mappings from fabric for 19w05a):
In
WorldChunk.method_12224(PacketByteBuf, CompoundTag, int, boolean)
, (called byClientPlayNetworkHandler.onChunkData
>ClientChunkManager.method_16020
>WorldChunk.method_12224
) the following code appears:This code removes the entities from the chunk's block entity map, but leaves them in a few important lists. To fix this, we should call
world.removeBlockEntity
on the positions for each of the tile entities instead of using theiterator.remove
method. To avoidConcurrentModificationException s, one possibility is to make a list of the affected coordinates. Alternatively, it might be possible to call world.removeBlockEntity
immediately afteriterator_1.remove()