Added flowers placement

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-03 20:23:07 +01:00
parent d1610ce7a1
commit a9c7a6642e
3 changed files with 20 additions and 42 deletions

View File

@ -487,46 +487,6 @@ class BlockAPI{
}
}*/
/*
$replace = false;
switch($data["block"]){
case 44: //Slabs
if($data["face"] === 0){
if($target[0] === 44 and ($target[1] & 0x08) === 0x08 and ($target[1] & 0x07) === ($data["meta"] & 0x07)){
$replace = true;
$data["block"] = 43;
$data["meta"] = $data["meta"] & 0x07;
}else{
$data["meta"] |= 0x08;
}
}elseif($data["face"] === 1){
if($target[0] === 44 and ($target[1] & 0x08) === 0 and ($target[1] & 0x07) === ($data["meta"] & 0x07)){
$replace = true;
$data["block"] = 43;
$data["meta"] = $data["meta"] & 0x07;
}
}else{
$data2 = $data;
BlockFace::setPosition($data2, $data["face"]);
$b = $this->server->api->level->getBlock($data2["x"], $data2["y"], $data2["z"]);
if($b[0] === 44 and ($b[1] & 0x07) === ($data["meta"] & 0x07)){
$data = $data2;
$replace = true;
$data["block"] = 43;
$data["meta"] = $data["meta"] & 0x07;
}else{
$data["meta"] = $data["meta"] & 0x07;
if($data["fy"] > 0.5){
$data["meta"] |= 0x08;
}
}
}
break;
}
*/
if($block->y > 127 or $block->y < 0){
return false;
}

View File

@ -30,5 +30,14 @@ class CyanFlowerBlock extends FlowableBlock{
parent::__construct(CYAN_FLOWER, 0, "Cyan Flower");
$this->isFlowable = true;
}
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($block->inWorld === true){
$down = $level->getBlockFace($block, 0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
$level->setBlock($block, $this->id, $this->getMetadata());
return true;
}
}
return false;
}
}

View File

@ -30,5 +30,14 @@ class DandelionBlock extends FlowableBlock{
parent::__construct(DANDELION, 0, "Dandelion");
$this->isFlowable = true;
}
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($block->inWorld === true){
$down = $level->getBlockFace($block, 0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
$level->setBlock($block, $this->id, $this->getMetadata());
return true;
}
}
return false;
}
}