22declare(strict_types=1);
30use
function array_keys;
35 private int $railShape = BlockLegacyMetadata::RAIL_STRAIGHT_NORTH_SOUTH;
38 $w->railShape($this->railShape);
43 if($railShape ===
null){
44 throw new \InvalidArgumentException(
"No rail shape matches these connections");
46 $this->railShape = $railShape;
54 $possible = parent::getPossibleConnectionDirectionsOneConstraint($constraint);
56 if(($constraint & RailConnectionInfo::FLAG_ASCEND) === 0){
63 if($constraint !== $d){
72 public function getShape() : int{ return $this->railShape; }
77 throw new \InvalidArgumentException(
"Invalid shape, must be one of " . implode(
", ", [...array_keys(RailConnectionInfo::CONNECTIONS), ...array_keys(RailConnectionInfo::CURVE_CONNECTIONS)]));
79 $this->railShape = $shape;
describeBlockOnlyState(RuntimeDataDescriber $w)
getCurrentShapeConnections()
setShapeFromConnections(array $connections)
getPossibleConnectionDirectionsOneConstraint(int $constraint)