mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-26 13:09:05 +00:00
Apparently hanging signs are self supporting
This commit is contained in:
parent
f04c458e54
commit
4a2c7dc684
@ -103,27 +103,10 @@ abstract class BaseSign extends Transparent implements WoodMaterial{
|
||||
return SupportType::NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
abstract protected function getSupportingFace() : int;
|
||||
|
||||
/**
|
||||
* @return int[]
|
||||
*/
|
||||
protected function getSupportingFaceOptions() : array{
|
||||
return [$this->getSupportingFace()];
|
||||
}
|
||||
|
||||
public function onNearbyBlockChange() : void{
|
||||
$foundSupport = false;
|
||||
foreach($this->getSupportingFaceOptions() as $face){
|
||||
if($this->getSide($face)->getTypeId() !== BlockTypeIds::AIR){
|
||||
$foundSupport = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$foundSupport){
|
||||
if($this->getSide($this->getSupportingFace())->getTypeId() !== BlockTypeIds::AIR){
|
||||
$this->position->getWorld()->useBreakOn($this->position);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ use pocketmine\block\utils\HorizontalFacing;
|
||||
use pocketmine\block\utils\HorizontalFacingTrait;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Axis;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\player\Player;
|
||||
@ -39,12 +40,13 @@ final class WallHangingSign extends BaseSign implements HorizontalFacing{
|
||||
return Facing::rotateY($this->facing, clockwise: true);
|
||||
}
|
||||
|
||||
protected function getSupportingFaceOptions() : array{
|
||||
//wall hanging signs can be supported from either end of the post
|
||||
return [
|
||||
Facing::rotateY($this->facing, clockwise: true),
|
||||
Facing::rotateY($this->facing, clockwise: false)
|
||||
];
|
||||
public function onNearbyBlockChange() : void{
|
||||
//NOOP - disable default self-destruct behaviour
|
||||
}
|
||||
|
||||
protected function recalculateCollisionBoxes() : array{
|
||||
//only the cross bar is collidable
|
||||
return [AxisAlignedBB::one()->trim(Facing::DOWN, 7 / 8)->squash(Facing::axis($this->facing), 3 / 4)];
|
||||
}
|
||||
|
||||
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
|
Loading…
x
Reference in New Issue
Block a user