added BrewingStand tile (implementation incomplete)

since we already have a partial implementation of brewing stand, we should also have the corresponding tile so that PM doesn't create any more busted blocks.
This commit is contained in:
Dylan K. Taylor 2019-06-07 19:29:26 +01:00
parent 3bc8244673
commit 5e88fda824
3 changed files with 18 additions and 2 deletions

View File

@ -29,6 +29,7 @@ use pocketmine\block\BlockLegacyIds as Ids;
use pocketmine\block\BlockLegacyMetadata as Meta;
use pocketmine\block\tile\Banner as TileBanner;
use pocketmine\block\tile\Bed as TileBed;
use pocketmine\block\tile\BrewingStand as TileBrewingStand;
use pocketmine\block\tile\Chest as TileChest;
use pocketmine\block\tile\Comparator as TileComparator;
use pocketmine\block\tile\DaylightSensor as TileDaylightSensor;
@ -97,7 +98,7 @@ class BlockFactory{
self::register(new BlueIce(new BID(Ids::BLUE_ICE), "Blue Ice"));
self::register(new BoneBlock(new BID(Ids::BONE_BLOCK), "Bone Block"));
self::register(new Bookshelf(new BID(Ids::BOOKSHELF), "Bookshelf"));
self::register(new BrewingStand(new BID(Ids::BREWING_STAND_BLOCK, 0, ItemIds::BREWING_STAND), "Brewing Stand"));
self::register(new BrewingStand(new BID(Ids::BREWING_STAND_BLOCK, 0, ItemIds::BREWING_STAND, TileBrewingStand::class), "Brewing Stand"));
$bricksBreakInfo = new BlockBreakInfo(2.0, BlockToolType::TYPE_PICKAXE, TieredTool::TIER_WOODEN, 30.0);
self::register(new Stair(new BID(Ids::BRICK_STAIRS), "Brick Stairs", $bricksBreakInfo));

View File

@ -23,7 +23,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\tile\BrewingStand as TileBrewingStand;
use pocketmine\item\Item;
use pocketmine\item\TieredTool;
use pocketmine\math\Vector3;
use pocketmine\Player;
class BrewingStand extends Transparent{
@ -54,5 +58,16 @@ class BrewingStand extends Transparent{
return 0b111;
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($player instanceof Player){
$stand = $this->getWorld()->getTile($this);
if($stand instanceof TileBrewingStand and $stand->canOpenWith($item->getCustomName())){
$player->addWindow($stand->getInventory());
}
}
return true;
}
//TODO
}

View File

@ -48,6 +48,7 @@ final class TileFactory{
public static function init() : void{
self::register(Banner::class, ["Banner", "minecraft:banner"]);
self::register(Bed::class, ["Bed", "minecraft:bed"]);
self::register(BrewingStand::class, ["BrewingStand", "minecraft:brewing_stand"]);
self::register(Chest::class, ["Chest", "minecraft:chest"]);
self::register(Comparator::class, ["Comparator", "minecraft:comparator"]);
self::register(DaylightSensor::class, ["DaylightDetector", "minecraft:daylight_detector"]);
@ -66,7 +67,6 @@ final class TileFactory{
//TODO: Beacon
//TODO: Bell
//TODO: BlastFurnace
//TODO: BrewingStand
//TODO: Campfire
//TODO: Cauldron
//TODO: ChalkboardBlock