mojira.dev
MC-238384

Entity id AtomicInteger is shared between client rendering and integrated server

net.minecraft.entity uses an AtomicInteger to set an entity's id in the constructor. However, this AtomicInteger is also incremented by the client rendering thread when a new entity is created. Due to multi-threading of rendering and integrated server this causes inconsistent behavior when compared with a dedicated server and connected client.

This issue can by solved by either not incrementing the CURRENT_ID AtomicInteger when an entity is created by the rendering thread, or by giving the client and server separate counters, as is the case with a dedicated server and client.

https://youtu.be/hr-twzxs6FM highlights why the entity id matters and the inconsistency between integrated and dedicated servers.

Comments 6

This bug needs to be fixxed!

There is some code discussion in this follow-up video.

An inconsistency like this in behaviour between single-player and multiplayer worlds shouldn't exist!
I support the resolution of this bug.

Seems like a very simple fix, that will help players a lot!

This bug is still present in the latest version, and fixing it would be very helpful to players building wireless systems using the new chunkloading rules.

Morgan Lewis

(Unassigned)

Community Consensus

Platform

Normal

Entities

1.17.1

Retrieved