From 9a5d51fd3d51347b101edb409a05c00e2f59ffe8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 20 Sep 2018 11:31:48 +0100 Subject: [PATCH 1/5] Fixed block-picking cake giving the block instead of item --- src/pocketmine/block/Cake.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pocketmine/block/Cake.php b/src/pocketmine/block/Cake.php index f67fa4e7d..9ac80f6a7 100644 --- a/src/pocketmine/block/Cake.php +++ b/src/pocketmine/block/Cake.php @@ -35,6 +35,8 @@ class Cake extends Transparent implements FoodSource{ protected $id = self::CAKE_BLOCK; + protected $itemId = Item::CAKE; + public function __construct(int $meta = 0){ $this->meta = $meta; } From 24a6bf7365c93a17ef88f25b956f2f21814f00f9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 20 Sep 2018 12:01:39 +0100 Subject: [PATCH 2/5] PocketMine.php: Allow overriding autoloader path using --bootstrap I've gotten tired of re-running composer every time I switch branches... --- src/pocketmine/PocketMine.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index f191ec301..ce65ded18 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -139,12 +139,18 @@ namespace pocketmine { define('pocketmine\PATH', dirname(__FILE__, 3) . DIRECTORY_SEPARATOR); } - define('pocketmine\COMPOSER_AUTOLOADER_PATH', \pocketmine\PATH . 'vendor/autoload.php'); + $opts = getopt("", ["bootstrap:"]); + if(isset($opts["bootstrap"])){ + $bootstrap = $opts["bootstrap"]; + }else{ + $bootstrap = \pocketmine\PATH . 'vendor/autoload.php'; + } + define('pocketmine\COMPOSER_AUTOLOADER_PATH', realpath($bootstrap)); - if(is_file(\pocketmine\COMPOSER_AUTOLOADER_PATH)){ + if(\pocketmine\COMPOSER_AUTOLOADER_PATH !== false and is_file(\pocketmine\COMPOSER_AUTOLOADER_PATH)){ require_once(\pocketmine\COMPOSER_AUTOLOADER_PATH); }else{ - critical_error("Composer autoloader not found."); + critical_error("Composer autoloader not found at " . $bootstrap); critical_error("Please install/update Composer dependencies or use provided builds."); exit(1); } From 758d9b9784d36bbbf97977dc1764ef577cbe19c6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 20 Sep 2018 12:03:01 +0100 Subject: [PATCH 3/5] Farmland: fixed block picking --- src/pocketmine/block/Farmland.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pocketmine/block/Farmland.php b/src/pocketmine/block/Farmland.php index 1da290a60..4480abc8c 100644 --- a/src/pocketmine/block/Farmland.php +++ b/src/pocketmine/block/Farmland.php @@ -111,4 +111,8 @@ class Farmland extends Transparent{ public function isAffectedBySilkTouch() : bool{ return false; } + + public function getPickedItem() : Item{ + return ItemFactory::get(Item::DIRT); + } } From aa05650994c029affdeae264136cc8d5dcb75e10 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 20 Sep 2018 13:11:45 +0100 Subject: [PATCH 4/5] Fixed block picking for mob heads --- src/pocketmine/block/Skull.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pocketmine/block/Skull.php b/src/pocketmine/block/Skull.php index 9e4c6c425..3dfd1b04b 100644 --- a/src/pocketmine/block/Skull.php +++ b/src/pocketmine/block/Skull.php @@ -71,18 +71,20 @@ class Skull extends Flowable{ return true; } - public function getDropsForCompatibleTool(Item $item) : array{ + private function getItem() : Item{ $tile = $this->level->getTile($this); - if($tile instanceof TileSkull){ - return [ - ItemFactory::get(Item::SKULL, $tile->getType()) - ]; - } + return ItemFactory::get(Item::SKULL, $tile instanceof TileSkull ? $tile->getType() : 0); + } - return []; + public function getDropsForCompatibleTool(Item $item) : array{ + return [$this->getItem()]; } public function isAffectedBySilkTouch() : bool{ return false; } + + public function getPickedItem() : Item{ + return $this->getItem(); + } } From 7c092b93b430424b6a62bfa7c26b0be32d9fdb41 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 20 Sep 2018 16:49:50 +0100 Subject: [PATCH 5/5] Fixed bug when placing blocks by clicking on redstone ore --- src/pocketmine/block/RedstoneOre.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/block/RedstoneOre.php b/src/pocketmine/block/RedstoneOre.php index 22b8aa739..edcdac933 100644 --- a/src/pocketmine/block/RedstoneOre.php +++ b/src/pocketmine/block/RedstoneOre.php @@ -50,7 +50,8 @@ class RedstoneOre extends Solid{ } public function onActivate(Item $item, Player $player = null) : bool{ - return $this->getLevel()->setBlock($this, BlockFactory::get(Block::GLOWING_REDSTONE_ORE, $this->meta)); + $this->getLevel()->setBlock($this, BlockFactory::get(Block::GLOWING_REDSTONE_ORE, $this->meta)); + return false; //this shouldn't prevent block placement } public function onNearbyBlockChange() : void{