mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Fixed slabs again
This commit is contained in:
@ -36,16 +36,20 @@ abstract class Slab extends Transparent{
|
||||
|
||||
abstract public function getDoubleSlabId() : int;
|
||||
|
||||
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector) : bool{
|
||||
return parent::canBePlacedAt($blockReplace, $clickVector) or
|
||||
(
|
||||
$blockReplace->getId() === $this->getId() and
|
||||
$blockReplace->getVariant() === $this->getVariant() and
|
||||
(
|
||||
(($blockReplace->getDamage() & 0x08) !== 0 and ($clickVector->y <= 0.5 or $clickVector->y === 1.0)) or //top slab, fill bottom half
|
||||
(($blockReplace->getDamage() & 0x08) === 0 and ($clickVector->y >= 0.5 or $clickVector->y === 0.0)) //bottom slab, fill top half
|
||||
)
|
||||
);
|
||||
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock) : bool{
|
||||
if(parent::canBePlacedAt($blockReplace, $clickVector, $face, $isClickedBlock)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if($blockReplace->getId() === $this->getId() and $blockReplace->getVariant() === $this->getVariant()){
|
||||
if(($blockReplace->getDamage() & 0x08) !== 0){ //Trying to combine with top slab
|
||||
return $clickVector->y <= 0.5 or (!$isClickedBlock and $face === Vector3::SIDE_UP);
|
||||
}else{
|
||||
return $clickVector->y >= 0.5 or (!$isClickedBlock and $face === Vector3::SIDE_DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
|
||||
|
Reference in New Issue
Block a user