diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index e010e6cb..2f3a04aa 100755 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -263,7 +263,8 @@ class BlockAPI{ [DOUBLE_PLANT, 1], [DOUBLE_PLANT, 2], [DOUBLE_PLANT, 3], - + [DOUBLE_PLANT, 4], + [DOUBLE_PLANT, 5], ]; private $server; private $scheduledUpdates = []; diff --git a/src/material/block/plant/DoubleTallGrass.php b/src/material/block/plant/DoubleTallGrass.php index 2b301177..ea9f1b8a 100644 --- a/src/material/block/plant/DoubleTallGrass.php +++ b/src/material/block/plant/DoubleTallGrass.php @@ -7,19 +7,21 @@ class DoubleTallGrass extends FlowableBlock 1 => "Lilac", 2 => "Tall Grass", 3 => "Tall Fern", + 4 => "Rose Bush", + 5 => "Peony", ]; public function __construct($meta = 1){ parent::__construct(DOUBLE_PLANT, $meta, "Tall Grass"); - $this->name = self::$NAMES[$this->meta]; + $this->name = self::$NAMES[$this->meta] ?? "Tall Grass"; $this->hardness = 0; } public function onUpdate($type){ if($type === BLOCK_UPDATE_NORMAL){ //TODO destroy if 2nd block occupied - if($this->getSide(0)->isTransparent === true){//Replace with common break method - $this->level->setBlock($this, new AirBlock(), false, false, true); - return BLOCK_UPDATE_NORMAL; - } + //if($this->meta & 0x8 == 0 && $this->getSide(0)->isTransparent === true){ //Replace with common break method + ///$this->level->setBlock($this, new AirBlock(), false, false, true); + //return BLOCK_UPDATE_NORMAL; + //} //TODO fix } return false; } @@ -32,6 +34,7 @@ class DoubleTallGrass extends FlowableBlock $down = $this->getSide(0); if($down->getID() == 2 or $down->getID() == 3){ //TODO destroy the block above(tested only in creative) $this->level->setBlock($block, $this, true, false, true); + $this->level->setBlock($block->add(0, 1, 0), new DoubleTallGrass($this->meta ^ 0x8), true, false, true); return true; } return false; diff --git a/src/material/block/plant/TallGrassBlock.php b/src/material/block/plant/TallGrassBlock.php index 082a79b3..45a2f5e1 100644 --- a/src/material/block/plant/TallGrassBlock.php +++ b/src/material/block/plant/TallGrassBlock.php @@ -2,11 +2,11 @@ class TallGrassBlock extends FlowableBlock{ public function __construct($meta = 1){ - parent::__construct(TALL_GRASS, $meta, "Tall Grass"); + parent::__construct(TALL_GRASS, $meta, "Grass"); $this->isReplaceable = true; $names = array( 0 => "Dead Shrub", - 1 => "Tall Grass", + 1 => "Grass", 2 => "Fern", ); $this->name = $names[$this->meta & 0x02]; @@ -15,7 +15,7 @@ class TallGrassBlock extends FlowableBlock{ public function onUpdate($type){ if($type === BLOCK_UPDATE_NORMAL){ - if($this->getSide(0)->isTransparent === true){//Replace with common break method + if($this->getSide(0)->isTransparent === true){ //Replace with common break method $this->level->setBlock($this, new AirBlock(), false, false, true); if(Utils::chance(15)) ServerAPI::request()->api->entity->drop(new Position($this->x + 0.5, $this->y, $this->z + 0.5, $this->level), BlockAPI::getItem(WHEAT_SEEDS)); return BLOCK_UPDATE_NORMAL;