mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
added double tall grass
This commit is contained in:
parent
728b8f6d2e
commit
d334b85c63
3 changed files with 47 additions and 1 deletions
|
|
@ -258,7 +258,11 @@ class BlockAPI{
|
|||
[DYE, 11],
|
||||
[DYE, 10],
|
||||
[DYE, 9],
|
||||
[DYE, 8]
|
||||
[DYE, 8],
|
||||
[DOUBLE_PLANT, 0],
|
||||
[DOUBLE_PLANT, 1],
|
||||
[DOUBLE_PLANT, 2],
|
||||
[DOUBLE_PLANT, 3],
|
||||
|
||||
];
|
||||
private $server;
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ abstract class Block extends Position{
|
|||
PODZOL => "PodzolBlock",
|
||||
STAINED_CLAY => "StainedClayBlock",
|
||||
LILY_PAD => "LilypadBlock",
|
||||
DOUBLE_PLANT => "DoubleTallGrass",
|
||||
);
|
||||
protected $id;
|
||||
protected $meta;
|
||||
|
|
|
|||
41
src/material/block/plant/DoubleTallGrass.php
Normal file
41
src/material/block/plant/DoubleTallGrass.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
class DoubleTallGrass extends FlowableBlock
|
||||
{
|
||||
public static $NAMES = [
|
||||
0 => "Sunflower",
|
||||
1 => "Lilac",
|
||||
2 => "Tall Grass",
|
||||
3 => "Tall Fern",
|
||||
];
|
||||
public function __construct($meta = 1){
|
||||
parent::__construct(DOUBLE_PLANT, $meta, "Tall Grass");
|
||||
$this->name = self::$NAMES[$this->meta];
|
||||
$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;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){ //TODO vanilla?
|
||||
return [];
|
||||
}
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$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);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue