Refactor Block & Tile: getPos() to getPosition() (#4395)

this also changes the name of the class property 'pos' to 'position' as well as Block->getPosOffset() to Block->getPositionOffset()
This commit is contained in:
SalmonDE
2021-08-23 15:01:32 +02:00
committed by GitHub
parent 22316976fa
commit 7fd712c1ff
93 changed files with 402 additions and 402 deletions

View File

@ -55,7 +55,7 @@ class ItemFrame extends Flowable{
public function readStateFromWorld() : void{
parent::readStateFromWorld();
$tile = $this->pos->getWorld()->getTile($this->pos);
$tile = $this->position->getWorld()->getTile($this->position);
if($tile instanceof TileItemFrame){
$this->framedItem = $tile->getItem();
if($this->framedItem->isNull()){
@ -68,7 +68,7 @@ class ItemFrame extends Flowable{
public function writeStateToWorld() : void{
parent::writeStateToWorld();
$tile = $this->pos->getWorld()->getTile($this->pos);
$tile = $this->position->getWorld()->getTile($this->position);
if($tile instanceof TileItemFrame){
$tile->setItem($this->framedItem);
$tile->setItemRotation($this->itemRotation);
@ -137,7 +137,7 @@ class ItemFrame extends Flowable{
return true;
}
$this->pos->getWorld()->setBlock($this->pos, $this);
$this->position->getWorld()->setBlock($this->position, $this);
return true;
}
@ -147,16 +147,16 @@ class ItemFrame extends Flowable{
return false;
}
if(lcg_value() <= $this->itemDropChance){
$this->pos->getWorld()->dropItem($this->pos->add(0.5, 0.5, 0.5), clone $this->framedItem);
$this->position->getWorld()->dropItem($this->position->add(0.5, 0.5, 0.5), clone $this->framedItem);
}
$this->setFramedItem(null);
$this->pos->getWorld()->setBlock($this->pos, $this);
$this->position->getWorld()->setBlock($this->position, $this);
return true;
}
public function onNearbyBlockChange() : void{
if(!$this->getSide(Facing::opposite($this->facing))->isSolid()){
$this->pos->getWorld()->useBreakOn($this->pos);
$this->position->getWorld()->useBreakOn($this->position);
}
}