From ab3fcfc14872fc69e352fe6db276715335f77ce7 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 6 Jun 2013 22:44:20 +0200 Subject: [PATCH] Correct drops for Snow and Cake --- src/material/Item.php | 17 +++++++++++++++++ src/material/block/solid/Cake.php | 4 ++++ src/material/block/solid/SnowLayer.php | 7 +++++++ src/material/item/generic/Bucket.php | 4 ++-- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/material/Item.php b/src/material/Item.php index 3c5b6eb35..2a9e90777 100644 --- a/src/material/Item.php +++ b/src/material/Item.php @@ -147,6 +147,23 @@ class Item{ } } + final public function isShovel(){ + switch($this->id){ + case IRON_SHOVEL: + return 4; + case WOODEN_SHOVEL: + return 1; + case STONE_SHOVEL: + return 3; + case DIAMOND_SHOVEL: + return 5; + case GOLD_SHOVEL: + return 2; + default: + return false; + } + } + public function isHoe(){ switch($this->id){ case IRON_HOE: diff --git a/src/material/block/solid/Cake.php b/src/material/block/solid/Cake.php index 628187f7f..6462dfd84 100644 --- a/src/material/block/solid/Cake.php +++ b/src/material/block/solid/Cake.php @@ -33,6 +33,10 @@ class CakeBlock extends TransparentBlock{ $this->meta = $meta & 0x07; } + public function getDrops(Item $item, Player $player){ + return array(); + } + public function onActivate(Item $item, Player $player){ if($player->entity->getHealth() < 20){ ++$this->meta; diff --git a/src/material/block/solid/SnowLayer.php b/src/material/block/solid/SnowLayer.php index e9f77d81e..9941f023d 100644 --- a/src/material/block/solid/SnowLayer.php +++ b/src/material/block/solid/SnowLayer.php @@ -32,4 +32,11 @@ class SnowLayerBlock extends FlowableBlock{ $this->isSolid = false; } + public function getDrops(Item $item, Player $player){ + if($item->isShovel() !== false){ + return array( + array(SNOWBALL, 0, 1), + ); + } + } } \ No newline at end of file diff --git a/src/material/item/generic/Bucket.php b/src/material/item/generic/Bucket.php index dff13815e..a516464ac 100644 --- a/src/material/item/generic/Bucket.php +++ b/src/material/item/generic/Bucket.php @@ -41,11 +41,11 @@ class BucketItem extends Item{ return true; } }elseif($this->meta === STILL_WATER){ - if($block->getID() === AIR){ + //if($block->getID() === AIR){ $level->setBlock($block, new StillWaterBLock()); $this->meta = 0; return true; - } + //} }elseif($this->meta === STILL_LAVA){ if($block->getID() === AIR){ $level->setBlock($block, new StillLavaBlock());