From 92e56c60491fdf4427761c7199dcd999f28ea832 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sat, 9 Dec 2023 20:19:53 +0300 Subject: [PATCH] small php8 tweaks --- src/entity/animal/Sheep.php | 2 +- src/world/Level.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/entity/animal/Sheep.php b/src/entity/animal/Sheep.php index c6bbbf50..5159c3b7 100644 --- a/src/entity/animal/Sheep.php +++ b/src/entity/animal/Sheep.php @@ -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){ diff --git a/src/world/Level.php b/src/world/Level.php index a9dff4b0..c63f18c8 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -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);