mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +00:00
rail logic ported from 1.5.2, disabled 1 action in mobai
This commit is contained in:
parent
8bb5667a55
commit
218a000c41
6 changed files with 278 additions and 164 deletions
24
src/material/block/nonfull/RailBaseBlock.php
Normal file
24
src/material/block/nonfull/RailBaseBlock.php
Normal 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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue