22declare(strict_types=1);
 
   26use pocketmine\block\utils\SlabType;
 
   27use pocketmine\block\utils\SupportType;
 
   37    protected SlabType $slabType = SlabType::BOTTOM;
 
   40        parent::__construct($idInfo, $name . 
" Slab", $typeInfo);
 
 
   44        $w->enum($this->slabType);
 
 
   48        return $this->slabType !== SlabType::DOUBLE;
 
 
   55        return $this->slabType;
 
 
   62        $this->slabType = $slabType;
 
 
   67        if(parent::canBePlacedAt($blockReplace, $clickVector, $face, $isClickedBlock)){
 
   71        if($blockReplace instanceof 
Slab && $blockReplace->slabType !== SlabType::DOUBLE && $blockReplace->
hasSameTypeId($this)){
 
   72            if($blockReplace->slabType === SlabType::TOP){ 
 
   73                return $clickVector->y <= 0.5 || (!$isClickedBlock && $face === Facing::UP);
 
   75                return $clickVector->y >= 0.5 || (!$isClickedBlock && $face === Facing::DOWN);
 
 
   83        if($blockReplace instanceof 
Slab && $blockReplace->slabType !== SlabType::DOUBLE && $blockReplace->hasSameTypeId($this) && (
 
   84            ($blockReplace->slabType === SlabType::TOP && ($clickVector->y <= 0.5 || $face === 
Facing::UP)) ||
 
   85            ($blockReplace->slabType === SlabType::BOTTOM && ($clickVector->y >= 0.5 || $face === 
Facing::DOWN))
 
   88            $this->slabType = SlabType::DOUBLE;
 
   90            $this->slabType = (($face !== Facing::UP && $clickVector->y > 0.5) || $face === Facing::DOWN) ? SlabType::TOP : SlabType::BOTTOM;
 
   93        return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
 
 
   97        if($this->slabType === SlabType::DOUBLE){
 
   98            return [AxisAlignedBB::one()];
 
  100        return [AxisAlignedBB::one()->trim($this->slabType === SlabType::TOP ? Facing::DOWN : Facing::UP, 0.5)];
 
 
  104        if($this->slabType === SlabType::DOUBLE){
 
  105            return SupportType::FULL;
 
  106        }elseif(($facing === Facing::UP && $this->slabType === SlabType::TOP) || ($facing === Facing::DOWN && $this->slabType === SlabType::BOTTOM)){
 
  107            return SupportType::FULL;
 
  109        return SupportType::NONE;
 
 
  113        return [$this->asItem()->setCount($this->slabType === SlabType::DOUBLE ? 2 : 1)];
 
 
 
hasSameTypeId(Block $other)
 
canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock)
 
describeBlockOnlyState(RuntimeDataDescriber $w)
 
getSupportType(int $facing)
 
recalculateCollisionBoxes()
 
getDropsForCompatibleTool(Item $item)
 
place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player=null)
 
setSlabType(SlabType $slabType)
 
__construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo)