mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Fully deserialise persistent anger post async load (#8560)
The modified patch prevents entity loading off the main thread when entities are initially loaded. However, the initial loading of an entity is not the only time the Entity#readAdditionalSaveData method is called. Commands like /data also invoke the method (through Entity#load) to update an entities data without completely re-creating it. This however breaks with the current patch, as the patch moves parts of the entity lookup for persistent anger deserialisation into the first tick of an entity (which obviously is only called once and hence not re-run when an already ticking entity is modified as laid out above). This change actively runs the now split logic for deserialisation again if the entity has already ticked its first tick. This way, initial deserialisation is still split into one off thread and the first tick parts, but following main thread deserialisations can happen completely inside Entity#readAdditionalSaveData is called.
This commit is contained in:
parent
b9401e6d3c
commit
ce991b96eb
@ -37,6 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
-
|
||||
- }
|
||||
+ // Paper - Moved diff to separate method
|
||||
+ // If this entity already survived its first tick, e.g. is loaded and ticked in sync, actively
|
||||
+ // tick the initial persistent anger.
|
||||
+ // If not, let the first tick on the baseTick call the method later down the line.
|
||||
+ if (this instanceof Entity entity && !entity.firstTick) this.tickInitialPersistentAnger(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user