pub struct PointOfInterest {
pub pos: BlockPos,
pub poi_type_id: usize,
pub free_tickets: u32,
}Expand description
A single point of interest at a specific block position.
Tracks the POI type and available tickets (e.g., a bed has 1 ticket that gets reserved when a villager claims it).
Fields§
§pos: BlockPosThe block position of this POI.
poi_type_id: usizeThe registry ID of this POI’s type.
free_tickets: u32Number of tickets still available for claiming.
Implementations§
Source§impl PointOfInterest
impl PointOfInterest
Sourcepub const fn new(pos: BlockPos, poi_type_id: usize, max_tickets: u32) -> Self
pub const fn new(pos: BlockPos, poi_type_id: usize, max_tickets: u32) -> Self
Creates a new POI with all tickets available.
Sourcepub const fn reserve_ticket(&mut self) -> bool
pub const fn reserve_ticket(&mut self) -> bool
Attempts to reserve a ticket. Returns true if successful.
Sourcepub const fn release_ticket(&mut self, max_tickets: u32) -> bool
pub const fn release_ticket(&mut self, max_tickets: u32) -> bool
Releases a previously reserved ticket. Returns true if successful.
Sourcepub const fn is_occupied(&self, max_tickets: u32) -> bool
pub const fn is_occupied(&self, max_tickets: u32) -> bool
Returns true if at least one ticket has been reserved.
Vanilla equivalent: freeTickets != maxTickets.
Trait Implementations§
Source§impl Clone for PointOfInterest
impl Clone for PointOfInterest
Source§fn clone(&self) -> PointOfInterest
fn clone(&self) -> PointOfInterest
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 moreAuto Trait Implementations§
impl Freeze for PointOfInterest
impl RefUnwindSafe for PointOfInterest
impl Send for PointOfInterest
impl Sync for PointOfInterest
impl Unpin for PointOfInterest
impl UnsafeUnpin for PointOfInterest
impl UnwindSafe for PointOfInterest
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<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<>>