Correct placement for cakes and snow layers

This commit is contained in:
Shoghi Cervantes 2013-11-24 15:52:35 +01:00
parent 0dc783f285
commit f8d8052ec3
2 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,15 @@ class CakeBlock extends TransparentBlock{
$this->hardness = 2.5;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->getID() !== AIR){
$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

View File

@ -28,6 +28,15 @@ class SnowLayerBlock extends FlowableBlock{
$this->hardness = 0.5;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($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