mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 03:06:55 +00:00
First step towards standardised opening logic for containers and menu blocks
we'll want to introduce interfaces for these, but getting the code deduplicated is enough to start with.
This commit is contained in:
@ -24,19 +24,16 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\inventory\window\SmithingTableInventoryWindow;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\block\utils\InventoryMenuTrait;
|
||||
use pocketmine\player\InventoryWindow;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\world\Position;
|
||||
|
||||
final class SmithingTable extends Opaque{
|
||||
use InventoryMenuTrait;
|
||||
|
||||
public function onInteract(Item $item, Facing $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
||||
if($player !== null){
|
||||
$player->setCurrentWindow(new SmithingTableInventoryWindow($player, $this->position));
|
||||
}
|
||||
|
||||
return true;
|
||||
protected function newWindow(Player $player, Position $position) : InventoryWindow{
|
||||
return new SmithingTableInventoryWindow($player, $position);
|
||||
}
|
||||
|
||||
public function getFuelTime() : int{
|
||||
|
Reference in New Issue
Block a user