mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-03 10:32:33 +00:00
simulate-chunk-selector: do not reallocate colours on every frame
This commit is contained in:
parent
4c3a5fdd73
commit
8abc952c74
@ -57,16 +57,16 @@ function render(int $radius, int $baseX, int $baseZ, int $chunksPerStep, int $sc
|
||||
$middleOffsetX = $scale * ($radius + $offsetX);
|
||||
$middleOffsetZ = $scale * ($radius + $offsetZ);
|
||||
|
||||
$black = imagecolorallocate($image, 0, 0, 0);
|
||||
$yellow = imagecolorallocate($image, 255, 255, 51);
|
||||
$red = imagecolorallocate($image, 255, 0, 0);
|
||||
if($black === false || $yellow === false || $red === false) throw new AssumptionFailedError();
|
||||
|
||||
$frame = 0;
|
||||
$seen = [];
|
||||
while($iterator->valid()){
|
||||
$frame++;
|
||||
|
||||
$black = imagecolorallocate($image, 0, 0, 0);
|
||||
$yellow = imagecolorallocate($image, 255, 255, 51);
|
||||
$red = imagecolorallocate($image, 255, 0, 0);
|
||||
if($black === false || $yellow === false || $red === false) throw new AssumptionFailedError();
|
||||
|
||||
for($i = 0; $i < $chunksPerStep; ++$i){
|
||||
$chunkHash = $iterator->current();
|
||||
if(!isset($seen[$chunkHash])){
|
||||
|
Loading…
x
Reference in New Issue
Block a user