first shot making Block not extend Position

this makes some stuff a lot less pretty, but this seems to be the bare minimum necessary to do this task. It can be enhanced later.
This commit is contained in:
Dylan K. Taylor
2019-08-05 16:44:09 +01:00
parent cf271dab2b
commit 53ab860db5
75 changed files with 337 additions and 325 deletions

View File

@ -36,6 +36,7 @@ use function array_shift;
use function count;
use function implode;
use function in_array;
use pocketmine\world\Position;
abstract class BaseRail extends Flowable{
@ -244,7 +245,7 @@ abstract class BaseRail extends Flowable{
if(isset($otherPossible[$otherSide])){
$otherConnections[] = $otherSide;
$other->setConnections($otherConnections);
$other->world->setBlock($other, $other);
$this->pos->getWorld()->setBlock($other->pos, $other);
$changed = true;
$thisConnections[] = $thisSide;
@ -257,7 +258,7 @@ abstract class BaseRail extends Flowable{
if($changed){
$this->setConnections($thisConnections);
$this->world->setBlock($this, $this);
$this->pos->getWorld()->setBlock($this->pos, $this);
}
}
@ -273,11 +274,11 @@ abstract class BaseRail extends Flowable{
public function onNearbyBlockChange() : void{
if($this->getSide(Facing::DOWN)->isTransparent()){
$this->world->useBreakOn($this);
$this->pos->getWorld()->useBreakOn($this->pos);
}else{
foreach($this->connections as $connection){
if(($connection & self::FLAG_ASCEND) !== 0 and $this->getSide($connection & ~self::FLAG_ASCEND)->isTransparent()){
$this->world->useBreakOn($this);
$this->pos->getWorld()->useBreakOn($this->pos);
break;
}
}