22declare(strict_types=1);
27use pocketmine\block\utils\AnalogRedstoneSignalEmitterTrait;
28use pocketmine\block\utils\HorizontalFacingTrait;
29use pocketmine\block\utils\PoweredByRedstoneTrait;
30use pocketmine\block\utils\StaticSupportTrait;
31use pocketmine\block\utils\SupportType;
42 use HorizontalFacingTrait;
43 use AnalogRedstoneSignalEmitterTrait;
44 use PoweredByRedstoneTrait;
45 use StaticSupportTrait;
47 protected bool $isSubtractMode =
false;
50 $w->horizontalFacing($this->facing);
51 $w->bool($this->isSubtractMode);
52 $w->bool($this->powered);
56 parent::readStateFromWorld();
57 $tile = $this->position->getWorld()->getTile($this->position);
59 $this->signalStrength = $tile->getSignalStrength();
66 parent::writeStateToWorld();
67 $tile = $this->position->getWorld()->getTile($this->position);
69 $tile->setSignalStrength($this->signalStrength);
72 public function isSubtractMode() : bool{
73 return $this->isSubtractMode;
78 $this->isSubtractMode = $isSubtractMode;
91 $this->facing = Facing::opposite($player->getHorizontalFacing());
93 return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
97 $this->isSubtractMode = !$this->isSubtractMode;
98 $this->position->getWorld()->setBlock($this->position, $this);
102 private function canBeSupportedAt(
Block $block) : bool{
103 return $block->getAdjacentSupportType(
Facing::DOWN) !== SupportType::NONE;
describeBlockOnlyState(RuntimeDataDescriber $w)
setSubtractMode(bool $isSubtractMode)
recalculateCollisionBoxes()
place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player=null)
onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player=null, array &$returnedItems=[])