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

@ -93,12 +93,12 @@ final class FloorCoralFan extends BaseCoral{
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if(!$tx->fetchBlock($blockReplace->getPos()->down())->isSolid()){
if(!$tx->fetchBlock($blockReplace->getPosition()->down())->isSolid()){
return false;
}
if($player !== null){
$playerBlockPos = $player->getPosition()->floor();
$directionVector = $blockReplace->getPos()->subtractVector($playerBlockPos)->normalize();
$directionVector = $blockReplace->getPosition()->subtractVector($playerBlockPos)->normalize();
$angle = rad2deg(atan2($directionVector->getZ(), $directionVector->getX()));
if($angle <= 45 || 315 <= $angle || (135 <= $angle && $angle <= 225)){
@ -111,9 +111,9 @@ final class FloorCoralFan extends BaseCoral{
}
public function onNearbyBlockChange() : void{
$world = $this->pos->getWorld();
if(!$world->getBlock($this->pos->down())->isSolid()){
$world->useBreakOn($this->pos);
$world = $this->position->getWorld();
if(!$world->getBlock($this->position->down())->isSolid()){
$world->useBreakOn($this->position);
}else{
parent::onNearbyBlockChange();
}