Closed Tides closed 11 months ago
Crash when loading a world from disk EDIT: nvm... seems fine after a clean
:eyes:
Crash when loading a world from disk EDIT: nvm... seems fine after a clean
Average obsidian update experience
I was not aware of priorityqueue being a thing, cool!
This is a refactoring of Server, WorldManager and packet broadcasting. Abstracting them out further and removing a lot of circular dependencies.
Notable Changes:
WorldManager is now a hosted service. It will load or generate specified worlds right after the server itself is started and also manage every loaded world chunk on its own loop. Note that this doesn't tick worlds, as that still handled within the main server loop
Packet broadcasting is no longer handled by the server class and is now handled by the PacketBroadcaster class & registered as a hosted service as well for priority queuing & sending packets. There are methods to skip the queue and directly send packets to clients if needed. This is the first iteration and needs more discussion.
Entities no longer depend directly on the server to broadcast packets & will inherit the packet broadcaster service from their respective worlds. With this change, we'll have to implement more methods to do specific things (like rotating an entity's head) and not do any packet broadcasting outside of the entity class and serverbound packets.
I planned to also include the plugin manager refactor here but since its as big as these first couple changes so I left it out (#377) ~
I believe these changes are pushing the server further to be more clean and concise while tackling (#185). The end goal is to depend more on Microsoft's hosting extensions and not be overwhelmed overall.