small php8 tweaks

This commit is contained in:
GameHerobrine 2023-12-09 20:19:53 +03:00
parent ad8cbb81ff
commit 92e56c6049
2 changed files with 5 additions and 2 deletions

View file

@ -37,7 +37,7 @@ class Sheep extends Animal{
$pk->event = EntityEventPacket::ENTITY_ANIM_10;
$this->server->api->player->broadcastPacket($this->level->players, $pk);
$this->server->schedule(38, [$this, "setSheared"], false);
$this->level->setblock(new Position($this->x, $this->y-1, $this->z, $this->level), new DirtBlock());
$this->level->setBlock(new Position($this->x, $this->y-1, $this->z, $this->level), new DirtBlock());
}
public function setSheared($v = null){

View file

@ -504,10 +504,13 @@ class Level{
}
public function setBlock(Vector3 $pos, Block $block, $update = true, $tiles = false, $direct = false){
$pos->x = (int)$pos->x;
$pos->y = (int)$pos->y;
$pos->z = (int)$pos->z;
if(!isset($this->level) or (($pos instanceof Position) and $pos->level !== $this) or $pos->y < 0){
return false;
}
$ret = $this->level->setBlock($pos->x, $pos->y, $pos->z, $block->getID(), $block->getMetadata());
$ret = $this->level->setBlock((int)$pos->x, (int)$pos->y, (int)$pos->z, $block->getID(), $block->getMetadata());
if($ret === true){
if(!($pos instanceof Position)){
$pos = new Position($pos->x, $pos->y, $pos->z, $this);