mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 15:19:56 +00:00
Made rails less weird
Not up to the task of implementing rail connectivity today, some other time
This commit is contained in:
parent
344500785c
commit
036663e0b5
@ -23,8 +23,24 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\block;
|
namespace pocketmine\block;
|
||||||
|
|
||||||
|
use pocketmine\item\Item;
|
||||||
|
use pocketmine\level\Level;
|
||||||
|
use pocketmine\math\Vector3;
|
||||||
|
use pocketmine\Player;
|
||||||
|
|
||||||
class Rail extends Flowable{
|
class Rail extends Flowable{
|
||||||
|
|
||||||
|
const STRAIGHT_NORTH_SOUTH = 0;
|
||||||
|
const STRAIGHT_EAST_WEST = 1;
|
||||||
|
const ASCENDING_EAST = 2;
|
||||||
|
const ASCENDING_WEST = 3;
|
||||||
|
const ASCENDING_NORTH = 4;
|
||||||
|
const ASCENDING_SOUTH = 5;
|
||||||
|
const CURVE_SOUTHEAST = 6;
|
||||||
|
const CURVE_SOUTHWEST = 7;
|
||||||
|
const CURVE_NORTHWEST = 8;
|
||||||
|
const CURVE_NORTHEAST = 9;
|
||||||
|
|
||||||
protected $id = self::RAIL;
|
protected $id = self::RAIL;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct($meta = 0){
|
||||||
@ -38,4 +54,25 @@ class Rail extends Flowable{
|
|||||||
public function getHardness(){
|
public function getHardness(){
|
||||||
return 0.7;
|
return 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||||
|
if(!$block->getSide(Vector3::SIDE_DOWN)->isTransparent()){
|
||||||
|
return $this->getLevel()->setBlock($block, $this, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onUpdate($type){
|
||||||
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
|
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
|
||||||
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
return $type;
|
||||||
|
}else{
|
||||||
|
//TODO: Update rail connectivity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user