mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +00:00
server can send 16x16x16 chunks instead of 256x16x16 now
This commit is contained in:
parent
4544b7bb63
commit
6d1d7cb8a5
2 changed files with 30 additions and 9 deletions
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
class Player{
|
class Player{
|
||||||
|
|
||||||
|
public static $smallChunks = false;
|
||||||
|
|
||||||
public $data;
|
public $data;
|
||||||
/** @var Entity */
|
/** @var Entity */
|
||||||
public $entity = false;
|
public $entity = false;
|
||||||
|
|
@ -413,19 +415,36 @@ class Player{
|
||||||
}
|
}
|
||||||
$X = ((int)$this->entity->x) >> 4;
|
$X = ((int)$this->entity->x) >> 4;
|
||||||
$Z = ((int)$this->entity->z) >> 4;
|
$Z = ((int)$this->entity->z) >> 4;
|
||||||
$v = new Vector2($X, $Z);
|
|
||||||
$this->chunksOrder = [];
|
$this->chunksOrder = [];
|
||||||
for($x = 0; $x < 16; ++$x){
|
if(self::$smallChunks){
|
||||||
for($z = 0; $z < 16; ++$z){
|
$Y = ((int)$this->entity->y) >> 4;
|
||||||
$dist = $v->distance(new Vector2($x, $z));
|
$v = new Vector3($X, $Y, $Z);
|
||||||
for($y = 0; $y < 8; ++$y){
|
for($x = 0; $x < 16; ++$x){
|
||||||
$d = $x . ":" . $y . ":" . $z;
|
for($z = 0; $z < 16; ++$z){
|
||||||
if(!isset($this->chunksLoaded[$d])){
|
for($y = 0; $y < 8; ++$y){
|
||||||
$this->chunksOrder[$d] = $dist;
|
$dist = $v->distance(new Vector3($x, $y, $z));
|
||||||
|
$d = $x . ":" . $y . ":" . $z;
|
||||||
|
if(!isset($this->chunksLoaded[$d])){
|
||||||
|
$this->chunksOrder[$d] = $dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$v = new Vector2($X, $Z);
|
||||||
|
for($x = 0; $x < 16; ++$x){
|
||||||
|
for($z = 0; $z < 16; ++$z){
|
||||||
|
$dist = $v->distance(new Vector2($x, $z));
|
||||||
|
for($y = 0; $y < 8; ++$y){
|
||||||
|
$d = $x . ":" . $y . ":" . $z;
|
||||||
|
if(!isset($this->chunksLoaded[$d])){
|
||||||
|
$this->chunksOrder[$d] = $dist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
asort($this->chunksOrder);
|
asort($this->chunksOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,10 @@ class PocketMinecraftServer{
|
||||||
"discord-bot-name" => "NostalgiaCore Logger",
|
"discord-bot-name" => "NostalgiaCore Logger",
|
||||||
"despawn-mobs" => true,
|
"despawn-mobs" => true,
|
||||||
"mob-despawn-ticks" => 18000,
|
"mob-despawn-ticks" => 18000,
|
||||||
|
"16x16x16_chunk_sending" => false
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
Player::$smallChunks = $this->extraprops->get("16x16x16_chunk_sending");
|
||||||
Living::$despawnMobs = $this->extraprops->get("despawn-mobs");
|
Living::$despawnMobs = $this->extraprops->get("despawn-mobs");
|
||||||
Living::$despawnTimer = $this->extraprops->get("mob-despawn-ticks");
|
Living::$despawnTimer = $this->extraprops->get("mob-despawn-ticks");
|
||||||
Entity::$allowedAI = $this->extraprops->get("enable-mob-ai");
|
Entity::$allowedAI = $this->extraprops->get("enable-mob-ai");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue