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

@ -1,6 +1,6 @@
<?php
class PoweredRailBlock extends FlowableBlock{
require_once("RailBaseBlock.php");
class PoweredRailBlock extends RailBaseBlock{
public function __construct($meta = 0){
parent::__construct(POWERED_RAIL, 0, "PoweredRailBlock");
$this->hardness = 0.7;
@ -8,18 +8,9 @@ class PoweredRailBlock extends FlowableBlock{
$this->isSolid = true;
}
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);
return true;
}
return false;
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
if($this->getSide(0)->getID() === AIR){ //Replace with common break method TODO change meta on break
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;