pub struct TickList<T: TickKey> {
pending_ticks: Option<Vec<SavedTick<T>>>,
ticks: BinaryHeap<QueuedTick<T>>,
scheduled: FxHashSet<ScheduledTickKey>,
next_insertion_order: u64,
}Expand description
Per-chunk storage for scheduled ticks of one type (block or fluid).
Saved and proto-chunk entries remain in pending_ticks until the chunk first
reaches block-ticking readiness. Live entries use absolute game-time deadlines.
A priority queue keeps live work ordered without scanning every tick.
Fields§
§pending_ticks: Option<Vec<SavedTick<T>>>§ticks: BinaryHeap<QueuedTick<T>>§scheduled: FxHashSet<ScheduledTickKey>§next_insertion_order: u64Implementations§
Source§impl<T: TickKey> TickList<T>
impl<T: TickKey> TickList<T>
Sourcepub(crate) fn new_pending() -> Self
pub(crate) fn new_pending() -> Self
Creates an empty proto-chunk list whose entries remain relative until the promoted Full chunk first becomes block-ticking.
Sourcepub(crate) fn from_saved_ticks(saved_ticks: Vec<SavedTick<T>>) -> Self
pub(crate) fn from_saved_ticks(saved_ticks: Vec<SavedTick<T>>) -> Self
Creates a tick list from relative-delay ticks loaded from chunk storage.
Vanilla assigns loaded entries the range -len..-1 in saved list order,
ensuring they execute before newly scheduled entries with equal timing
once the list is unpacked.
Sourcepub(crate) fn from_proto_saved_ticks(saved_ticks: Vec<SavedTick<T>>) -> Self
pub(crate) fn from_proto_saved_ticks(saved_ticks: Vec<SavedTick<T>>) -> Self
Creates a proto-chunk tick list from relative-delay storage entries.
ProtoChunkTicks.load schedules saved entries individually, so duplicate
(pos, type) keys are discarded while preserving the first entry. Full
chunk loading intentionally uses Self::from_saved_ticks instead because
LevelChunkTicks retains its saved list exactly as stored.
Sourcepub(crate) fn schedule(
&mut self,
tick_type: T,
pos: BlockPos,
trigger_tick: i64,
priority: TickPriority,
sub_tick_order: i64,
) -> bool
pub(crate) fn schedule( &mut self, tick_type: T, pos: BlockPos, trigger_tick: i64, priority: TickPriority, sub_tick_order: i64, ) -> bool
Schedules a live tick with an absolute world game-time deadline.
Returns true if the tick was added, or false when the same (pos, type)
is already scheduled.
Sourcepub(crate) fn schedule_pending(
&mut self,
tick_type: T,
pos: BlockPos,
priority: TickPriority,
) -> bool
pub(crate) fn schedule_pending( &mut self, tick_type: T, pos: BlockPos, priority: TickPriority, ) -> bool
Stores a proto-chunk tick with Vanilla’s fixed zero delay.
fn schedule_saved_pending(&mut self, saved_tick: SavedTick<T>) -> bool
Sourcepub(crate) fn has_tick(&self, pos: BlockPos, tick_type: T) -> bool
pub(crate) fn has_tick(&self, pos: BlockPos, tick_type: T) -> bool
Returns true if a tick is scheduled for the given (pos, type).
Sourcepub(crate) fn pending_entries(&self) -> &[SavedTick<T>]
pub(crate) fn pending_entries(&self) -> &[SavedTick<T>]
Returns the saved entries that have not yet been anchored to game time.
Sourcepub(crate) fn remove_pending_matching(
&mut self,
predicate: impl FnMut(&SavedTick<T>) -> bool,
) -> usize
pub(crate) fn remove_pending_matching( &mut self, predicate: impl FnMut(&SavedTick<T>) -> bool, ) -> usize
Removes pending entries matching predicate while keeping deduplication in sync.
pub(super) fn packing_snapshot(&self) -> TickListPackingSnapshot<T>
Sourcepub(crate) fn unpack(&mut self, current_tick: i64)
pub(crate) fn unpack(&mut self, current_tick: i64)
Converts pending saved/proto ticks into live absolute-time ordering.
This mirrors LevelChunkTicks.unpack: delays are anchored to current_tick
and entries receive negative sub-tick orders in saved-list order. Repeated
calls are no-ops, so later readiness changes cannot re-anchor deadlines.
fn push_unchecked(&mut self, tick: ScheduledTick<T>)
pub(super) fn peek(&self) -> Option<ScheduledTick<T>>
pub(super) fn peek_ready(&self, current_tick: i64) -> Option<ScheduledTick<T>>
pub(super) fn pop_ready( &mut self, current_tick: i64, ) -> Option<ScheduledTick<T>>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TickList<T>
impl<T> RefUnwindSafe for TickList<T>where
T: RefUnwindSafe,
impl<T> Send for TickList<T>where
T: Send,
impl<T> Sync for TickList<T>where
T: Sync,
impl<T> Unpin for TickList<T>where
T: Unpin,
impl<T> UnsafeUnpin for TickList<T>
impl<T> UnwindSafe for TickList<T>where
T: UnwindSafe,
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<>>