mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
more chunk loading tweaks
This commit is contained in:
parent
c9eadcb15a
commit
16ba004fd6
2 changed files with 16 additions and 11 deletions
|
|
@ -412,7 +412,6 @@ class Player{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
asort($this->chunksOrder);
|
asort($this->chunksOrder);
|
||||||
var_dump($this->chunksOrder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadAllChunks(){
|
public function loadAllChunks(){
|
||||||
|
|
@ -945,7 +944,7 @@ class Player{
|
||||||
$pk->z = $this->z;
|
$pk->z = $this->z;
|
||||||
$pk->spawnX = $spwnPos->x;
|
$pk->spawnX = $spwnPos->x;
|
||||||
$pk->spawnY = $spwnPos->y;
|
$pk->spawnY = $spwnPos->y;
|
||||||
$pk->spwnZ = $spwnPos->z;
|
$pk->spawnZ = $spwnPos->z;
|
||||||
$pk->generator = 0; //TODO multiple generators
|
$pk->generator = 0; //TODO multiple generators
|
||||||
$pk->gamemode = $this->gamemode & 0x01;
|
$pk->gamemode = $this->gamemode & 0x01;
|
||||||
$pk->eid = 0;
|
$pk->eid = 0;
|
||||||
|
|
@ -1407,9 +1406,9 @@ class Player{
|
||||||
}
|
}
|
||||||
$pk = new StartGamePacket;
|
$pk = new StartGamePacket;
|
||||||
$pk->seed = $this->level->getSeed();
|
$pk->seed = $this->level->getSeed();
|
||||||
$pk->spawnX = (int) $this->entity->x;
|
$pk->spawnX = (int) $spawnPos->x;
|
||||||
$pk->spawnY = (int) $this->entity->y;
|
$pk->spawnY = (int) $spawnPos->y;
|
||||||
$pk->spawnZ = (int) $this->entity->z;
|
$pk->spawnZ = (int) $spawnPos->z;
|
||||||
$pk->x = (int) $this->entity->x;
|
$pk->x = (int) $this->entity->x;
|
||||||
$pk->y = (int) $this->entity->x;
|
$pk->y = (int) $this->entity->x;
|
||||||
$pk->z = (int) $this->entity->x;
|
$pk->z = (int) $this->entity->x;
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ class Level{
|
||||||
|
|
||||||
|
|
||||||
public function getOrderedFullChunk($X, $Z){
|
public function getOrderedFullChunk($X, $Z){
|
||||||
|
$X = (int)$X;
|
||||||
|
$Z = (int)$Z;
|
||||||
//todo: make asynchronous
|
//todo: make asynchronous
|
||||||
if(!isset($this->level)){
|
if(!isset($this->level)){
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -93,7 +95,7 @@ class Level{
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
$gen = !($X > 15 || $X < 0 || $Z > 15 || $Z < 0); //TODO inf Worlds
|
||||||
$orderedIds = "";
|
$orderedIds = "";
|
||||||
$orderedData = "";
|
$orderedData = "";
|
||||||
$orderedSkyLight = str_repeat("\x00", 16*16*64);
|
$orderedSkyLight = str_repeat("\x00", 16*16*64);
|
||||||
|
|
@ -101,14 +103,17 @@ class Level{
|
||||||
$orderedBiomeIds = str_repeat("\x01", 16*16); //all plains, according to PocketMine 1.4 source
|
$orderedBiomeIds = str_repeat("\x01", 16*16); //all plains, according to PocketMine 1.4 source
|
||||||
$orderedBiomeColors = str_repeat("\x00\x85\xb2\x4a", 256); // also PM 1.4
|
$orderedBiomeColors = str_repeat("\x00\x85\xb2\x4a", 256); // also PM 1.4
|
||||||
$tileEntities = "";
|
$tileEntities = "";
|
||||||
$this->level->loadChunk($X, $Z);
|
|
||||||
|
|
||||||
|
if($gen){
|
||||||
|
$this->level->loadChunk($X, $Z);
|
||||||
|
}
|
||||||
$miniChunks = [];
|
$miniChunks = [];
|
||||||
|
|
||||||
for($y = 0; $y < 8; ++$y){
|
for($y = 0; $y < 8; ++$y){
|
||||||
$miniChunks[$y] = $this->level->getMiniChunk($X, $Z, $y);
|
$miniChunks[$y] = $gen ? $this->level->getMiniChunk($X, $Z, $y) : str_repeat("\x00", 8192);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for ($i = 0; $i < 16; $i++){
|
for ($i = 0; $i < 16; $i++){
|
||||||
for ($j = 0; $j < 16; $j++){
|
for ($j = 0; $j < 16; $j++){
|
||||||
$bIndex = ($i << 5) + ($j << 9);
|
$bIndex = ($i << 5) + ($j << 9);
|
||||||
|
|
@ -229,6 +234,7 @@ class Level{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function useChunk($X, $Z, Player $player){
|
public function useChunk($X, $Z, Player $player){
|
||||||
|
if($X > 15 || $X < 0 || $Z > 15 || $Z < 0) return; //TODO inf worlds
|
||||||
if(!isset($this->usedChunks[$X . "." . $Z])){
|
if(!isset($this->usedChunks[$X . "." . $Z])){
|
||||||
$this->usedChunks[$X . "." . $Z] = [];
|
$this->usedChunks[$X . "." . $Z] = [];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue