mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-02 16:23:04 +00:00
Player: return from callback if used chunk status is not REQUESTED_GENERATION()
this can happen especially on large render distances when flying fast and changing direction - we decide we don't want the chunk, then, after changing direction and re-ordering chunks, we decide we do want it again, and end up registering a second callback. In this case, we need to ensure that only one of the callbacks gets executed (it doesn't matter which one).
This commit is contained in:
@ -687,7 +687,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!$this->usedChunks[$index]->equals(UsedChunkStatus::REQUESTED_GENERATION())){
|
if(!$this->usedChunks[$index]->equals(UsedChunkStatus::REQUESTED_GENERATION())){
|
||||||
throw new AssumptionFailedError("Used chunk status should not have changed while in REQUESTED_GENERATION mode");
|
//We may have previously requested this, decided we didn't want it, and then decided we did want
|
||||||
|
//it again, all before the generation request got executed. In that case, the promise would have
|
||||||
|
//multiple callbacks for this player. In that case, only the first one matters.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$this->usedChunks[$index] = UsedChunkStatus::REQUESTED_SENDING();
|
$this->usedChunks[$index] = UsedChunkStatus::REQUESTED_SENDING();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user