mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +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);
|
$middleOffsetX = $scale * ($radius + $offsetX);
|
||||||
$middleOffsetZ = $scale * ($radius + $offsetZ);
|
$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;
|
$frame = 0;
|
||||||
$seen = [];
|
$seen = [];
|
||||||
while($iterator->valid()){
|
while($iterator->valid()){
|
||||||
$frame++;
|
$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){
|
for($i = 0; $i < $chunksPerStep; ++$i){
|
||||||
$chunkHash = $iterator->current();
|
$chunkHash = $iterator->current();
|
||||||
if(!isset($seen[$chunkHash])){
|
if(!isset($seen[$chunkHash])){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user