Interface PortalValidator
- All Known Implementing Classes:
FlatPortalFrameTester, PortalFrameTester, VerticalPortalFrameTester
public interface PortalValidator
Interface for validating portal frame structures. Responsible for checking if a portal frame is valid and properly
formed.
-
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.core.BlockPosdoesPortalFitAt(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos attemptPos, net.minecraft.core.Direction.Axis axis) Check if a portal of the appropriate size can fit at the given position.net.minecraft.util.BlockUtil.FoundRectangleGet the rectangular bounds of the validated portal frame.init(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos blockPos, net.minecraft.core.Direction.Axis axis, net.minecraft.world.level.block.Block... foundations) Initialize the validator with the given parameters and scan for a valid portal frame.booleanCheck if the portal frame is already lit (contains portal blocks).booleanisRequestedSize(int attemptWidth, int attemptHeight) Check if the portal frame matches the requested size constraints.booleanCheck if the current portal frame structure is valid.
-
Method Details
-
init
PortalValidator init(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos blockPos, net.minecraft.core.Direction.Axis axis, net.minecraft.world.level.block.Block... foundations) Initialize the validator with the given parameters and scan for a valid portal frame.- Parameters:
level- the level to scan inblockPos- the starting position to checkaxis- the axis along which the portal is orientedfoundations- the blocks that can serve as portal frame blocks- Returns:
- this validator instance for method chaining
-
isAlreadyLitPortalFrame
boolean isAlreadyLitPortalFrame()Check if the portal frame is already lit (contains portal blocks).- Returns:
- true if the portal is already lit
-
isValidFrame
boolean isValidFrame()Check if the current portal frame structure is valid.- Returns:
- true if the frame is valid
-
isRequestedSize
boolean isRequestedSize(int attemptWidth, int attemptHeight) Check if the portal frame matches the requested size constraints.- Parameters:
attemptWidth- the required width (0 for no constraint)attemptHeight- the required height (0 for no constraint)- Returns:
- true if the size matches the constraints
-
getRectangle
@Nullable net.minecraft.util.BlockUtil.FoundRectangle getRectangle()Get the rectangular bounds of the validated portal frame.- Returns:
- the portal rectangle, or null if no valid frame was found
-
doesPortalFitAt
@Nullable @Nullable net.minecraft.core.BlockPos doesPortalFitAt(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos attemptPos, net.minecraft.core.Direction.Axis axis) Check if a portal of the appropriate size can fit at the given position.- Parameters:
level- the level to check inattemptPos- the position to attempt portal placementaxis- the axis along which the portal should be oriented- Returns:
- the position where the portal can fit, or null if it cannot
-