pub struct PortalShape {
pub axis: Axis,
pub bottom_left: BlockPos,
pub width: u32,
pub height: u32,
pub right_dir: Direction,
pub portal: BlockRef,
num_portal_blocks: u32,
}Expand description
A detected portal shape with axis, position, and dimensions.
Fields§
§axis: AxisThe axis of the portal (X or Z).
bottom_left: BlockPosBottom-left corner of the portal interior.
width: u32Width of the interior (2-21).
height: u32Height of the interior (3-21).
right_dir: DirectionThe horizontal direction along which width is measured.
portal: BlockRefThe block type of the portal.
num_portal_blocks: u32Number of portal blocks found in the interior.
Used by is_complete to verify the portal is fully filled.
Implementations§
Source§impl PortalShape
impl PortalShape
Sourcepub fn find_empty_portal_shape(
world: &dyn LevelReader,
fire_pos: BlockPos,
config: &PortalFrameConfig,
) -> Option<Self>
pub fn find_empty_portal_shape( world: &dyn LevelReader, fire_pos: BlockPos, config: &PortalFrameConfig, ) -> Option<Self>
Finds an empty portal frame starting with X axis preferred.
Matches vanilla’s findEmptyPortalShape as called from BaseFireBlock.onPlace.
Sourcepub fn find_empty_portal_shape_with_axis(
world: &dyn LevelReader,
fire_pos: BlockPos,
preferred_axis: Axis,
config: &PortalFrameConfig,
) -> Option<Self>
pub fn find_empty_portal_shape_with_axis( world: &dyn LevelReader, fire_pos: BlockPos, preferred_axis: Axis, config: &PortalFrameConfig, ) -> Option<Self>
Finds an empty portal frame trying preferred_axis first, then the other.
Matches vanilla’s findPortalShape with the empty-portal predicate.
Sourcepub fn find_any_shape(
world: &dyn LevelReader,
pos: BlockPos,
axis: Axis,
config: &PortalFrameConfig,
) -> Option<Self>
pub fn find_any_shape( world: &dyn LevelReader, pos: BlockPos, axis: Axis, config: &PortalFrameConfig, ) -> Option<Self>
Finds a portal shape on a specific axis.
Used by update_shape to check if the portal is still complete.
Sourcefn try_axis(
world: &dyn LevelReader,
pos: BlockPos,
axis: Axis,
config: &PortalFrameConfig,
) -> Option<Self>
fn try_axis( world: &dyn LevelReader, pos: BlockPos, axis: Axis, config: &PortalFrameConfig, ) -> Option<Self>
Tries to find a valid portal on a single axis, matching vanilla’s detection algorithm.
Sourcefn get_distance_until_edge(
world: &dyn LevelReader,
pos: BlockPos,
direction: Direction,
config: &PortalFrameConfig,
) -> u32
fn get_distance_until_edge( world: &dyn LevelReader, pos: BlockPos, direction: Direction, config: &PortalFrameConfig, ) -> u32
Returns the number of valid interior blocks in direction from pos, matching vanilla’s
getDistanceUntilEdgeAboveFrame. Each position must be empty and have a frame block
below it. Returns 0 if the terminating block is not a frame block.
Sourcefn calculate_bottom_left(
world: &dyn LevelReader,
pos: BlockPos,
right_dir: Direction,
config: &PortalFrameConfig,
) -> Option<BlockPos>
fn calculate_bottom_left( world: &dyn LevelReader, pos: BlockPos, right_dir: Direction, config: &PortalFrameConfig, ) -> Option<BlockPos>
Finds the bottom-left corner of the portal interior.
Sourcefn calculate_width(
world: &dyn LevelReader,
bottom_left: BlockPos,
right_dir: Direction,
config: &PortalFrameConfig,
) -> u32
fn calculate_width( world: &dyn LevelReader, bottom_left: BlockPos, right_dir: Direction, config: &PortalFrameConfig, ) -> u32
Calculates the width of the portal interior from the bottom-left corner.
Sourcefn calculate_height(
world: &dyn LevelReader,
bottom_left: BlockPos,
width: u32,
right_dir: Direction,
config: &PortalFrameConfig,
portal_block_count: &mut u32,
) -> u32
fn calculate_height( world: &dyn LevelReader, bottom_left: BlockPos, width: u32, right_dir: Direction, config: &PortalFrameConfig, portal_block_count: &mut u32, ) -> u32
Calculates the height while validating side columns and interior.
Also counts portal blocks in the interior via portal_block_count.
Matches vanilla’s getDistanceUntilTop: always uses isEmpty (air/fire/portal)
for interior validation regardless of the outer interior check strategy.
Sourcefn has_top_frame(
world: &dyn LevelReader,
bottom_left: BlockPos,
height: u32,
width: u32,
right_dir: Direction,
config: &PortalFrameConfig,
) -> bool
fn has_top_frame( world: &dyn LevelReader, bottom_left: BlockPos, height: u32, width: u32, right_dir: Direction, config: &PortalFrameConfig, ) -> bool
Checks that the top frame row is complete.
fn is_frame_block( world: &dyn LevelReader, pos: BlockPos, config: &PortalFrameConfig, ) -> bool
Sourcepub const fn is_complete(&self) -> bool
pub const fn is_complete(&self) -> bool
Returns true if the portal interior is entirely filled with portal blocks.
Matches vanilla’s PortalShape.isComplete().
Sourcepub fn place_portal_blocks(&self, world: &Arc<World>)
pub fn place_portal_blocks(&self, world: &Arc<World>)
Fills the interior with nether portal blocks.
Vanilla uses flag 18 (UPDATE_CLIENTS | UPDATE_KNOWN_SHAPE) to avoid redundant neighbor
updates during bulk placement.
Sourcepub fn get_relative_position(
largest_rectangle_around: FoundRectangle,
axis: Axis,
position: DVec3,
dimensions: EntityDimensions,
) -> DVec3
pub fn get_relative_position( largest_rectangle_around: FoundRectangle, axis: Axis, position: DVec3, dimensions: EntityDimensions, ) -> DVec3
Returns vanilla PortalShape.getRelativePosition.
Auto Trait Implementations§
impl !RefUnwindSafe for PortalShape
impl !UnwindSafe for PortalShape
impl Freeze for PortalShape
impl Send for PortalShape
impl Sync for PortalShape
impl Unpin for PortalShape
impl UnsafeUnpin for PortalShape
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>