From 0f01570d0131149874a83ba24cdbb9f5c5de0605 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 26 Nov 2013 13:20:19 +0100 Subject: [PATCH] "Better" Tall Grass drops --- src/material/block/plant/TallGrass.php | 35 +++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/material/block/plant/TallGrass.php b/src/material/block/plant/TallGrass.php index 4cece2fcd..afe385289 100644 --- a/src/material/block/plant/TallGrass.php +++ b/src/material/block/plant/TallGrass.php @@ -44,23 +44,24 @@ class TallGrassBlock extends FlowableBlock{ public function getDrops(Item $item, Player $player){ $drops = array(); - if(mt_rand(1,10) === 1){//Seeds - $drops[] = array(WHEAT_SEEDS, 0, 1); - } - if(mt_rand(1,15) === 1){//Carrots - $drops[] = array(CARROT, 0, 1); - } - if(mt_rand(1,15) === 1){//Potatoes - $drops[] = array(POTATO, 0, 1); - } - if(mt_rand(1,15) === 1){//Beetroot Seeds - $drops[] = array(BEETROOT_SEEDS, 0, 1); - } - if(mt_rand(1,20) === 1){//Melon Seeds - $drops[] = array(MELON_SEEDS, 0, 1); - } - if(mt_rand(1,15) === 1){//Melon Seeds - $drops[] = array(PUMPKIN_SEEDS, 0, 1); + $possibleDrops = array( + array(WHEAT_SEEDS, 0, 1), + array(CARROT, 0, 1), + array(POTATO, 0, 1), + array(BEETROOT_SEEDS, 0, 1), + array(MELON_SEEDS, 0, 1), + array(PUMPKIN_SEEDS, 0, 1), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ); + if(($item = $possibleDrops[mt_rand(0, count($possibleDrops) - 1)]) !== 0){ + $drops[] = $item; } return $drops; }