When chunk is loaded, block entities are added into manager one by one #1720
Labels
Topic: Architecture
Requests, Issues and Changes related to software architecture, programming patterns, etc.
Type: Bug
Issues reporting and PRs fixing problems
When a chunk is loaded, I believe what is happening is (pseudo code):
for (EntityData entity : chunkEntityData) {
addEntityToBlockEntityRegistry(entity);
callOnActivatedEventsOnTheEntity(entity);
}
As a result, if the OnActivatedComponent event listener asks for another entity that is in that chunk, and has not been added to the BlockEntityRegistry yet, it will get a default entity from the block at that position, which might (and most likely will) have different values.
What should be happening instead (IMO) is:
for (EntityData entity : chunkEntityData) {
addEntityToBlockEntityRegistry(entity);
}
for (EntityData entity: chunkEntityData) {
callOnActivatedEventsOnTheEntity(entity);
}
So, the events should be called after all the block entities in that chunk have been added to the registry.
The text was updated successfully, but these errors were encountered: