mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-21 21:20:04 +00:00
Check if the destination chunk exists after leaving the source chunk
This fixes a crash if a player does a /refresh in the zeroeth chunk.
This commit is contained in:
parent
1c3e1d83de
commit
2658ed5900
@ -161,12 +161,13 @@ static void emptyChunk(ChunkPos chunkPos) {
|
||||
void Chunking::updateEntityChunk(const EntityRef& ref, ChunkPos from, ChunkPos to) {
|
||||
Entity* ent = ref.getEntity();
|
||||
|
||||
// move to other chunk's player set
|
||||
untrackEntity(from, ref); // this will delete the chunk if it's empty
|
||||
|
||||
// if the new chunk doesn't exist, make it first
|
||||
if (!chunkExists(to))
|
||||
newChunk(to);
|
||||
|
||||
// move to other chunk's player set
|
||||
untrackEntity(from, ref); // this will delete the chunk if it's empty
|
||||
trackEntity(to, ref);
|
||||
|
||||
// calculate viewable chunks from both points
|
||||
|
Loading…
Reference in New Issue
Block a user