mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
small php8 tweaks
This commit is contained in:
parent
ad8cbb81ff
commit
92e56c6049
2 changed files with 5 additions and 2 deletions
|
|
@ -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){
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue