pub(crate) struct PlayerSpawnSearch {
spawn_suggestion: BlockPos,
sequence: CandidateSequence,
next_candidate_index: i32,
pending: Option<PendingSpawnCandidate>,
loading: Option<ChunkLoad>,
fallback: Option<FallbackPass>,
prefetch: Option<ChunkRequestHandle>,
}Expand description
Evaluates candidates in vanilla’s order, each once at its turn.
Fields§
§spawn_suggestion: BlockPos§sequence: CandidateSequence§next_candidate_index: i32§pending: Option<PendingSpawnCandidate>§loading: Option<ChunkLoad>§fallback: Option<FallbackPass>Tries safe standing spots before the vanilla height fixup.
prefetch: Option<ChunkRequestHandle>Implementations§
Source§impl PlayerSpawnSearch
impl PlayerSpawnSearch
Sourcepub(super) fn poll_fallback_pass(
&mut self,
world: &Arc<World>,
budget: &mut PollBudget,
) -> FallbackPoll
pub(super) fn poll_fallback_pass( &mut self, world: &Arc<World>, budget: &mut PollBudget, ) -> FallbackPoll
Scans the candidate columns for a standing spot, loading one chunk at a time.
Source§impl PlayerSpawnSearch
impl PlayerSpawnSearch
pub(crate) fn new( world: &Arc<World>, spawn_suggestion: BlockPos, game_type: GameType, ) -> Result<Self, String>
Sourcepub(crate) fn with_safe_fallback(self) -> Self
pub(crate) fn with_safe_fallback(self) -> Self
Tries a standing spot that avoids fluid and a ceiling dimension’s roof before the vanilla height fixup.
Sourcefn search_radius(
world: &Arc<World>,
spawn_suggestion: BlockPos,
game_type: GameType,
) -> Option<i32>
fn search_radius( world: &Arc<World>, spawn_suggestion: BlockPos, game_type: GameType, ) -> Option<i32>
The radius, in blocks, of the square searched around spawn_suggestion, or None when
the game mode skips the search.
Sourcepub(crate) fn prefetch_spawn_area(
world: &Arc<World>,
spawn_suggestion: BlockPos,
game_type: GameType,
) -> Option<ChunkRequestHandle>
pub(crate) fn prefetch_spawn_area( world: &Arc<World>, spawn_suggestion: BlockPos, game_type: GameType, ) -> Option<ChunkRequestHandle>
Requests the radius-3 chunk square around spawn_suggestion before the search starts. A
search wider than BLOCKS_PER_CHUNK blocks gets no prefetch. See Self::with_prefetch.
Sourcepub(crate) fn with_prefetch(self, prefetch: Option<ChunkRequestHandle>) -> Self
pub(crate) fn with_prefetch(self, prefetch: Option<ChunkRequestHandle>) -> Self
Adopts a request made by Self::prefetch_spawn_area.
pub(crate) fn poll(&mut self, world: &Arc<World>) -> PlayerSpawnSearchPoll
Sourcepub(crate) fn poll_with_time_budget(
&mut self,
world: &Arc<World>,
time_budget: Duration,
) -> PlayerSpawnSearchPoll
pub(crate) fn poll_with_time_budget( &mut self, world: &Arc<World>, time_budget: Duration, ) -> PlayerSpawnSearchPoll
Polls the search, evaluating candidates for about time_budget.
Sourcefn poll_fixup(
&mut self,
world: &Arc<World>,
pending: PendingSpawnCandidate,
budget: &mut PollBudget,
) -> PlayerSpawnSearchPoll
fn poll_fixup( &mut self, world: &Arc<World>, pending: PendingSpawnCandidate, budget: &mut PollBudget, ) -> PlayerSpawnSearchPoll
Ends a search in which every candidate failed.
Sourcefn chunk_is_held(&self, chunk: ChunkPos) -> bool
fn chunk_is_held(&self, chunk: ChunkPos) -> bool
Whether the prefetch holds chunk: it is in the square and the tickets are committed.
Sourcefn poll_loading(
&mut self,
world: &Arc<World>,
chunk: ChunkPos,
next_scan: i32,
) -> LoadPoll
fn poll_loading( &mut self, world: &Arc<World>, chunk: ChunkPos, next_scan: i32, ) -> LoadPoll
Reuses a prefetched chunk; otherwise waits for a new request’s tickets to commit.
Sourcefn poll_candidate_chunk(
&mut self,
world: &Arc<World>,
pending: PendingSpawnCandidate,
budget: &PollBudget,
) -> Result<ChunkLoad, PlayerSpawnSearchPoll>
fn poll_candidate_chunk( &mut self, world: &Arc<World>, pending: PendingSpawnCandidate, budget: &PollBudget, ) -> Result<ChunkLoad, PlayerSpawnSearchPoll>
Waits for the candidate’s chunk, keeping the load open while the budget is spent.
fn evaluate_candidate( world: &Arc<World>, index: i32, sequence: &CandidateSequence, ) -> Option<BlockPos>
const fn next_candidate(&mut self) -> PendingSpawnCandidate
Auto Trait Implementations§
impl !RefUnwindSafe for PlayerSpawnSearch
impl !UnwindSafe for PlayerSpawnSearch
impl Freeze for PlayerSpawnSearch
impl Send for PlayerSpawnSearch
impl Sync for PlayerSpawnSearch
impl Unpin for PlayerSpawnSearch
impl UnsafeUnpin for PlayerSpawnSearch
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<>>