water damage tweaks, using php8 pack functions

This commit is contained in:
GameHerobrine 2024-01-01 08:15:05 +03:00
parent 229a563ff5
commit 68b8232f07
17 changed files with 46 additions and 76 deletions

View file

@ -336,7 +336,7 @@ class Level{
}
}
public function onTick(PocketMinecraftServer $server){
public function onTick(PocketMinecraftServer $server, $currentTime){
//$ents = $server->api->entity->getAll($this);
if(!$this->stopTime) ++$this->time;
for($cX = 0; $cX < 16; ++$cX){
@ -368,7 +368,7 @@ class Level{
++$this->totalMobsAmount;
}
if($e->isPlayer() || $e->needsUpdate){
$e->update();
$e->update($currentTime);
if(!$e->isPlayer()) $post[] = $k;
}
}
@ -417,7 +417,7 @@ class Level{
}
$block->position($pos);
if($direct === true){
$this->addBlockToSendQueue($pos->x, $pos->y, $pos->z, $pos->id, $pos->meta);
$this->addBlockToSendQueue($pos->x, $pos->y, $pos->z, $block->id, $block->meta);
}else{
$i = ($pos->x >> 4) . ":" . ($pos->y >> 4) . ":" . ($pos->z >> 4);
if(!isset($this->changedBlocks[$i])){

View file

@ -132,7 +132,7 @@ class SuperflatGenerator implements LevelGenerator{
$end = 128 + $spawn[0];
for($x = $start; $x <= $end; ++$x){
for($z = $start; $z <= $end; ++$z){
if(floor(sqrt(pow($x - 128, 2) + pow($z - 128, 2))) <= $spawn[0]){
if(floor(sqrt(($x - 128)*($x - 128)+ ($z - 128)*($z - 128))) <= $spawn[0]){
$this->level->setBlockRaw(new Vector3($x, $this->floorLevel - 1, $z), $spawn[1], null);
}
}