Interface PuzzleLogic
- All Known Implementing Classes:
CorrectMoveChoicePuzzleLogic,CorrectSwitchChoicePuzzleLogic,PreferredMovePuzzleLogic
public interface PuzzleLogic
Defines the validation logic for a
BattleAIPuzzle.
Implementations represent a specific type of puzzle check, such as verifying that the AI selected a particular move, switched to a specific Pokémon, or met some other battle-state condition.
Puzzle logic instances are serialized and deserialized through their registered
PuzzleType. The CODEC uses the puzzle type registry to dispatch
to the correct concrete codec based on type().
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionisValid(net.minecraft.world.level.Level level, BattleAIPuzzle puzzle) Validates the supplied puzzle against the current level state.PuzzleType<?> type()Gets the type of this puzzle logic.
-
Field Details
-
CODEC
-
-
Method Details
-
type
PuzzleType<?> type()Gets the type of this puzzle logic.The type is used for registry lookup and codec dispatch, allowing different puzzle logic implementations to be encoded and decoded polymorphically.
- Returns:
- The registered puzzle type for this logic.
-
isValid
Validates the supplied puzzle against the current level state.This is called once the puzzle has been executed and should return whether the puzzle's expected outcome was achieved.
- Parameters:
level- The level in which the puzzle is being tested.puzzle- The puzzle definition being validated.- Returns:
- The result of the validation.
-