pub struct PortalProcessor {
portal: PortalKind,
entry_position: BlockPos,
portal_time: i32,
inside_portal_this_tick: bool,
}Expand description
Per-entity portal timer state.
Mirrors vanilla PortalProcessor: the active portal kind, the entry block
position, the accumulated portal time, and whether the entity touched the
portal during the current tick.
Fields§
§portal: PortalKind§entry_position: BlockPos§portal_time: i32§inside_portal_this_tick: boolImplementations§
Source§impl PortalProcessor
impl PortalProcessor
Sourcepub const fn new(portal: PortalKind, entry_position: BlockPos) -> Self
pub const fn new(portal: PortalKind, entry_position: BlockPos) -> Self
Creates a portal process for a freshly entered portal.
Sourcepub const fn portal(self) -> PortalKind
pub const fn portal(self) -> PortalKind
Returns the tracked portal kind.
Sourcepub const fn entry_position(self) -> BlockPos
pub const fn entry_position(self) -> BlockPos
Returns the portal block position the entity entered from.
Sourcepub const fn portal_time(self) -> i32
pub const fn portal_time(self) -> i32
Returns the accumulated portal time.
Sourcepub const fn is_inside_portal_this_tick(self) -> bool
pub const fn is_inside_portal_this_tick(self) -> bool
Returns whether the entity touched this portal during the current tick.
Sourcepub fn is_same_portal(self, portal: PortalKind) -> bool
pub fn is_same_portal(self, portal: PortalKind) -> bool
Returns true if this process tracks the same portal behavior.
Sourcepub const fn set_as_inside_portal(&mut self, entry_position: BlockPos)
pub const fn set_as_inside_portal(&mut self, entry_position: BlockPos)
Marks this process as touched by the entity for the current tick.
Sourcepub fn process_portal_teleportation(
&mut self,
allowed_to_teleport: bool,
transition_time: i32,
) -> PortalProcessResult
pub fn process_portal_teleportation( &mut self, allowed_to_teleport: bool, transition_time: i32, ) -> PortalProcessResult
Advances vanilla portal timing for one server tick.
fn decay_tick(&mut self)
Sourcepub const fn has_expired(self) -> bool
pub const fn has_expired(self) -> bool
Returns true when vanilla would clear the active portal process.
Trait Implementations§
Source§impl Clone for PortalProcessor
impl Clone for PortalProcessor
Source§fn clone(&self) -> PortalProcessor
fn clone(&self) -> PortalProcessor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PortalProcessor
Source§impl Debug for PortalProcessor
impl Debug for PortalProcessor
impl Eq for PortalProcessor
Source§impl PartialEq for PortalProcessor
impl PartialEq for PortalProcessor
impl StructuralPartialEq for PortalProcessor
Auto Trait Implementations§
impl Freeze for PortalProcessor
impl RefUnwindSafe for PortalProcessor
impl Send for PortalProcessor
impl Sync for PortalProcessor
impl Unpin for PortalProcessor
impl UnsafeUnpin for PortalProcessor
impl UnwindSafe for PortalProcessor
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compares
self with key and returns true if they are equal.§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> ⓘ
Converts
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> ⓘ
Converts
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 moreWraps this value in an
Arc<SyncMutex<>>