diff --git a/src/pocketmine/block/BlockFactory.php b/src/pocketmine/block/BlockFactory.php index f51383fce..d823f739e 100644 --- a/src/pocketmine/block/BlockFactory.php +++ b/src/pocketmine/block/BlockFactory.php @@ -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)); diff --git a/src/pocketmine/block/BrewingStand.php b/src/pocketmine/block/BrewingStand.php index 984aec14c..a4c47710a 100644 --- a/src/pocketmine/block/BrewingStand.php +++ b/src/pocketmine/block/BrewingStand.php @@ -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 } diff --git a/src/pocketmine/block/tile/TileFactory.php b/src/pocketmine/block/tile/TileFactory.php index e804dbf0d..c1e7d3c84 100644 --- a/src/pocketmine/block/tile/TileFactory.php +++ b/src/pocketmine/block/tile/TileFactory.php @@ -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