64 if(!$this->canBeSupportedAt($blockReplace,
Facing::opposite($face))){
68 $selectUpDownPos =
function(LeverFacing $x, LeverFacing $z) use ($player) : LeverFacing{
70 return Facing::axis($player->getHorizontalFacing()) === Axis::X ? $x : $z;
74 $this->facing = match($face){
75 Facing::DOWN => $selectUpDownPos(LeverFacing::DOWN_AXIS_X, LeverFacing::DOWN_AXIS_Z),
76 Facing::UP => $selectUpDownPos(LeverFacing::UP_AXIS_X, LeverFacing::UP_AXIS_Z),
77 Facing::NORTH => LeverFacing::NORTH,
78 Facing::SOUTH => LeverFacing::SOUTH,
79 Facing::WEST => LeverFacing::WEST,
80 Facing::EAST => LeverFacing::EAST,
81 default =>
throw new AssumptionFailedError(
"Bad facing value"),
84 return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
94 $this->activated = !$this->activated;
95 $world = $this->position->getWorld();
96 $world->setBlock($this->position, $this);
98 $this->position->add(0.5, 0.5, 0.5),