Implement Chiseled Bookshelf (#5827)

This commit is contained in:
HimmelKreis4865
2023-09-28 16:56:46 +02:00
committed by GitHub
parent a6b030f2b3
commit d94391af57
14 changed files with 313 additions and 2 deletions

View File

@ -0,0 +1,58 @@
<?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\tile;
use pocketmine\block\utils\ChiseledBookshelfSlot;
use pocketmine\inventory\SimpleInventory;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\world\World;
use function count;
class ChiseledBookshelf extends Tile implements Container{
use ContainerTrait;
private SimpleInventory $inventory;
public function __construct(World $world, Vector3 $pos){
parent::__construct($world, $pos);
$this->inventory = new SimpleInventory(count(ChiseledBookshelfSlot::cases()));
}
public function getInventory() : SimpleInventory{
return $this->inventory;
}
public function getRealInventory() : SimpleInventory{
return $this->inventory;
}
public function readSaveData(CompoundTag $nbt) : void{
$this->loadItems($nbt);
}
public function writeSaveData(CompoundTag $nbt) : void{
$this->saveItems($nbt);
}
}

View File

@ -59,6 +59,7 @@ final class TileFactory{
$this->register(BrewingStand::class, ["BrewingStand", "minecraft:brewing_stand"]);
$this->register(Cauldron::class, ["Cauldron", "minecraft:cauldron"]);
$this->register(Chest::class, ["Chest", "minecraft:chest"]);
$this->register(ChiseledBookshelf::class, ["ChiseledBookshelf", "minecraft:chiseled_bookshelf"]);
$this->register(Comparator::class, ["Comparator", "minecraft:comparator"]);
$this->register(DaylightSensor::class, ["DaylightDetector", "minecraft:daylight_detector"]);
$this->register(EnchantTable::class, ["EnchantTable", "minecraft:enchanting_table"]);