50 parent::readStateFromWorld();
52 $this->collisionBoxes =
null;
54 $clockwise = Facing::rotateY($this->facing,
true);
55 if(($backFacing = $this->getPossibleCornerFacing(
false)) !==
null){
56 $this->shape = $backFacing === $clockwise ? StairShape::OUTER_RIGHT : StairShape::OUTER_LEFT;
57 }elseif(($frontFacing = $this->getPossibleCornerFacing(
true)) !==
null){
58 $this->shape = $frontFacing === $clockwise ? StairShape::INNER_RIGHT : StairShape::INNER_LEFT;
60 $this->shape = StairShape::STRAIGHT;
83 $topStepFace = $this->upsideDown ?
Facing::DOWN :
Facing::UP;
85 AxisAlignedBB::one()->trim($topStepFace, 0.5)
88 $topStep = AxisAlignedBB::one()
89 ->trim(Facing::opposite($topStepFace), 0.5)
90 ->trim(Facing::opposite($this->facing), 0.5);
92 if($this->shape === StairShape::OUTER_LEFT || $this->shape === StairShape::OUTER_RIGHT){
93 $topStep->trim(Facing::rotateY($this->facing, $this->shape === StairShape::OUTER_LEFT), 0.5);
94 }elseif($this->shape === StairShape::INNER_LEFT || $this->shape === StairShape::INNER_RIGHT){
96 $bbs[] = AxisAlignedBB::one()
97 ->trim(Facing::opposite($topStepFace), 0.5)
98 ->trim($this->facing, 0.5)
99 ->trim(Facing::rotateY($this->facing, $this->shape === StairShape::INNER_LEFT), 0.5);
109 $facing ===
Facing::UP && $this->upsideDown ||
110 $facing ===
Facing::DOWN && !$this->upsideDown ||
111 ($facing === $this->facing && $this->shape !== StairShape::OUTER_LEFT && $this->shape !== StairShape::OUTER_RIGHT) ||
112 ($facing ===
Facing::rotate($this->facing,
Axis::Y, false) && $this->shape === StairShape::INNER_LEFT) ||
113 ($facing ===
Facing::rotate($this->facing,
Axis::Y, true) && $this->shape === StairShape::INNER_RIGHT)
115 return SupportType::FULL;
117 return SupportType::NONE;
130 if($player !== null){
131 $this->facing = $player->getHorizontalFacing();
133 $this->upsideDown = (($clickVector->y > 0.5 && $face !== Facing::UP) || $face === Facing::DOWN);
135 return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);