BaseRail: move reconnect attempt to post-place hook

This commit is contained in:
Dylan K. Taylor 2019-05-27 17:55:19 +01:00
parent 28f3322337
commit bcff124953

View File

@ -98,13 +98,16 @@ abstract class BaseRail extends Flowable{
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if(!$blockReplace->getSide(Facing::DOWN)->isTransparent()){
$this->tryReconnect();
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
return false;
}
public function onPostPlace() : void{
$this->tryReconnect();
}
protected static function searchState(array $connections, array $lookup) : int{
$meta = array_search($connections, $lookup, true);
if($meta === false){
@ -253,6 +256,7 @@ abstract class BaseRail extends Flowable{
if($changed){
$this->setConnections($thisConnections);
$this->world->setBlock($this, $this);
}
}