Make Infested Stone blocks known

this is not remotely a complete implementation, it's just here to make PM aware of these states so that world conversion can be handled correctly. A full implementation will come later.

Any blocks added in this fashion should be marked with a //TODO so future maintainers can find which blocks need work.
This commit is contained in:
Dylan K. Taylor 2019-02-25 10:53:45 +00:00
parent a8fa8572e1
commit 74e134136d
2 changed files with 71 additions and 0 deletions

View File

@ -28,6 +28,8 @@ use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\InvalidBlockStateException;
use pocketmine\block\utils\PillarRotationTrait;
use pocketmine\block\utils\TreeType;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\ItemIds;
use pocketmine\level\Position;
use pocketmine\tile\Comparator;
@ -157,6 +159,36 @@ class BlockFactory{
self::register(new HardenedGlassPane(new BID(Block::HARD_GLASS_PANE), "Hardened Glass Pane"));
self::register(new HayBale(new BID(Block::HAY_BALE), "Hay Bale"));
self::register(new Ice(new BID(Block::ICE), "Ice"));
self::register(new class(new BID(Block::MONSTER_EGG), "Infested Stone") extends InfestedStone{
public function getSilkTouchDrops(Item $item) : array{
return [ItemFactory::get(ItemIds::STONE)];
}
});
self::register(new class(new BID(Block::MONSTER_EGG, 1), "Infested Cobblestone") extends InfestedStone{
public function getSilkTouchDrops(Item $item) : array{
return [ItemFactory::get(ItemIds::COBBLESTONE)];
}
});
self::register(new class(new BID(Block::MONSTER_EGG, 2), "Infested Stone Brick") extends InfestedStone{
public function getSilkTouchDrops(Item $item) : array{
return [ItemFactory::get(ItemIds::STONE_BRICK)];
}
});
self::register(new class(new BID(Block::MONSTER_EGG, 3), "Infested Mossy Stone Brick") extends InfestedStone{
public function getSilkTouchDrops(Item $item) : array{
return [ItemFactory::get(ItemIds::STONE_BRICK, StoneBricks::MOSSY)];
}
});
self::register(new class(new BID(Block::MONSTER_EGG, 4), "Infested Cracked Stone Brick") extends InfestedStone{
public function getSilkTouchDrops(Item $item) : array{
return [ItemFactory::get(ItemIds::STONE_BRICK, StoneBricks::CRACKED)];
}
});
self::register(new class(new BID(Block::MONSTER_EGG, 5), "Infested Chiseled Stone Brick") extends InfestedStone{
public function getSilkTouchDrops(Item $item) : array{
return [ItemFactory::get(ItemIds::STONE_BRICK, StoneBricks::CHISELED)];
}
});
self::register(new InfoUpdate(new BID(Block::INFO_UPDATE), "update!"));
self::register(new InfoUpdate(new BID(Block::INFO_UPDATE2), "ate!upd"));
self::register(new InvisibleBedrock(new BID(Block::INVISIBLEBEDROCK), "Invisible Bedrock"));

View File

@ -0,0 +1,39 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
abstract class InfestedStone extends Solid{
public function getHardness() : float{
return 0.75;
}
public function getDropsForCompatibleTool(Item $item) : array{
return [];
}
//TODO
}