21 public function __construct(
22 private int $actionType,
26 if(!self::isValidActionType($actionType)){
27 throw new \InvalidArgumentException(
"Invalid action type for " . self::class);
31 public function getActionType() :
int{
return $this->actionType; }
33 public function getBlockPosition() :
BlockPosition{
return $this->blockPosition; }
35 public function getFace() :
int{
return $this->face; }
40 return new self($actionType, $blockPosition, $face);
48 public static function isValidActionType(
int $actionType) :
bool{
49 return match($actionType){
50 PlayerAction::ABORT_BREAK,
51 PlayerAction::START_BREAK,
52 PlayerAction::CRACK_BREAK,
53 PlayerAction::PREDICT_DESTROY_BLOCK,
54 PlayerAction::CONTINUE_DESTROY_BLOCK =>
true,