mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
Added PoweredRail
This commit is contained in:
parent
1ffbfeeb22
commit
f73e7f8504
4 changed files with 53 additions and 1 deletions
|
|
@ -53,7 +53,7 @@ define("LAPIS_BLOCK", 22);
|
||||||
define("SANDSTONE", 24);
|
define("SANDSTONE", 24);
|
||||||
|
|
||||||
define("BED_BLOCK", 26);
|
define("BED_BLOCK", 26);
|
||||||
|
define("POWERED_RAIL", 27);
|
||||||
|
|
||||||
define("COBWEB", 30);
|
define("COBWEB", 30);
|
||||||
define("TALL_GRASS", 31);
|
define("TALL_GRASS", 31);
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ abstract class Block extends Position{
|
||||||
LAPIS_BLOCK => "LapisBlock",
|
LAPIS_BLOCK => "LapisBlock",
|
||||||
SANDSTONE => "SandstoneBlock",
|
SANDSTONE => "SandstoneBlock",
|
||||||
BED_BLOCK => "BedBlock",
|
BED_BLOCK => "BedBlock",
|
||||||
|
POWERED_RAIL => "PoweredRailBlock",
|
||||||
COBWEB => "CobwebBlock",
|
COBWEB => "CobwebBlock",
|
||||||
TALL_GRASS => "TallGrassBlock",
|
TALL_GRASS => "TallGrassBlock",
|
||||||
DEAD_BUSH => "DeadBushBlock",
|
DEAD_BUSH => "DeadBushBlock",
|
||||||
|
|
|
||||||
50
src/material/block/nonfull/PoweredRail.php
Normal file
50
src/material/block/nonfull/PoweredRail.php
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class PoweredRailBlock extends FlowableBlock{
|
||||||
|
public function __construct($meta = 0){
|
||||||
|
parent::__construct(POWERED_RAIL, 0, "PoweredRailBlock");
|
||||||
|
$this->hardness = 0.7;
|
||||||
|
$this->isFullBlock = false;
|
||||||
|
$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
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -144,6 +144,7 @@ class CraftingRecipes{
|
||||||
"WOODEN_PLANKS:?x1,STICK:?x2=>WOODEN_SHOVEL:0x1",
|
"WOODEN_PLANKS:?x1,STICK:?x2=>WOODEN_SHOVEL:0x1",
|
||||||
"WOODEN_PLANKS:?x2,STICK:?x1=>WOODEN_SWORD:0x1",
|
"WOODEN_PLANKS:?x2,STICK:?x1=>WOODEN_SWORD:0x1",
|
||||||
"IRON_INGOT:?x6,STICK:?x1=>RAIL:0x16",
|
"IRON_INGOT:?x6,STICK:?x1=>RAIL:0x16",
|
||||||
|
"GOLD_INGOT:?x6,STICK:?x1,REDSTONE:?x1=>POWERED_RAIL:0x6",
|
||||||
|
|
||||||
//Food & protection
|
//Food & protection
|
||||||
"BEETROOT:?x4,BOWL:?x1=>BEETROOT_SOUP:0x1",
|
"BEETROOT:?x4,BOWL:?x1=>BEETROOT_SOUP:0x1",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue