rail connection is enabled by default + some tweaks

This commit is contained in:
GameHerobrine 2023-07-10 15:44:08 +03:00
parent 8e5d2bb1c7
commit ba85d69149
5 changed files with 50 additions and 22 deletions

View file

@ -8,17 +8,13 @@ class RailBlock extends RailBaseBlock{
$this->isSolid = false;
}
public static $shouldconnectrails = false;
public static $shouldconnectrails = true;
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === AIR){//Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, $this->meta, 1));
$this->level->setBlock($this, new AirBlock(), true, false, true);
return BLOCK_UPDATE_NORMAL;
}
public function updateState(){
$logic = (new RailLogic($this));
if($logic->countPotentialConnections() == 3){
$logic->place(false, false);
}
return false;
}
}