mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 05:20:05 +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) {
|
void Chunking::updateEntityChunk(const EntityRef& ref, ChunkPos from, ChunkPos to) {
|
||||||
Entity* ent = ref.getEntity();
|
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 the new chunk doesn't exist, make it first
|
||||||
if (!chunkExists(to))
|
if (!chunkExists(to))
|
||||||
newChunk(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);
|
trackEntity(to, ref);
|
||||||
|
|
||||||
// calculate viewable chunks from both points
|
// calculate viewable chunks from both points
|
||||||
|
Loading…
Reference in New Issue
Block a user