php8 explosion fixes

This commit is contained in:
GameHerobrine 2022-12-26 03:20:33 +03:00
parent 2cdf3ca8da
commit 6086c80dad
3 changed files with 17 additions and 3 deletions

View file

@ -18,6 +18,8 @@ class EntityAI
public $lastTask;
public $counter = 0;
public function __construct($entity){
$this->entity = $entity;
$this->tasks = [];
@ -47,6 +49,9 @@ class EntityAI
}
public function updateTasks(){
if($this->counter % 3 != 0){
return;
}
foreach($this->tasks as $t){
if(!$t->isStarted && $t->canBeExecuted($this)){
$t->isStarted = true;

View file

@ -332,7 +332,12 @@ class PMFLevel extends PMF{
$aX = $x - ($X << 4);
$aZ = $z - ($Z << 4);
$aY = $y - ($Y << 4);
$b = ord($this->chunks[$index][$Y][(int) ($aY + ($aX << 5) + ($aZ << 9))]);
if(is_array($this->chunks) && is_array($this->chunks[$index]) && is_string($this->chunks[$index][$Y])){
$b = ord($this->chunks[$index][$Y][(int) ($aY + ($aX << 5) + ($aZ << 9))]);
}else{ //php8 fix
$b = 0;
}
return $b;
}
@ -372,7 +377,12 @@ class PMFLevel extends PMF{
$aX = $x - ($X << 4);
$aZ = $z - ($Z << 4);
$aY = $y - ($Y << 4);
$m = ord($this->chunks[$index][$Y][(int) (($aY >> 1) + 16 + ($aX << 5) + ($aZ << 9))]);
if(is_array($this->chunks) && is_array($this->chunks[$index]) && is_string($this->chunks[$index][$Y])){
$m = ord($this->chunks[$index][$Y][(int) (($aY >> 1) + 16 + ($aX << 5) + ($aZ << 9))]);
}else{ //php8 fix
$m = 0;
}
if(($y & 1) === 0){
$m = $m & 0x0F;
}else{

View file

@ -20,7 +20,6 @@ class MobSpawner{
}
public function handle(){
return false;
if($this->countEntities() > self::MOB_LIMIT || count($this->level->players) <= 0){
return false; //not spawning
}