rail logic ported from 1.5.2, disabled 1 action in mobai

This commit is contained in:
GameHerobrine 2023-05-14 20:11:50 +03:00
parent 8bb5667a55
commit 218a000c41
6 changed files with 278 additions and 164 deletions

View file

@ -0,0 +1,24 @@
<?php
abstract class RailBaseBlock extends FlowableBlock //TODO move some methods here
{
public static function isRailBlock(Level $l, $x, $y, $z){
$id = $l->level->getBlockID($x, $y, $z);
return $id === POWERED_RAIL || $id === RAIL;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->getID() !== AIR and $down instanceof SolidBlock){
$this->level->setBlock($block, $this, true, false, true);
if(RailBlock::$shouldconnectrails){
$logic = new RailLogic($this);
$logic->place(false, true);
}
return true;
}
return false;
}
}