diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index dd99a3fa1..d0c0d99c2 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -147,12 +147,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); } diff --git a/src/pocketmine/block/Cake.php b/src/pocketmine/block/Cake.php index 970a073ef..07de3fc46 100644 --- a/src/pocketmine/block/Cake.php +++ b/src/pocketmine/block/Cake.php @@ -36,6 +36,8 @@ class Cake extends Transparent implements FoodSource{ protected $id = self::CAKE_BLOCK; + protected $itemId = Item::CAKE; + public function __construct(int $meta = 0){ $this->setDamage($meta); } diff --git a/src/pocketmine/block/Farmland.php b/src/pocketmine/block/Farmland.php index f1895e947..0b435b114 100644 --- a/src/pocketmine/block/Farmland.php +++ b/src/pocketmine/block/Farmland.php @@ -103,4 +103,8 @@ class Farmland extends Transparent{ public function isAffectedBySilkTouch() : bool{ return false; } + + public function getPickedItem() : Item{ + return ItemFactory::get(Item::DIRT); + } } diff --git a/src/pocketmine/block/RedstoneOre.php b/src/pocketmine/block/RedstoneOre.php index a16e48cd4..b0900799e 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{ diff --git a/src/pocketmine/block/Skull.php b/src/pocketmine/block/Skull.php index 3f4dc71c2..bdfaef4a1 100644 --- a/src/pocketmine/block/Skull.php +++ b/src/pocketmine/block/Skull.php @@ -68,18 +68,20 @@ class Skull extends Flowable{ return false; } - 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(); + } }