mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +00:00
EnderChest: fix hierarchy
This commit is contained in:
parent
cb91afcc00
commit
ceaf969203
@ -67,7 +67,6 @@ class Chest extends Transparent{
|
||||
}
|
||||
|
||||
if(parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player)){
|
||||
//TODO: this is fragile and might have unintended side effects on ender chests if modified carelessly
|
||||
$tile = $this->level->getTile($this);
|
||||
if($tile instanceof TileChest){
|
||||
foreach([
|
||||
|
@ -23,15 +23,32 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\utils\BlockDataValidator;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\item\TieredTool;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\tile\EnderChest as TileEnderChest;
|
||||
|
||||
class EnderChest extends Chest{
|
||||
class EnderChest extends Transparent{
|
||||
|
||||
/** @var int */
|
||||
protected $facing = Facing::NORTH;
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->facing;
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = BlockDataValidator::readHorizontalFacing($stateMeta);
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
return 0b111;
|
||||
}
|
||||
|
||||
public function getHardness() : float{
|
||||
return 22.5;
|
||||
@ -53,6 +70,18 @@ class EnderChest extends Chest{
|
||||
return TieredTool::TIER_WOODEN;
|
||||
}
|
||||
|
||||
protected function recalculateBoundingBox() : ?AxisAlignedBB{
|
||||
//these are slightly bigger than in PC
|
||||
return AxisAlignedBB::one()->contract(0.025, 0, 0.025)->trim(Facing::UP, 0.05);
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
if($player !== null){
|
||||
$this->facing = Facing::opposite($player->getHorizontalFacing());
|
||||
}
|
||||
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
if($player instanceof Player){
|
||||
$enderChest = $this->getLevel()->getTile($this);
|
||||
@ -70,8 +99,4 @@ class EnderChest extends Chest{
|
||||
ItemFactory::get(Item::OBSIDIAN, 0, 8)
|
||||
];
|
||||
}
|
||||
|
||||
public function getFuelTime() : int{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user