From f8d8052ec38f71661ac02ce706121bbb69f3c58d Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sun, 24 Nov 2013 15:52:35 +0100 Subject: [PATCH] Correct placement for cakes and snow layers --- src/material/block/nonfull/Cake.php | 9 +++++++++ src/material/block/nonfull/SnowLayer.php | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/material/block/nonfull/Cake.php b/src/material/block/nonfull/Cake.php index b13d4848..a9085f8e 100644 --- a/src/material/block/nonfull/Cake.php +++ b/src/material/block/nonfull/Cake.php @@ -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 diff --git a/src/material/block/nonfull/SnowLayer.php b/src/material/block/nonfull/SnowLayer.php index b5c90d9d..0913d940 100644 --- a/src/material/block/nonfull/SnowLayer.php +++ b/src/material/block/nonfull/SnowLayer.php @@ -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