pub struct WorldMap {
worlds: FxSmallMap<8, Identifier, Arc<World>>,
default_domain: String,
default_worlds: FxHashMap<String, Identifier>,
nether_portal_targets: FxHashMap<Identifier, Identifier>,
end_portal_targets: FxHashMap<Identifier, Identifier>,
}Expand description
Loaded worlds plus domain defaults.
Fields§
§worlds: FxSmallMap<8, Identifier, Arc<World>>§default_domain: String§default_worlds: FxHashMap<String, Identifier>§nether_portal_targets: FxHashMap<Identifier, Identifier>§end_portal_targets: FxHashMap<Identifier, Identifier>Implementations§
Source§impl WorldMap
impl WorldMap
Sourcepub fn new(
default_domain: String,
domains: &[ResolvedDomainConfig],
world_configs: &[ResolvedWorldConfig],
) -> Self
pub fn new( default_domain: String, domains: &[ResolvedDomainConfig], world_configs: &[ResolvedWorldConfig], ) -> Self
Creates a world map from resolved domain config.
Sourcepub fn insert(&mut self, key: Identifier, world: Arc<World>)
pub fn insert(&mut self, key: Identifier, world: Arc<World>)
Inserts a loaded world.
Sourcepub fn get(&self, key: &Identifier) -> Option<&Arc<World>>
pub fn get(&self, key: &Identifier) -> Option<&Arc<World>>
Returns a world by loaded world identifier.
Sourcepub fn keys(&self) -> impl Iterator<Item = &Identifier>
pub fn keys(&self) -> impl Iterator<Item = &Identifier>
Iterates loaded world keys.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&Identifier, &Arc<World>)>
pub fn iter(&self) -> impl Iterator<Item = (&Identifier, &Arc<World>)>
Iterates loaded world key/value pairs.
Sourcepub fn default_domain(&self) -> &str
pub fn default_domain(&self) -> &str
Returns the default domain name.
Sourcepub fn has_domain(&self, domain: &str) -> bool
pub fn has_domain(&self, domain: &str) -> bool
Returns whether a domain exists.
Sourcepub fn domain_names(&self) -> impl Iterator<Item = &str>
pub fn domain_names(&self) -> impl Iterator<Item = &str>
Iterates domain names.
Sourcepub fn default_world(&self, domain: &str) -> Option<&Arc<World>>
pub fn default_world(&self, domain: &str) -> Option<&Arc<World>>
Returns a domain’s default world.
Sourcepub fn server_default_world(&self) -> Option<&Arc<World>>
pub fn server_default_world(&self) -> Option<&Arc<World>>
Returns the server default world.
Sourcepub fn worlds_in_domain(&self, domain: &str) -> Vec<Arc<World>>
pub fn worlds_in_domain(&self, domain: &str) -> Vec<Arc<World>>
Returns loaded worlds in the given domain.
Sourcepub fn resolve_portal_target(
&self,
source_world: &World,
target_world_name: &str,
) -> Option<Arc<World>>
pub fn resolve_portal_target( &self, source_world: &World, target_world_name: &str, ) -> Option<Arc<World>>
Resolves a conventional portal target name in the source world’s domain.
Sourcepub fn resolve_nether_portal_target(
&self,
source_world: &World,
) -> Option<Arc<World>>
pub fn resolve_nether_portal_target( &self, source_world: &World, ) -> Option<Arc<World>>
Resolves the vanilla Nether portal target in the source world’s domain.
Sourcepub fn resolve_end_entry_portal_target(
&self,
source_world: &World,
) -> Option<Arc<World>>
pub fn resolve_end_entry_portal_target( &self, source_world: &World, ) -> Option<Arc<World>>
Resolves the vanilla End portal target for non-End source worlds.
End-to-respawn-world transitions depend on the source world’s respawn data, so that branch is intentionally left to the destination calculator.
Auto Trait Implementations§
impl !RefUnwindSafe for WorldMap
impl !UnwindSafe for WorldMap
impl Freeze for WorldMap
impl Send for WorldMap
impl Sync for WorldMap
impl Unpin for WorldMap
impl UnsafeUnpin for WorldMap
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<>>