Make Block->position() accept Level,x,y,z instead of Position

since this is an internal method, it doesn't make sense to force a single parameter that requires potentially constructing a separate object just for the parameters, so we pass primitives instead, which are also easier to typehint against.
This commit is contained in:
Dylan K. Taylor
2018-12-03 21:18:22 +00:00
parent c3623478c1
commit 9fb365306a
3 changed files with 16 additions and 17 deletions

View File

@ -29,7 +29,6 @@ use pocketmine\block\Fallable;
use pocketmine\entity\Entity;
use pocketmine\event\entity\EntityBlockChangeEvent;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\level\Position;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
@ -95,9 +94,9 @@ class FallingBlock extends Entity{
$hasUpdate = parent::entityBaseTick($tickDiff);
if(!$this->isFlaggedForDespawn()){
$pos = Position::fromObject($this->add(-$this->width / 2, $this->height, -$this->width / 2)->floor(), $this->getLevel());
$pos = $this->add(-$this->width / 2, $this->height, -$this->width / 2)->floor();
$this->block->position($pos);
$this->block->position($this->level, $pos->x, $pos->y, $pos->z);
$blockTarget = null;
if($this->block instanceof Fallable){