pub struct World {Show 30 fields
pub chunk_map: Arc<ChunkMap>,
pub players: PlayerMap,
pub player_area_map: PlayerAreaMap,
pub key: Identifier,
pub dimension_type: DimensionTypeRef,
pub level_data: SyncRwLock<LevelDataManager>,
pub(crate) saved_data: SavedDataManager,
world_border: SyncMutex<WorldBorder>,
pub view_distance: u8,
pub simulation_distance: u8,
pub compression: Option<CompressionInfo>,
pub is_flat: bool,
pub sea_level: i32,
pub default_gamemode: GameType,
tick_runs_normally: AtomicBool,
handling_tick: AtomicBool,
block_events: SyncMutex<BlockEventQueue>,
neighbor_updater: CollectingNeighborUpdater,
entity_manager: WorldEntityManager,
block_entity_tickers: WorldBlockEntityTickers,
game_event_listener_count: Arc<GameEventListenerCount>,
entity_tracker: EntityTracker,
navigating_mobs: NavigatingMobTracker,
pub weather: SyncMutex<Weather>,
redstone_torch_toggles: SyncMutex<RedstoneTorchToggleTracker>,
scheduled_ticks: WorldTickScheduler,
scheduled_block_ticks_this_tick: SyncMutex<Option<Arc<ScheduledTickRunBatch<BlockRef>>>>,
scheduled_fluid_ticks_this_tick: SyncMutex<Option<Arc<ScheduledTickRunBatch<FluidRef>>>>,
pub poi_storage: SyncMutex<PointOfInterestStorage>,
pending_world_changes: SyncMutex<Vec<(SharedEntity, WorldChangeRequest)>>,
}Expand description
A struct that represents a world.
Fields§
§chunk_map: Arc<ChunkMap>The chunk map of the world.
players: PlayerMapAll players in the world with dual indexing by UUID and entity ID.
player_area_map: PlayerAreaMapSpatial index for player proximity queries.
key: IdentifierLoaded world identifier (domain:world).
dimension_type: DimensionTypeRefVanilla dimension type for this loaded world.
Vanilla often calls loaded worlds “dimensions”. In Steel, World is the
loaded world instance and dimension_type is the vanilla registry entry
controlling height, skylight, ceiling, water evaporation, etc.
level_data: SyncRwLock<LevelDataManager>Level data manager for persistent world state.
saved_data: SavedDataManagerPer-world saved data storage.
world_border: SyncMutex<WorldBorder>Runtime world border state.
view_distance: u8Server view distance (maximum chunk radius).
simulation_distance: u8Server simulation distance.
compression: Option<CompressionInfo>Compression settings for encoding broadcast packets.
is_flat: boolWhether the world should be marked as flat in login/respawn packets.
sea_level: i32Sea level sent in login/respawn packets.
default_gamemode: GameTypeDefault game mode for first-visit player data.
tick_runs_normally: AtomicBoolWhether the tick rate is running normally (not frozen/paused). When false, movement validation checks are skipped.
handling_tick: AtomicBoolWhether vanilla’s scheduled/chunk/block-event tick phase is active.
block_events: SyncMutex<BlockEventQueue>Ordered, duplicate-suppressing server block events awaiting execution.
neighbor_updater: CollectingNeighborUpdaterVanilla collecting neighbor updater shared by all live block mutations.
entity_manager: WorldEntityManagerCentral runtime entity ownership and lookup.
block_entity_tickers: WorldBlockEntityTickersWorld-global ordered block-entity ticker phase.
game_event_listener_count: Arc<GameEventListenerCount>Physical entries retained by this world’s chunk-owned game-event registries.
entity_tracker: EntityTrackerEntity tracker for managing which players can see which entities.
Runtime IDs for pathfinder mobs currently visible to the active world.
weather: SyncMutex<Weather>Weather Data needed for animating starting and stopping of rain clientside
redstone_torch_toggles: SyncMutex<RedstoneTorchToggleTracker>Per-level recent toggle history used by vanilla redstone-torch burnout.
scheduled_ticks: WorldTickSchedulerWorld registration and sparse head index for chunk-owned scheduled ticks.
scheduled_block_ticks_this_tick: SyncMutex<Option<Arc<ScheduledTickRunBatch<BlockRef>>>>Published block batch used by willTickThisTick queries during callbacks.
scheduled_fluid_ticks_this_tick: SyncMutex<Option<Arc<ScheduledTickRunBatch<FluidRef>>>>Published fluid batch used by willTickThisTick queries during callbacks.
poi_storage: SyncMutex<PointOfInterestStorage>Point of interest storage for efficient spatial queries of special blocks.
pending_world_changes: SyncMutex<Vec<(SharedEntity, WorldChangeRequest)>>World-change requests queued by world-local ticks for server safe-point processing.
Implementations§
Source§impl World
impl World
Sourcepub fn block_event(
&self,
pos: BlockPos,
block: BlockRef,
param_a: i32,
param_b: i32,
)
pub fn block_event( &self, pos: BlockPos, block: BlockRef, param_a: i32, param_b: i32, )
Queues a server block event for the next eligible block-event pass.
Exact duplicates are suppressed while queued. Parameters remain i32
for Vanilla behavior parity and are truncated to bytes only for the
client packet.
Sourcepub(crate) fn run_block_events(self: &Arc<Self>)
pub(crate) fn run_block_events(self: &Arc<Self>)
Runs queued block events in Vanilla insertion order.
Vanilla gates this queue only on simulation range and may synchronously load chunks from a piston callback. Steel additionally requires the confirmed radius-1 Full neighborhood so the game tick never waits for chunk I/O. Deferred events retain their Vanilla retry behavior.
fn do_block_event(self: &Arc<Self>, event: BlockEventData) -> bool
fn broadcast_block_event(&self, event: BlockEventData)
Source§impl World
impl World
Sourcepub(crate) fn try_with_block_region<R>(
&self,
bounds: BlockRegionBounds,
f: impl FnOnce(&BlockRegionRead<'_>) -> R,
) -> Option<R>
pub(crate) fn try_with_block_region<R>( &self, bounds: BlockRegionBounds, f: impl FnOnce(&BlockRegionRead<'_>) -> R, ) -> Option<R>
Acquires every loaded section intersecting a small bounds once and exposes a scoped read
view.
Setup and lock count scale with every intersecting chunk and section, so this is an internal primitive for bounded synchronous gameplay queries rather than arbitrary or player-controlled regions.
The callback must use BlockRegionRead for reads covered by bounds and must not perform
world writes. Re-entering a world read for a covered section can deadlock if a writer is
already waiting because the requested section read guards remain held until the callback
returns.
Source§impl World
impl World
Sourcepub fn get_block_state(&self, pos: BlockPos) -> BlockStateId
pub fn get_block_state(&self, pos: BlockPos) -> BlockStateId
Gets the block state at the given position.
Returns void air out of bounds and air when the containing chunk is not loaded.
Sourcepub fn light_value_at(&self, layer: LightLayer, pos: BlockPos) -> u8
pub fn light_value_at(&self, layer: LightLayer, pos: BlockPos) -> u8
Vanilla equivalent: level.getBrightness()
pub(crate) fn is_entity_ticking_chunk_loaded(&self, pos: BlockPos) -> bool
pub(crate) fn is_full_chunk_loaded_at(&self, pos: BlockPos) -> bool
pub(crate) fn queue_light_change_after_block_set( &self, pos: BlockPos, old_state: BlockStateId, new_state: BlockStateId, empty_section_change: Option<LightSectionEmptinessChange>, )
pub(super) const fn default_light_value(&self, layer: LightLayer) -> u8
Sourcepub fn block_states_in_aabb_are_air(&self, aabb: WorldAabb) -> bool
pub fn block_states_in_aabb_are_air(&self, aabb: WorldAabb) -> bool
Returns whether every block state in the vanilla AABB block range is air.
Matches BlockGetter.getBlockStates(AABB) using
BlockPos.betweenClosedStream(AABB): both min and max coordinates are
floored before iterating the inclusive block range. Large ranges fall back
to streaming reads instead of acquiring an unbounded section workset.
Sourcepub fn set_block(
self: &Arc<Self>,
pos: BlockPos,
block_state: BlockStateId,
flags: UpdateFlags,
) -> bool
pub fn set_block( self: &Arc<Self>, pos: BlockPos, block_state: BlockStateId, flags: UpdateFlags, ) -> bool
Sets a block at the given position.
Returns true if the block was successfully set, false otherwise.
Uses the default update limit of 512 (matching vanilla).
Live gameplay callers must run in Steel’s serialized world-mutation phase. Palette and block-entity ownership claims are atomic, but the following Vanilla-ordered callbacks, neighbor updates, and derived-cache writes are intentionally not one concurrent transaction for the same position.
Sourcepub fn set_block_with_limit(
self: &Arc<Self>,
pos: BlockPos,
block_state: BlockStateId,
flags: UpdateFlags,
update_limit: i32,
) -> bool
pub fn set_block_with_limit( self: &Arc<Self>, pos: BlockPos, block_state: BlockStateId, flags: UpdateFlags, update_limit: i32, ) -> bool
Sets a block at the given position with a custom update limit.
The update limit bounds recursive shape propagation. The block mutation itself still occurs when the limit is zero or negative, matching vanilla.
Returns true if the block was successfully set, false otherwise.
See Self::set_block for the serialized world-mutation requirement.
Sourcepub fn set_block_if_unchanged(
self: &Arc<Self>,
pos: BlockPos,
expected_state: BlockStateId,
new_state: BlockStateId,
flags: UpdateFlags,
) -> ConditionalBlockSetResult
pub fn set_block_if_unchanged( self: &Arc<Self>, pos: BlockPos, expected_state: BlockStateId, new_state: BlockStateId, flags: UpdateFlags, ) -> ConditionalBlockSetResult
Replaces a block only if it still has expected_state.
The comparison and palette write are performed under one chunk-section write lock. This prevents two consumers of the same observed block state from both succeeding. Block callbacks still run after that state claim, so callers must remain in a serialized world-mutation phase such as an exclusive packet handler or ordered tick commit.
Sourcepub fn set_block_if_unchanged_with_limit(
self: &Arc<Self>,
pos: BlockPos,
expected_state: BlockStateId,
new_state: BlockStateId,
flags: UpdateFlags,
update_limit: i32,
) -> ConditionalBlockSetResult
pub fn set_block_if_unchanged_with_limit( self: &Arc<Self>, pos: BlockPos, expected_state: BlockStateId, new_state: BlockStateId, flags: UpdateFlags, update_limit: i32, ) -> ConditionalBlockSetResult
Conditional variant of Self::set_block_with_limit.
pub(super) fn finish_block_set( self: &Arc<Self>, pos: BlockPos, old_state: BlockStateId, block_state: BlockStateId, flags: UpdateFlags, update_limit: i32, )
pub(super) fn block_collision_shape_changed( &self, pos: BlockPos, old_state: BlockStateId, new_state: BlockStateId, ) -> bool
pub(super) fn block_collision_shape( &self, pos: BlockPos, state: BlockStateId, ) -> VoxelShape
Sourcepub fn update_neighbors_at(
self: &Arc<Self>,
pos: BlockPos,
source_block: BlockRef,
)
pub fn update_neighbors_at( self: &Arc<Self>, pos: BlockPos, source_block: BlockRef, )
Updates all neighbors of the given position about a block change.
This is the Rust equivalent of vanilla’s Level.updateNeighborsAt().
Sourcepub fn update_neighbors_at_except_from_facing(
self: &Arc<Self>,
pos: BlockPos,
source_block: BlockRef,
skip_direction: Direction,
)
pub fn update_neighbors_at_except_from_facing( self: &Arc<Self>, pos: BlockPos, source_block: BlockRef, skip_direction: Direction, )
Updates all neighbors except the one in skip_direction.
Mirrors vanilla Level.updateNeighborsAtExceptFromFacing without the
experimental redstone Orientation value.
Sourcepub(crate) fn update_neighbor_for_output_signal(
self: &Arc<Self>,
pos: BlockPos,
changed_block: BlockRef,
)
pub(crate) fn update_neighbor_for_output_signal( self: &Arc<Self>, pos: BlockPos, changed_block: BlockRef, )
Updates comparators that can read analog output from pos.
Mirrors vanilla Level.updateNeighbourForOutputSignal.
Steel intentionally never synchronously loads the second neighbor chunk:
block-ticking chunks have a radius-one Full-chunk safety border, while
other call sites retain the game-tick no-blocking policy.
pub(crate) fn update_neighbour_shapes( self: &Arc<Self>, state: BlockStateId, pos: BlockPos, flags: UpdateFlags, update_limit: i32, )
Sourcepub(crate) fn update_from_neighbor_shapes(
self: &Arc<Self>,
state: BlockStateId,
pos: BlockPos,
) -> BlockStateId
pub(crate) fn update_from_neighbor_shapes( self: &Arc<Self>, state: BlockStateId, pos: BlockPos, ) -> BlockStateId
Recomputes a state against all neighbors in vanilla shape-update order.
Sourcepub(crate) fn neighbor_shape_changed(
self: &Arc<Self>,
direction: Direction,
pos: BlockPos,
neighbor_pos: BlockPos,
neighbor_state: BlockStateId,
flags: UpdateFlags,
update_limit: i32,
)
pub(crate) fn neighbor_shape_changed( self: &Arc<Self>, direction: Direction, pos: BlockPos, neighbor_pos: BlockPos, neighbor_state: BlockStateId, flags: UpdateFlags, update_limit: i32, )
Called when a neighbor’s shape changes, to update this block’s state.
This is the Rust equivalent of vanilla’s NeighborUpdater.executeShapeUpdate().
pub(super) fn execute_neighbor_shape_update( self: &Arc<Self>, direction: Direction, pos: BlockPos, neighbor_pos: BlockPos, neighbor_state: BlockStateId, flags: UpdateFlags, update_limit: i32, )
pub(crate) fn update_or_destroy( self: &Arc<World>, old_state: BlockStateId, new_state: BlockStateId, pos: BlockPos, flags: UpdateFlags, recursion_left: i32, )
Sourcepub(crate) fn update_neighbour_on_block_set(
self: &Arc<Self>,
pos: BlockPos,
old_state: BlockStateId,
)
pub(crate) fn update_neighbour_on_block_set( self: &Arc<Self>, pos: BlockPos, old_state: BlockStateId, )
Called when a block changed with a command (setblock, fill, …)
This is the Rust equivalent of vanilla’s ServerLevel.updateNeighborsOnBlockSet().
Sourcepub(crate) fn neighbor_changed(
self: &Arc<Self>,
pos: BlockPos,
source_block: BlockRef,
)
pub(crate) fn neighbor_changed( self: &Arc<Self>, pos: BlockPos, source_block: BlockRef, )
Notifies a block that one of its neighbors changed.
This is the Rust equivalent of vanilla’s Level.neighborChanged().
pub(crate) fn neighbor_changed_with_state( self: &Arc<Self>, state: BlockStateId, pos: BlockPos, source_block: BlockRef, moved_by_piston: bool, )
pub(super) fn execute_neighbor_update( self: &Arc<Self>, state: BlockStateId, pos: BlockPos, source_block: BlockRef, moved_by_piston: bool, )
pub(super) const fn chunk_pos_for_block(pos: BlockPos) -> ChunkPos
Sourcepub fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>
pub fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>
Gets a block entity at the given position.
Returns None if the chunk is not loaded or there is no block entity at the position.
Sourcepub(crate) fn set_block_entity(&self, block_entity: SharedBlockEntity) -> bool
pub(crate) fn set_block_entity(&self, block_entity: SharedBlockEntity) -> bool
Adds a block entity to the loaded full chunk at its position.
Sourcepub(crate) fn remove_block_entity_if_same(
&self,
expected: &dyn BlockEntity,
) -> bool
pub(crate) fn remove_block_entity_if_same( &self, expected: &dyn BlockEntity, ) -> bool
Removes a block entity only while it still owns its position.
Sourcepub fn block_entity_changed(&self, pos: BlockPos)
pub fn block_entity_changed(&self, pos: BlockPos)
Called when a block entity’s data changes.
Marks the containing chunk as unsaved so it will be persisted to disk.
Sourcepub(crate) fn send_block_updated(&self, pos: BlockPos)
pub(crate) fn send_block_updated(&self, pos: BlockPos)
Queues a same-state block update and its block-entity update packet.
Mirrors vanilla Level.sendBlockUpdated for callers that changed only
block-entity data.
Sourcepub fn mark_chunk_dirty(&self, chunk_pos: ChunkPos)
pub fn mark_chunk_dirty(&self, chunk_pos: ChunkPos)
Marks a chunk as dirty (unsaved) so it will be persisted to disk.
Called when entities move, are added/removed, or when block entities change.
Source§impl World
impl World
pub(crate) fn world_border_snapshot(&self) -> WorldBorderSnapshot
Sourcepub fn is_block_within_world_border(&self, pos: BlockPos) -> bool
pub fn is_block_within_world_border(&self, pos: BlockPos) -> bool
Returns whether a block position is inside this world’s vanilla world border.
Sourcepub fn clamp_to_world_border(&self, x: f64, y: f64, z: f64) -> BlockPos
pub fn clamp_to_world_border(&self, x: f64, y: f64, z: f64) -> BlockPos
Clamps a world-space position to this world’s vanilla world border and floors it to a block position.
pub(crate) fn initialize_border_packet(&self) -> CInitializeBorder
pub(crate) fn world_border_adjusted_respawn_data( &self, respawn_data: RespawnData, ) -> RespawnData
Sourcepub fn set_world_border_center(
&self,
x: f64,
z: f64,
) -> Result<(), WorldBorderError>
pub fn set_world_border_center( &self, x: f64, z: f64, ) -> Result<(), WorldBorderError>
Sets the world border center and broadcasts the vanilla center update packet.
Sourcepub fn set_world_border_size(&self, size: f64) -> Result<(), WorldBorderError>
pub fn set_world_border_size(&self, size: f64) -> Result<(), WorldBorderError>
Sets a static world border size and broadcasts the vanilla size update packet.
Sourcepub fn lerp_world_border_size_between(
&self,
from: f64,
to: f64,
ticks: i64,
) -> Result<(), WorldBorderError>
pub fn lerp_world_border_size_between( &self, from: f64, to: f64, ticks: i64, ) -> Result<(), WorldBorderError>
Starts a vanilla world border size lerp and broadcasts the lerp update packet.
Sourcepub fn set_world_border_warning_time(&self, warning_time: i32)
pub fn set_world_border_warning_time(&self, warning_time: i32)
Sets the client warning time and broadcasts the vanilla warning-delay packet.
Sourcepub fn set_world_border_warning_blocks(&self, warning_blocks: i32)
pub fn set_world_border_warning_blocks(&self, warning_blocks: i32)
Sets the client warning distance and broadcasts the vanilla warning-distance packet.
Sourcepub fn set_world_border_damage_per_block(
&self,
damage_per_block: f64,
) -> Result<(), WorldBorderError>
pub fn set_world_border_damage_per_block( &self, damage_per_block: f64, ) -> Result<(), WorldBorderError>
Sets world border damage per block outside the safe zone.
Sourcepub fn set_world_border_safe_zone(
&self,
safe_zone: f64,
) -> Result<(), WorldBorderError>
pub fn set_world_border_safe_zone( &self, safe_zone: f64, ) -> Result<(), WorldBorderError>
Sets the safe distance outside the world border before damage starts.
pub(super) fn tick_world_border(&self)
pub(super) fn sync_world_border_to_level_data(&self)
pub(super) fn store_world_border_data_if_changed(&self, data: WorldBorderData)
Source§impl World
impl World
Sourcepub fn broadcast_chat(
&self,
packet: CPlayerChat,
_sender: Arc<Player>,
sender_last_seen: LastSeen,
message_signature: Option<&[u8; 256]>,
)
pub fn broadcast_chat( &self, packet: CPlayerChat, _sender: Arc<Player>, sender_last_seen: LastSeen, message_signature: Option<&[u8; 256]>, )
Broadcasts a signed chat message to all players in the world.
§Panics
Panics if message_signature is None after checking is_some() (should never happen).
Sourcepub fn broadcast_system_chat(&self, packet: CSystemChat)
pub fn broadcast_system_chat(&self, packet: CSystemChat)
Broadcasts a system chat message to all players.
Sourcepub fn broadcast_to_all<P: ClientPacket>(&self, packet: P)
pub fn broadcast_to_all<P: ClientPacket>(&self, packet: P)
Broadcasts a packet to all players in the world.
Sourcepub fn broadcast_to_all_except<P: ClientPacket>(&self, packet: P, exclude: i32)
pub fn broadcast_to_all_except<P: ClientPacket>(&self, packet: P, exclude: i32)
Broadcasts a packet to all players in the world except one (identified by entity ID).
Sourcepub fn broadcast_to_all_with<P: ClientPacket, F: Fn(&Player) -> P>(
&self,
packet: F,
)
pub fn broadcast_to_all_with<P: ClientPacket, F: Fn(&Player) -> P>( &self, packet: F, )
Broadcasts a packet to all players in the world.
This method handles encoding the packets produced from the function passed.
Sourcepub fn broadcast_to_all_encoded(&self, packet: EncodedPacket)
pub fn broadcast_to_all_encoded(&self, packet: EncodedPacket)
Broadcasts an already-encoded packet to all players in the world.
Sourcepub fn broadcast_to_all_encoded_except(
&self,
packet: EncodedPacket,
exclude: i32,
)
pub fn broadcast_to_all_encoded_except( &self, packet: EncodedPacket, exclude: i32, )
Broadcasts an already-encoded packet to all players except one.
Sourcepub fn broadcast_unsigned_chat(&self, packet: CPlayerChat)
pub fn broadcast_unsigned_chat(&self, packet: CPlayerChat)
Broadcasts an unsigned player chat message to all players.
Sourcepub fn broadcast_to_nearby<P: ClientPacket>(
&self,
chunk: ChunkPos,
packet: P,
exclude: Option<i32>,
)
pub fn broadcast_to_nearby<P: ClientPacket>( &self, chunk: ChunkPos, packet: P, exclude: Option<i32>, )
Broadcasts a packet to all players tracking the given chunk.
This method handles encoding the packet internally, avoiding boilerplate at call sites. If encoding fails, the broadcast is silently skipped.
Sourcepub fn broadcast_to_nearby_encoded(
&self,
chunk: ChunkPos,
packet: EncodedPacket,
exclude: Option<i32>,
)
pub fn broadcast_to_nearby_encoded( &self, chunk: ChunkPos, packet: EncodedPacket, exclude: Option<i32>, )
Broadcasts an already-encoded packet to all players tracking the given chunk.
Use this when you have a pre-encoded packet to avoid re-encoding.
Sourcepub fn get_packet_tracking_players(&self, chunk: ChunkPos) -> Vec<i32>
pub fn get_packet_tracking_players(&self, chunk: ChunkPos) -> Vec<i32>
Returns players whose view includes the chunk and whose client has the base chunk packet.
Sourcepub fn get_light_packet_tracking_players(&self, chunk: ChunkPos) -> Vec<i32>
pub fn get_light_packet_tracking_players(&self, chunk: ChunkPos) -> Vec<i32>
Returns players on the tracked border of a chunk whose client has its base chunk packet.
pub(super) fn chunk_is_on_packet_tracked_border( view: PlayerChunkView, chunk: ChunkPos, is_chunk_sent: &impl Fn(ChunkPos) -> bool, ) -> bool
pub(super) fn chunk_is_packet_tracked( view: PlayerChunkView, chunk: ChunkPos, is_chunk_sent: &impl Fn(ChunkPos) -> bool, ) -> bool
Sourcepub fn broadcast_to_entity_trackers<P: ClientPacket>(
&self,
entity_id: i32,
packet: P,
exclude: Option<i32>,
)
pub fn broadcast_to_entity_trackers<P: ClientPacket>( &self, entity_id: i32, packet: P, exclude: Option<i32>, )
Broadcasts a packet to players currently tracking an entity.
Sourcepub fn broadcast_to_entity_trackers_except_many<P: ClientPacket>(
&self,
entity_id: i32,
packet: P,
excluded_player_ids: &[i32],
)
pub fn broadcast_to_entity_trackers_except_many<P: ClientPacket>( &self, entity_id: i32, packet: P, excluded_player_ids: &[i32], )
Broadcasts a packet to players tracking an entity, excluding several players.
Sourcepub fn broadcast_movement_sync_to_entity_trackers(
&self,
entity_id: i32,
packet: EntityMovementSyncPacket,
exclude: Option<i32>,
)
pub fn broadcast_movement_sync_to_entity_trackers( &self, entity_id: i32, packet: EntityMovementSyncPacket, exclude: Option<i32>, )
Broadcasts an entity movement sync packet to players currently tracking an entity.
Sourcepub fn broadcast_to_entity_trackers_encoded(
&self,
entity_id: i32,
packet: EncodedPacket,
exclude: Option<i32>,
)
pub fn broadcast_to_entity_trackers_encoded( &self, entity_id: i32, packet: EncodedPacket, exclude: Option<i32>, )
Broadcasts an already-encoded packet to players currently tracking an entity.
pub(super) fn encode_movement_sync_packet( &self, packet: EntityMovementSyncPacket, ) -> Option<EncodedPacket>
Source§impl World
impl World
Sourcepub(crate) fn clock_total_ticks(&self, clock: WorldClockRef) -> Option<i64>
pub(crate) fn clock_total_ticks(&self, clock: WorldClockRef) -> Option<i64>
Returns the total ticks of one clock in this world.
Sourcepub(crate) fn time_sync_packet(&self) -> CSetTime
pub(crate) fn time_sync_packet(&self) -> CSetTime
Creates a full per-world time synchronization packet.
Sourcepub(crate) fn broadcast_time_sync(&self)
pub(crate) fn broadcast_time_sync(&self)
Broadcasts all clock states to players in this world.
pub(crate) fn set_clock_total_ticks( &self, clock: WorldClockRef, total_ticks: i64, ) -> Option<()>
pub(crate) fn add_clock_ticks( &self, clock: WorldClockRef, ticks: i32, ) -> Option<i64>
pub(crate) fn set_clock_paused( &self, clock: WorldClockRef, paused: bool, ) -> Option<()>
pub(crate) fn set_clock_rate( &self, clock: WorldClockRef, rate: f32, ) -> Option<()>
pub(crate) fn move_clock_to_time_marker( &self, clock: WorldClockRef, marker: &Identifier, ) -> Option<bool>
pub(super) fn modify_clock<R>( &self, clock: WorldClockRef, action: impl FnOnce(&mut WorldClockManager) -> Option<R>, ) -> Option<R>
Source§impl World
impl World
Sourcepub(crate) const fn block_entity_tickers(&self) -> &WorldBlockEntityTickers
pub(crate) const fn block_entity_tickers(&self) -> &WorldBlockEntityTickers
Returns the world-global block-entity ticker owner.
Sourcepub(crate) fn game_event_listener_count(&self) -> Arc<GameEventListenerCount> ⓘ
pub(crate) fn game_event_listener_count(&self) -> Arc<GameEventListenerCount> ⓘ
Shares the counter used to skip game-event dispatch when no chunk has listeners.
Sourcepub const fn entity_tracker(&self) -> &EntityTracker
pub const fn entity_tracker(&self) -> &EntityTracker
Returns the entity tracker for managing player-entity visibility.
pub(super) fn attach_managed_entity_callback( self: &Arc<Self>, entity: &SharedEntity, )
pub(crate) fn add_entity_to_tracker(self: &Arc<Self>, entity: &SharedEntity)
pub(crate) fn remove_entity_from_tracker(&self, entity_id: i32)
pub(crate) fn apply_entity_lifecycle_changes( self: &Arc<Self>, changes: EntityLifecycleChanges, )
pub(crate) fn register_loaded_entity( self: &Arc<Self>, entity: SharedEntity, ) -> Result<(), AddEntityError>
pub(crate) fn register_loaded_entity_tree( self: &Arc<Self>, entities: &[SharedEntity], ) -> Result<(), AddEntityError>
pub(crate) fn register_loaded_chunk_entities( self: &Arc<Self>, source_chunk: ChunkPos, persisted_status: ChunkStatus, entities: Vec<SharedEntity>, )
pub(super) fn loaded_entity_trees( entities: Vec<SharedEntity>, ) -> Vec<Vec<SharedEntity>>
pub(super) fn collect_loaded_entity_tree( entity: &SharedEntity, seen: &mut FxHashSet<i32>, tree: &mut Vec<SharedEntity>, )
pub(super) fn discard_loaded_entity_tree(entities: &[SharedEntity])
pub(crate) fn has_full_chunk(&self, chunk_pos: ChunkPos) -> bool
Sourcepub fn try_add_entity(
self: &Arc<Self>,
entity: SharedEntity,
) -> Result<(), AddEntityError>
pub fn try_add_entity( self: &Arc<Self>, entity: SharedEntity, ) -> Result<(), AddEntityError>
Adds a runtime entity to the world.
pub(crate) fn on_entity_chunk_loaded(self: &Arc<Self>, pos: ChunkPos)
pub(crate) fn update_entity_chunk_visibility( self: &Arc<Self>, pos: ChunkPos, visibility: EntityVisibility, )
pub(crate) fn on_entity_chunk_unload_start(self: &Arc<Self>, pos: ChunkPos)
pub(crate) fn on_entity_chunk_unload_finalized(&self, pos: ChunkPos)
Sourcepub fn spawn_item(
self: &Arc<Self>,
pos: DVec3,
item: ItemStack,
) -> Option<Arc<ItemEntity>>
pub fn spawn_item( self: &Arc<Self>, pos: DVec3, item: ItemStack, ) -> Option<Arc<ItemEntity>>
Spawns an item entity at the given position.
This is a convenience method for dropping items in the world.
Returns None if the item stack is empty.
Sourcepub fn spawn_item_with_velocity(
self: &Arc<Self>,
pos: DVec3,
item: ItemStack,
velocity: DVec3,
) -> Option<Arc<ItemEntity>>
pub fn spawn_item_with_velocity( self: &Arc<Self>, pos: DVec3, item: ItemStack, velocity: DVec3, ) -> Option<Arc<ItemEntity>>
Spawns an item entity at the given position with initial velocity.
Returns None if the item stack is empty.
Sourcepub fn pop_resource(
self: &Arc<Self>,
pos: BlockPos,
item: ItemStack,
) -> Option<Arc<ItemEntity>>
pub fn pop_resource( self: &Arc<Self>, pos: BlockPos, item: ItemStack, ) -> Option<Arc<ItemEntity>>
Drops an item at a block position with random offset and velocity.
Mirrors vanilla’s Block.popResource(). Used for block drops.
The item spawns near the center of the block with slight random offset
and small random velocity.
Sourcepub fn pop_experience(self: &Arc<Self>, pos: BlockPos, amount: i32)
pub fn pop_experience(self: &Arc<Self>, pos: BlockPos, amount: i32)
Spawns experience at a block position when block drops are enabled.
Mirrors Vanilla’s Block.popExperience.
Sourcepub fn pop_resource_from_face(
self: &Arc<Self>,
pos: BlockPos,
face: Direction,
item: ItemStack,
) -> Option<Arc<ItemEntity>>
pub fn pop_resource_from_face( self: &Arc<Self>, pos: BlockPos, face: Direction, item: ItemStack, ) -> Option<Arc<ItemEntity>>
Drops an item from a block face with directional velocity.
Mirrors vanilla’s Block.popResourceFromFace(). Used for items ejected
from a specific side of a block.
Sourcepub fn get_entity_by_id(&self, id: i32) -> Option<SharedEntity>
pub fn get_entity_by_id(&self, id: i32) -> Option<SharedEntity>
Gets an entity by its network ID.
Returns None if the entity is not live in the world.
Sourcepub(crate) fn contains_live_or_unloading_entity(
&self,
entity: &SharedEntity,
) -> bool
pub(crate) fn contains_live_or_unloading_entity( &self, entity: &SharedEntity, ) -> bool
Returns true if this exact entity is live or retained for chunk-unload recovery.
Sourcepub fn queue_world_change(
&self,
entity: SharedEntity,
request: WorldChangeRequest,
)
pub fn queue_world_change( &self, entity: SharedEntity, request: WorldChangeRequest, )
Queues a world change from world-local code for server safe-point processing.
pub(crate) fn drain_world_changes( &self, ) -> Vec<(SharedEntity, WorldChangeRequest)>
Sourcepub fn get_accessible_entity_by_id(&self, id: i32) -> Option<SharedEntity>
pub fn get_accessible_entity_by_id(&self, id: i32) -> Option<SharedEntity>
Gets an entity by its network ID if it is visible to vanilla gameplay lookups.
Returns None if the entity is not live or is hidden in an inaccessible chunk.
Sourcepub fn get_entity_by_uuid(&self, uuid: &Uuid) -> Option<SharedEntity>
pub fn get_entity_by_uuid(&self, uuid: &Uuid) -> Option<SharedEntity>
Gets an entity by its UUID.
Returns None if the entity is not live in the world.
Sourcepub fn get_entities_in_aabb(&self, aabb: &WorldAabb) -> Vec<SharedEntity> ⓘ
pub fn get_entities_in_aabb(&self, aabb: &WorldAabb) -> Vec<SharedEntity> ⓘ
Gets all entities intersecting the given bounding box.
Only returns entities in loaded chunks.
Sourcepub fn get_entities_in_aabb_matching(
&self,
aabb: &WorldAabb,
predicate: impl FnMut(&dyn Entity) -> bool,
) -> Vec<SharedEntity> ⓘ
pub fn get_entities_in_aabb_matching( &self, aabb: &WorldAabb, predicate: impl FnMut(&dyn Entity) -> bool, ) -> Vec<SharedEntity> ⓘ
Gets entities intersecting the given bounding box and matching predicate.
Only returns entities in loaded chunks.
Sourcepub fn has_entity_in_aabb_matching(
&self,
aabb: &WorldAabb,
predicate: impl FnMut(&dyn Entity) -> bool,
) -> bool
pub fn has_entity_in_aabb_matching( &self, aabb: &WorldAabb, predicate: impl FnMut(&dyn Entity) -> bool, ) -> bool
Returns whether any entity intersects the given bounding box and matches predicate.
Only checks entities in loaded chunks.
Sourcepub fn get_entity_bounding_boxes_in_aabb_matching(
&self,
aabb: &WorldAabb,
predicate: impl FnMut(&dyn Entity) -> bool,
) -> Vec<WorldAabb> ⓘ
pub fn get_entity_bounding_boxes_in_aabb_matching( &self, aabb: &WorldAabb, predicate: impl FnMut(&dyn Entity) -> bool, ) -> Vec<WorldAabb> ⓘ
Gets matching entity bounding boxes intersecting the given bounding box.
Only checks entities in loaded chunks.
Sourcepub fn nearest_entity_in_aabb_matching(
&self,
aabb: &WorldAabb,
origin: DVec3,
predicate: impl FnMut(&dyn Entity) -> bool,
) -> Option<SharedEntity>
pub fn nearest_entity_in_aabb_matching( &self, aabb: &WorldAabb, origin: DVec3, predicate: impl FnMut(&dyn Entity) -> bool, ) -> Option<SharedEntity>
Gets the nearest entity intersecting the given bounding box and matching predicate.
Only returns entities in loaded chunks.
Sourcepub fn nearest_player(
&self,
position: DVec3,
max_distance: f64,
predicate: impl FnMut(&Player) -> bool,
) -> Option<Arc<Player>>
pub fn nearest_player( &self, position: DVec3, max_distance: f64, predicate: impl FnMut(&Player) -> bool, ) -> Option<Arc<Player>>
Gets the nearest player to position within max_distance.
Sourcepub fn nearest_player_distance_sqr(&self, position: DVec3) -> Option<f64>
pub fn nearest_player_distance_sqr(&self, position: DVec3) -> Option<f64>
Gets the squared distance to the nearest player, if any player is present.
Sourcepub fn get_pushable_entities(
&self,
pusher: &dyn Entity,
aabb: &WorldAabb,
) -> Vec<SharedEntity> ⓘ
pub fn get_pushable_entities( &self, pusher: &dyn Entity, aabb: &WorldAabb, ) -> Vec<SharedEntity> ⓘ
Gets entities matching vanilla’s pushable entity selector for pusher.
Vanilla also checks team collision rules; Steel has no teams yet, so this currently matches the null-team path where collision is allowed.
Sourcepub fn register_game_event_listener(
&self,
section_pos: SectionPos,
listener: SharedGameEventListener,
)
pub fn register_game_event_listener( &self, section_pos: SectionPos, listener: SharedGameEventListener, )
Registers a game event listener in a chunk section.
Sourcepub fn unregister_game_event_listener(
&self,
section_pos: SectionPos,
listener: &SharedGameEventListener,
) -> bool
pub fn unregister_game_event_listener( &self, section_pos: SectionPos, listener: &SharedGameEventListener, ) -> bool
Unregisters a game event listener from a chunk section.
Sourcepub(super) fn game_event_listener_storage(
&self,
chunk_pos: ChunkPos,
) -> Option<Arc<GameEventListenerStorage>>
pub(super) fn game_event_listener_storage( &self, chunk_pos: ChunkPos, ) -> Option<Arc<GameEventListenerStorage>>
Returns a stable registry handle without retaining the chunk holder read guard.
Sourcepub fn game_event(
self: &Arc<Self>,
event: GameEventRef,
pos: BlockPos,
context: &GameEventContext<'_>,
)
pub fn game_event( self: &Arc<Self>, event: GameEventRef, pos: BlockPos, context: &GameEventContext<'_>, )
Dispatches a game event to all listeners in range.
Sourcepub fn game_event_at(
self: &Arc<Self>,
event: GameEventRef,
source_pos: DVec3,
context: &GameEventContext<'_>,
)
pub fn game_event_at( self: &Arc<Self>, event: GameEventRef, source_pos: DVec3, context: &GameEventContext<'_>, )
Dispatches a game event from an exact world position.
Source§impl World
impl World
Sourcepub fn broadcast_block_destruction(
&self,
entity_id: i32,
pos: BlockPos,
progress: i32,
)
pub fn broadcast_block_destruction( &self, entity_id: i32, pos: BlockPos, progress: i32, )
Broadcasts block destruction progress to nearby players.
Note: The packet is NOT sent to the player doing the breaking (matching vanilla). The breaking player sees progress through client-side prediction.
§Arguments
entity_id- The entity ID of the player breaking the blockpos- The position of the block being brokenprogress- The destruction progress (0-9), or -1 to clear
Sourcepub fn broadcast_block_entity_update(
&self,
pos: BlockPos,
block_entity_type: BlockEntityTypeRef,
nbt: NbtCompound,
)
pub fn broadcast_block_entity_update( &self, pos: BlockPos, block_entity_type: BlockEntityTypeRef, nbt: NbtCompound, )
Broadcasts a block entity update to all players tracking the chunk.
This is used when block entity data changes (e.g., sign text updated).
§Arguments
pos- The position of the block entityblock_entity_type- The type of block entitynbt- The NBT data to send
Sourcepub(crate) fn broadcast_block_entity_if_needed(&self, pos: BlockPos)
pub(crate) fn broadcast_block_entity_if_needed(&self, pos: BlockPos)
Broadcasts the current block-entity update packet when that entity type exposes client-visible update data.
Sourcepub fn drop_item_stack(self: &Arc<Self>, pos: BlockPos, item: ItemStack)
pub fn drop_item_stack(self: &Arc<Self>, pos: BlockPos, item: ItemStack)
Drops an item stack at the given position with scatter behavior.
Mirrors vanilla’s Containers.dropItemStack. Splits large stacks into
multiple item entities (10-30 items each) and scatters them with random
positions and velocities.
§Arguments
pos- The block position to drop the item atitem- The item stack to drop
Source§impl World
impl World
Sourcepub fn level_event(
&self,
event_type: i32,
pos: BlockPos,
data: i32,
exclude: Option<i32>,
)
pub fn level_event( &self, event_type: i32, pos: BlockPos, data: i32, exclude: Option<i32>, )
Broadcasts a level event to nearby players within 64 blocks.
Level events trigger sounds, particles, and animations on the client.
See steel_registry::level_events for available event type constants.
§Arguments
event_type- The event type ID fromsteel_registry::level_eventspos- The position where the event occursdata- Event-specific data (e.g., block state ID for block destruction)exclude- Optional entity ID to exclude from receiving the event
pub(super) fn recipient_within_64_blocks( player_pos: DVec3, event_pos: BlockPos, ) -> bool
Sourcepub fn send_particles(
&self,
particle: ParticleData,
position: DVec3,
count: i32,
spread: DVec3,
speed: f64,
) -> i32
pub fn send_particles( &self, particle: ParticleData, position: DVec3, count: i32, spread: DVec3, speed: f64, ) -> i32
Sends a particle distribution to every player within Vanilla’s normal 32-block particle radius.
Sourcepub fn send_particles_with_options(
&self,
particle: ParticleData,
override_limiter: bool,
always_show: bool,
position: DVec3,
count: i32,
spread: DVec3,
speed: f64,
) -> i32
pub fn send_particles_with_options( &self, particle: ParticleData, override_limiter: bool, always_show: bool, position: DVec3, count: i32, spread: DVec3, speed: f64, ) -> i32
Sends a particle distribution with the packet visibility flags selected
explicitly. override_limiter also expands the server recipient radius
from 32 to 512 blocks, matching ServerLevel.sendParticles.
Sourcepub fn send_particles_to(
self: &Arc<Self>,
player: &Player,
particle: ParticleData,
override_limiter: bool,
always_show: bool,
position: DVec3,
count: i32,
spread: DVec3,
speed: f64,
) -> bool
pub fn send_particles_to( self: &Arc<Self>, player: &Player, particle: ParticleData, override_limiter: bool, always_show: bool, position: DVec3, count: i32, spread: DVec3, speed: f64, ) -> bool
Sends a particle distribution to one player if they are in this world and within Vanilla’s particle recipient radius.
pub(super) fn particle_recipient_in_range( player_block_pos: BlockPos, particle_pos: DVec3, override_limiter: bool, ) -> bool
Sourcepub fn global_level_event(&self, event_type: i32, pos: BlockPos, data: i32)
pub fn global_level_event(&self, event_type: i32, pos: BlockPos, data: i32)
Broadcasts a global level event to all players in the world.
When global_sound_events is disabled, vanilla falls back to a normal
nearby level event with the packet’s global flag unset.
§Arguments
event_type- The event type ID fromsteel_registry::level_eventspos- The position where the event occursdata- Event-specific data
Sourcepub fn destroy_block_effect(
&self,
pos: BlockPos,
block_state_id: u32,
exclude: Option<i32>,
)
pub fn destroy_block_effect( &self, pos: BlockPos, block_state_id: u32, exclude: Option<i32>, )
Broadcasts block destruction particles and sound for a destroyed block.
This is a convenience method that sends the PARTICLES_DESTROY_BLOCK level event.
§Arguments
pos- The position of the destroyed blockblock_state_id- The block state ID of the destroyed blockexclude- Optional entity ID to exclude from receiving the event
Sourcepub fn destroy_block(self: &Arc<Self>, pos: BlockPos, drop_items: bool) -> bool
pub fn destroy_block(self: &Arc<Self>, pos: BlockPos, drop_items: bool) -> bool
Destroys a block at the given position, optionally dropping its loot.
Sends destruction particles (skipping fire blocks), optionally drops resources via loot table, then replaces with air.
Defaults to recursion limit of 512
Sourcepub fn remove_block(
self: &Arc<Self>,
pos: BlockPos,
moved_by_piston: bool,
) -> bool
pub fn remove_block( self: &Arc<Self>, pos: BlockPos, moved_by_piston: bool, ) -> bool
Replaces a block with its fluid state’s legacy block.
Mirrors vanilla Level.removeBlock, including the piston-move update flag.
Sourcepub fn destroy_block_by_entity(
self: &Arc<Self>,
pos: BlockPos,
drop_items: bool,
entity: &dyn Entity,
) -> bool
pub fn destroy_block_by_entity( self: &Arc<Self>, pos: BlockPos, drop_items: bool, entity: &dyn Entity, ) -> bool
Destroys a block with an entity source for game-event context.
Sourcepub fn destroy_block_with_limit(
self: &Arc<Self>,
pos: BlockPos,
drop_items: bool,
recursion_left: i32,
) -> bool
pub fn destroy_block_with_limit( self: &Arc<Self>, pos: BlockPos, drop_items: bool, recursion_left: i32, ) -> bool
Destroys a block at the given position, optionally dropping its loot.
Sends destruction particles (skipping fire blocks), optionally drops resources via loot table, then replaces with air.
pub(super) fn destroy_block_with_limit_and_entity( self: &Arc<Self>, pos: BlockPos, drop_items: bool, recursion_left: i32, entity: Option<&dyn Entity>, ) -> bool
Sourcepub fn drop_resources(self: &Arc<Self>, state: BlockStateId, pos: BlockPos)
pub fn drop_resources(self: &Arc<Self>, state: BlockStateId, pos: BlockPos)
Drops the loot for a block using its loot table.
This is the no-tool/no-entity overload. Player block breaking uses
block_breaking::drop_block_loot which includes tool context for
fortune/silk touch.
pub(super) fn drop_resources_with_entity( self: &Arc<Self>, state: BlockStateId, pos: BlockPos, entity: Option<&dyn Entity>, )
pub(crate) fn block_drops( state: BlockStateId, context: &BlockLootContext<'_>, ) -> Vec<ItemStack>
pub(super) fn default_block_drops( state: BlockStateId, context: &BlockLootContext<'_>, ) -> Vec<ItemStack>
Sourcepub fn play_sound(
&self,
sound: SoundEventRef,
source: SoundSource,
pos: BlockPos,
volume: f32,
pitch: f32,
exclude: Option<i32>,
)
pub fn play_sound( &self, sound: SoundEventRef, source: SoundSource, pos: BlockPos, volume: f32, pitch: f32, exclude: Option<i32>, )
Plays a sound at a specific position, broadcasting to nearby players.
The sound is sent to players within its vanilla range, except for the excluded player (if any). The excluded player is typically the one who triggered the sound, as they hear it client-side.
§Arguments
sound- The sound event to playsource- The sound source categorypos- The block position (sound plays at center of block)volume- Volume multiplier (1.0 = normal)pitch- Pitch multiplier (1.0 = normal)exclude- Optional entity ID to exclude from receiving the sound
Sourcepub fn play_sound_at(
&self,
sound: SoundEventRef,
source: SoundSource,
pos: DVec3,
volume: f32,
pitch: f32,
exclude: Option<i32>,
)
pub fn play_sound_at( &self, sound: SoundEventRef, source: SoundSource, pos: DVec3, volume: f32, pitch: f32, exclude: Option<i32>, )
Plays a sound at an exact world position, broadcasting to nearby players.
Sourcepub fn play_block_sound(
&self,
sound: SoundEventRef,
pos: BlockPos,
volume: f32,
pitch: f32,
exclude: Option<i32>,
)
pub fn play_block_sound( &self, sound: SoundEventRef, pos: BlockPos, volume: f32, pitch: f32, exclude: Option<i32>, )
Plays a block sound at a specific position.
Convenience method that uses the BLOCKS sound source and applies the sound type’s volume and pitch modifiers.
§Arguments
sound- The sound event to playpos- The block positionvolume- Base volume (typically fromSoundType)pitch- Base pitch (typically fromSoundType)exclude- Optional entity ID to exclude from receiving the sound
Sourcepub(crate) const fn entity_manager(&self) -> &WorldEntityManager
pub(crate) const fn entity_manager(&self) -> &WorldEntityManager
Returns the runtime entity manager.
Source§impl World
impl World
Finds the adjusted shared spawn position used for players entering this world’s default spawn.
Sourcepub async fn prepare_player_spawn_chunks(
self: &Arc<Self>,
spawn_position: DVec3,
) -> Result<ChunkRequestHandle, String>
pub async fn prepare_player_spawn_chunks( self: &Arc<Self>, spawn_position: DVec3, ) -> Result<ChunkRequestHandle, String>
Loads the vanilla radius-3 full chunk square around a prepared player spawn.
pub(crate) fn request_player_spawn_chunks( self: &Arc<Self>, spawn_position: DVec3, ) -> ChunkRequestHandle
fn request_spawn_candidate_chunk( self: &Arc<Self>, x: i32, z: i32, ) -> ChunkRequestHandle
async fn wait_for_chunk_request( request: &ChunkRequestHandle, ) -> Result<(), String>
fn fixup_spawn_height(self: &Arc<Self>, spawn_pos: BlockPos) -> DVec3
fn no_collision_no_liquid(self: &Arc<Self>, pos: BlockPos) -> bool
Source§impl World
impl World
Sourcepub fn find_closest_nether_portal_position(
&self,
approximate_exit_pos: BlockPos,
to_nether: bool,
) -> Option<BlockPos>
pub fn find_closest_nether_portal_position( &self, approximate_exit_pos: BlockPos, to_nether: bool, ) -> Option<BlockPos>
Finds the closest existing Nether portal POI using vanilla PortalForcer ordering.
to_nether selects vanilla’s 16-block Nether search radius; non-Nether targets use 128.
§Panics
Panics if vanilla POI registries were not initialized before portal lookup.
Sourcepub fn create_nether_portal(
self: &Arc<Self>,
origin: BlockPos,
portal_axis: Axis,
) -> Option<FoundRectangle>
pub fn create_nether_portal( self: &Arc<Self>, origin: BlockPos, portal_axis: Axis, ) -> Option<FoundRectangle>
Creates a Nether portal using vanilla PortalForcer.createPortal placement rules.
The caller must keep the target search area loaded as full chunks before calling. Steel
returns None if any required chunk read or write is unavailable, rather than treating
unloaded chunks as replaceable air.
Sourcepub(crate) fn place_portal_ticket(&self, ticket_position: BlockPos)
pub(crate) fn place_portal_ticket(&self, ticket_position: BlockPos)
Adds or refreshes vanilla’s portal chunk ticket for a post-teleport entity.
pub(super) fn find_nether_portal_creation_position( &self, origin: BlockPos, direction: Direction, max_placeable_y: i32, ) -> Result<Option<BlockPos>, MissingPortalCreationChunk>
pub(super) fn can_nether_portal_replace_block( &self, pos: BlockPos, ) -> Result<bool, MissingPortalCreationChunk>
pub(super) fn can_host_nether_portal_frame( &self, origin: BlockPos, direction: Direction, offset: i32, ) -> Result<bool, MissingPortalCreationChunk>
pub(super) fn loaded_block_state(&self, pos: BlockPos) -> Option<BlockStateId>
pub(super) fn fallback_nether_portal_position( &self, origin: BlockPos, direction: Direction, max_placeable_y: i32, ) -> Option<BlockPos>
pub(super) fn can_write_nether_portal_fallback_box( &self, origin: BlockPos, direction: Direction, ) -> bool
pub(super) fn can_write_nether_portal_rectangle( &self, origin: BlockPos, direction: Direction, ) -> bool
pub(super) fn can_write_loaded_block(&self, pos: BlockPos) -> bool
Sourcepub(crate) fn create_end_platform(self: &Arc<Self>, origin: BlockPos) -> bool
pub(crate) fn create_end_platform(self: &Arc<Self>, origin: BlockPos) -> bool
Mirrors vanilla EndPlatformFeature.createEndPlatform for runtime End portal travel.
Sourcepub(crate) fn is_end_gateway_chunk_empty(
&self,
chunk_pos: ChunkPos,
) -> Option<bool>
pub(crate) fn is_end_gateway_chunk_empty( &self, chunk_pos: ChunkPos, ) -> Option<bool>
Mirrors vanilla TheEndGatewayBlockEntity.isChunkEmpty.
Sourcepub(crate) fn find_end_gateway_valid_spawn_in_chunk(
&self,
chunk_pos: ChunkPos,
) -> Option<BlockPos>
pub(crate) fn find_end_gateway_valid_spawn_in_chunk( &self, chunk_pos: ChunkPos, ) -> Option<BlockPos>
Mirrors vanilla TheEndGatewayBlockEntity.findValidSpawnInChunk.
Sourcepub(crate) fn find_end_gateway_tallest_block(
&self,
around: BlockPos,
dist: i32,
allow_bedrock: bool,
) -> BlockPos
pub(crate) fn find_end_gateway_tallest_block( &self, around: BlockPos, dist: i32, allow_bedrock: bool, ) -> BlockPos
Mirrors vanilla TheEndGatewayBlockEntity.findTallestBlock.
pub(super) fn is_collision_shape_full_block_at( &self, pos: BlockPos, state: BlockStateId, ) -> bool
Sourcepub(crate) fn create_end_island(self: &Arc<Self>, origin: BlockPos) -> bool
pub(crate) fn create_end_island(self: &Arc<Self>, origin: BlockPos) -> bool
Mirrors vanilla EndIslandFeature.place for runtime End gateway island creation.
Sourcepub(crate) fn create_end_gateway_portal(
self: &Arc<Self>,
origin: BlockPos,
exit: BlockPos,
exact: bool,
) -> bool
pub(crate) fn create_end_gateway_portal( self: &Arc<Self>, origin: BlockPos, exit: BlockPos, exact: bool, ) -> bool
Mirrors vanilla EndGatewayFeature.place for runtime End gateway creation.
pub(super) fn clear_nether_portal_fallback_box( self: &Arc<Self>, origin: BlockPos, direction: Direction, ) -> bool
pub(super) fn place_nether_portal_frame_and_blocks( self: &Arc<Self>, origin: BlockPos, direction: Direction, portal_axis: Axis, ) -> bool
Source§impl World
impl World
Sourcepub fn difficulty(&self) -> Difficulty
pub fn difficulty(&self) -> Difficulty
Returns vanilla level difficulty.
Sourcepub(crate) fn set_difficulty(&self, difficulty: Difficulty)
pub(crate) fn set_difficulty(&self, difficulty: Difficulty)
Sets the level difficulty and broadcasts the new value to its players.
Sourcepub const fn get_height(&self) -> i32
pub const fn get_height(&self) -> i32
Returns the total height of the world in blocks.
Sourcepub const fn is_outside_build_height(&self, block_y: i32) -> bool
pub const fn is_outside_build_height(&self, block_y: i32) -> bool
Returns whether the given Y coordinate is outside the build height.
Sourcepub const fn is_in_valid_bounds_horizontal(&self, block_pos: BlockPos) -> bool
pub const fn is_in_valid_bounds_horizontal(&self, block_pos: BlockPos) -> bool
Returns whether the block position is within valid horizontal bounds.
Sourcepub const fn is_in_valid_bounds(&self, block_pos: BlockPos) -> bool
pub const fn is_in_valid_bounds(&self, block_pos: BlockPos) -> bool
Returns whether the block position is within valid world bounds.
Sourcepub const fn is_in_spawnable_bounds(block_pos: BlockPos) -> bool
pub const fn is_in_spawnable_bounds(block_pos: BlockPos) -> bool
Returns whether the block position is within vanilla spawnable bounds.
pub(super) const fn is_in_world_bounds_horizontal(block_pos: BlockPos) -> bool
pub(super) const fn is_outside_spawnable_height(y: i32) -> bool
Sourcepub const fn max_build_height(&self) -> i32
pub const fn max_build_height(&self) -> i32
Returns the maximum build height (one above the highest placeable block).
This is min_y + height.
Sourcepub const fn may_interact(&self, _player: &Player, pos: BlockPos) -> bool
pub const fn may_interact(&self, _player: &Player, pos: BlockPos) -> bool
Checks if a player may interact with the world at the given position. Currently only checks if position is within world bounds.
Sourcepub fn is_unobstructed(
&self,
collision_shape: OffsetVoxelShape,
pos: BlockPos,
) -> bool
pub fn is_unobstructed( &self, collision_shape: OffsetVoxelShape, pos: BlockPos, ) -> bool
Checks if a block’s collision shape at the given position is unobstructed by entities.
This is the Rust equivalent of vanilla’s Level.isUnobstructed(BlockState, BlockPos, CollisionContext).
In vanilla, this checks all entities with blocksBuilding=true (players, mobs, boats, etc.).
Returns true if the position is clear, false if an entity would obstruct placement.
Sourcepub fn tick_runs_normally(&self) -> bool
pub fn tick_runs_normally(&self) -> bool
Returns whether the tick rate is running normally.
When false (frozen/paused), movement validation checks should be skipped.
Matches vanilla’s level.tickRateManager().runsNormally().
Sourcepub fn set_tick_runs_normally(&self, runs_normally: bool)
pub fn set_tick_runs_normally(&self, runs_normally: bool)
Sets whether the tick rate is running normally.
Set to false to freeze/pause the world (e.g., via /tick freeze command).
Sourcepub(crate) fn is_handling_tick(&self) -> bool
pub(crate) fn is_handling_tick(&self) -> bool
Mirrors ServerLevel.isHandlingTick for piston early-retraction rules.
Sourcepub fn get_game_rule<T: GameRuleValueType>(&self, rule: &GameRule<T>) -> T
pub fn get_game_rule<T: GameRuleValueType>(&self, rule: &GameRule<T>) -> T
Gets the value of a game rule. WARNING: this function acquires a read lock on the level data. if you already have a write lock on level data, this will DEADLOCK
Sourcepub fn get_game_rule_with_guard<T: GameRuleValueType>(
&self,
rule: &GameRule<T>,
guard: &LevelDataManager,
) -> T
pub fn get_game_rule_with_guard<T: GameRuleValueType>( &self, rule: &GameRule<T>, guard: &LevelDataManager, ) -> T
Gets the value of a game rule on the LevelDataManager guard being passed in.
Sourcepub fn get_erased_game_rule(&self, rule: ErasedGameRuleRef) -> GameRuleValue
pub fn get_erased_game_rule(&self, rule: ErasedGameRuleRef) -> GameRuleValue
Gets a type-erased value for a dynamically selected game rule.
Sourcepub fn set_game_rule<T: GameRuleValueType>(
&self,
rule: &GameRule<T>,
value: T,
) -> bool
pub fn set_game_rule<T: GameRuleValueType>( &self, rule: &GameRule<T>, value: T, ) -> bool
Sets the value of a game rule. WARNING: this function acquires a write lock on the level data. if you already have a read or write lock on level data, this will DEADLOCK
Sourcepub fn set_game_rule_with_guard<T: GameRuleValueType>(
&self,
rule: &GameRule<T>,
value: T,
guard: &mut LevelDataManager,
) -> bool
pub fn set_game_rule_with_guard<T: GameRuleValueType>( &self, rule: &GameRule<T>, value: T, guard: &mut LevelDataManager, ) -> bool
Sets the value of a game rule on the LevelDataManager guard being passed in.
Sourcepub fn set_erased_game_rule(
&self,
rule: ErasedGameRuleRef,
value: GameRuleValue,
) -> bool
pub fn set_erased_game_rule( &self, rule: ErasedGameRuleRef, value: GameRuleValue, ) -> bool
Sets a type-erased value for a dynamically selected game rule.
pub(super) fn advance_time_with_guard(&self, guard: &LevelDataManager) -> bool
Sourcepub fn obfuscated_seed(&self) -> i64
pub fn obfuscated_seed(&self) -> i64
Gets the obfuscated seed for sending to clients.
This uses SHA-256 hashing to prevent clients from easily extracting
the actual world seed, matching vanilla’s BiomeManager.obfuscateSeed().
Source§impl World
impl World
Sourcepub fn ray_outline_check(
&self,
block_pos: BlockPos,
from: DVec3,
to: DVec3,
) -> (bool, Option<Direction>)
pub fn ray_outline_check( &self, block_pos: BlockPos, from: DVec3, to: DVec3, ) -> (bool, Option<Direction>)
Checks if a ray intersects with a block’s selection box.
Sourcepub fn clip(
&self,
start_pos: DVec3,
end_pos: DVec3,
block_shape: ClipBlockShape,
fluid: ClipFluid,
) -> ClipHitResult
pub fn clip( &self, start_pos: DVec3, end_pos: DVec3, block_shape: ClipBlockShape, fluid: ClipFluid, ) -> ClipHitResult
Performs a vanilla-style block/fluid clip in the world.
Sourcepub fn clip_including_border(
&self,
start_pos: DVec3,
end_pos: DVec3,
block_shape: ClipBlockShape,
fluid: ClipFluid,
) -> ClipHitResult
pub fn clip_including_border( &self, start_pos: DVec3, end_pos: DVec3, block_shape: ClipBlockShape, fluid: ClipFluid, ) -> ClipHitResult
Performs vanilla CollisionGetter.clipIncludingBorder.
pub(super) fn clip_block_and_fluid( &self, pos: BlockPos, from: DVec3, to: DVec3, block_shape: ClipBlockShape, fluid: ClipFluid, ) -> Option<ClipHitResult>
pub(super) fn clip_with_interaction_override( pos: BlockPos, from: DVec3, to: DVec3, state: BlockStateId, block_hit: ClipHitResult, ) -> ClipHitResult
pub(super) fn clip_block_shape( &self, state: BlockStateId, pos: BlockPos, shape: ClipBlockShape, ) -> OffsetVoxelShape
pub(super) fn fall_damage_resetting_shape( &self, state: BlockStateId, entity_is_player: bool, ) -> VoxelShape
pub(super) fn clip_fluid_shape( &self, pos: BlockPos, from: DVec3, to: DVec3, state: BlockStateId, fluid: ClipFluid, ) -> Option<ClipHitResult>
pub(super) fn fluid_clip_height( &self, pos: BlockPos, fluid_state: FluidState, ) -> f64
pub(super) fn fluid_clip_height_from_above( fluid_state: FluidState, above_fluid: FluidState, ) -> f64
pub(super) fn clip_shape( block_pos: BlockPos, from: DVec3, to: DVec3, shape: OffsetVoxelShape, ) -> Option<ClipHitResult>
pub(super) fn clip_local_aabb( block_pos: BlockPos, from: DVec3, to: DVec3, aabb: BlockLocalAabb, ) -> Option<ClipHitResult>
pub(super) fn shape_contains_world_point( shape: OffsetVoxelShape, block_vec: DVec3, point: DVec3, ) -> bool
pub(super) fn local_aabb_contains_world_point( aabb: BlockLocalAabb, block_vec: DVec3, point: DVec3, ) -> bool
pub(super) fn clip_miss(from: DVec3, to: DVec3) -> ClipHitResult
pub(super) fn approximate_nearest_direction(vector: DVec3) -> Direction
Sourcepub(super) fn intersects_aabb_with_t(
start: DVec3,
end: DVec3,
min: DVec3,
max: DVec3,
) -> Option<(f64, Direction)>
pub(super) fn intersects_aabb_with_t( start: DVec3, end: DVec3, min: DVec3, max: DVec3, ) -> Option<(f64, Direction)>
Ray-AABB intersection returning the entry t-parameter and the hit face.
Returns Some((tmin, direction)) where tmin is the ray parameter at entry
and direction is the face normal pointing away from the hit surface.
Returns None if the AABB is missed or entirely behind the ray origin.
Used internally by [ray_outline_check] to pick the closest hit across
a multi-box voxel shape, matching vanilla’s VoxelShape.clip() behavior.
Source§impl World
impl World
Sourcepub(crate) fn prune_recent_redstone_torch_toggles(&self)
pub(crate) fn prune_recent_redstone_torch_toggles(&self)
Removes torch toggles older than vanilla’s 60-game-tick window.
Sourcepub(crate) fn redstone_torch_toggled_too_frequently(
&self,
pos: BlockPos,
add: bool,
) -> bool
pub(crate) fn redstone_torch_toggled_too_frequently( &self, pos: BlockPos, add: bool, ) -> bool
Counts recent toggles for pos, optionally recording one first.
This bookkeeping and scheduled tick deadlines both use world game time, matching Vanilla’s loaded-world timing model.
Source§impl World
impl World
Sourcepub async fn initialize_spawn_if_needed(self: &Arc<Self>) -> Result<(), String>
pub async fn initialize_spawn_if_needed(self: &Arc<Self>) -> Result<(), String>
Initializes this world’s default spawn using vanilla’s first-world spawn search.
pub(super) fn find_spawn_in_loaded_radius( &self, spawn_chunk: ChunkPos, ) -> Option<BlockPos>
pub(super) fn spawn_pos_in_chunk(&self, chunk_pos: ChunkPos) -> Option<BlockPos>
pub(super) fn level_respawn_pos(&self, x: i32, z: i32) -> Option<BlockPos>
pub(crate) fn height_at( &self, heightmap_type: HeightmapType, x: i32, z: i32, ) -> Option<i32>
pub(super) fn vanilla_chunk_height_at( &self, heightmap_type: HeightmapType, x: i32, z: i32, ) -> Option<i32>
pub(super) fn heightmap_pos( &self, heightmap_type: HeightmapType, pos: BlockPos, ) -> BlockPos
Sourcepub(crate) fn adjust_spawn_location(
&self,
spawn_suggestion: BlockPos,
) -> BlockPos
pub(crate) fn adjust_spawn_location( &self, spawn_suggestion: BlockPos, ) -> BlockPos
Mirrors vanilla Entity.adjustSpawnLocation for cross-world returns.
pub(super) fn level_height_at( &self, heightmap_type: HeightmapType, x: i32, z: i32, ) -> i32
Source§impl World
impl World
Sourcepub fn schedule_block_tick(
&self,
pos: BlockPos,
block: BlockRef,
delay: i32,
priority: TickPriority,
)
pub fn schedule_block_tick( &self, pos: BlockPos, block: BlockRef, delay: i32, priority: TickPriority, )
Schedules a block tick at the given position.
The tick will fire after delay world game ticks with the given priority.
Its deadline continues to age while the loaded chunk is outside simulation distance.
Only one tick per (pos, block) pair can be active at a time — duplicates
are silently ignored.
Sourcepub fn schedule_block_tick_default(
&self,
pos: BlockPos,
block: BlockRef,
delay: i32,
)
pub fn schedule_block_tick_default( &self, pos: BlockPos, block: BlockRef, delay: i32, )
Schedules a block tick with Normal priority.
Sourcepub fn schedule_fluid_tick(
&self,
pos: BlockPos,
fluid: FluidRef,
delay: i32,
priority: TickPriority,
)
pub fn schedule_fluid_tick( &self, pos: BlockPos, fluid: FluidRef, delay: i32, priority: TickPriority, )
Schedules a fluid tick at the given position.
The tick will fire after delay world game ticks with the given priority.
Its deadline continues to age while the loaded chunk is outside simulation distance.
Only one tick per (pos, fluid) pair can be active at a time.
Sourcepub fn schedule_fluid_tick_default(
&self,
pos: BlockPos,
fluid: FluidRef,
delay: i32,
)
pub fn schedule_fluid_tick_default( &self, pos: BlockPos, fluid: FluidRef, delay: i32, )
Schedules a fluid tick with Normal priority.
Sourcepub fn has_scheduled_block_tick(&self, pos: BlockPos, block: BlockRef) -> bool
pub fn has_scheduled_block_tick(&self, pos: BlockPos, block: BlockRef) -> bool
Returns true if a block tick is already scheduled for the given (pos, block).
§Panics
Panics if a published Full chunk’s scheduled-tick container was finalized, which violates the chunk publication invariant.
Sourcepub fn has_scheduled_fluid_tick(&self, pos: BlockPos, fluid: FluidRef) -> bool
pub fn has_scheduled_fluid_tick(&self, pos: BlockPos, fluid: FluidRef) -> bool
Returns true if a fluid tick is already scheduled for the given (pos, fluid).
§Panics
Panics if a published Full chunk’s scheduled-tick container was finalized, which violates the chunk publication invariant.
pub(crate) fn register_full_chunk_ticks( &self, chunk: FullChunkRef<'_>, ) -> Result<(), TickSchedulerError>
pub(crate) fn unregister_full_chunk_ticks(&self, pos: ChunkPos)
pub(crate) fn schedule_block_tick_for_chunk( &self, chunk: FullChunkRef<'_>, pos: BlockPos, block: BlockRef, trigger_tick: i64, priority: TickPriority, sub_tick_order: i64, ) -> Result<bool, TickSchedulerError>
pub(crate) fn schedule_fluid_tick_for_chunk( &self, chunk: FullChunkRef<'_>, pos: BlockPos, fluid: FluidRef, trigger_tick: i64, priority: TickPriority, sub_tick_order: i64, ) -> Result<bool, TickSchedulerError>
pub(crate) fn unpack_scheduled_ticks( &self, pos: ChunkPos, ) -> Result<(), TickSchedulerError>
pub(crate) fn reconcile_active_scheduled_tick_chunks<I>( &self, active_chunks: I, ) -> Result<(), TickSchedulerError>
pub(crate) fn begin_scheduled_tick_phase( &self, current_tick: i64, max_ticks: usize, ) -> ScheduledTickBatch<BlockRef>
pub(crate) fn collect_scheduled_fluid_tick_batch( &self, current_tick: i64, max_ticks: usize, ) -> ScheduledTickBatch<FluidRef>
Sourcepub fn will_tick_block_this_tick(&self, pos: BlockPos, block: BlockRef) -> bool
pub fn will_tick_block_this_tick(&self, pos: BlockPos, block: BlockRef) -> bool
Returns whether a selected block tick at (pos, block) has not started yet.
This mirrors LevelTickAccess.willTickThisTick and is distinct from
Self::has_scheduled_block_tick, because selected ticks have already
been removed from their owning chunk queue.
Sourcepub fn will_tick_fluid_this_tick(&self, pos: BlockPos, fluid: FluidRef) -> bool
pub fn will_tick_fluid_this_tick(&self, pos: BlockPos, fluid: FluidRef) -> bool
Returns whether a selected fluid tick at (pos, fluid) has not started yet.
pub(crate) fn begin_scheduled_block_tick_batch( &self, ticks: Vec<BlockTick>, ) -> Arc<ScheduledTickRunBatch<BlockRef>> ⓘ
pub(crate) fn end_scheduled_block_tick_batch( &self, batch: &Arc<ScheduledTickRunBatch<BlockRef>>, )
pub(crate) fn begin_scheduled_fluid_tick_batch( &self, ticks: Vec<FluidTick>, ) -> Arc<ScheduledTickRunBatch<FluidRef>> ⓘ
pub(crate) fn end_scheduled_fluid_tick_batch( &self, batch: &Arc<ScheduledTickRunBatch<FluidRef>>, )
Source§impl World
impl World
pub(super) fn tick_weather(&self)
Sourcepub(crate) fn set_weather_parameters(
&self,
clear_time: i32,
rain_time: i32,
raining: bool,
thundering: bool,
)
pub(crate) fn set_weather_parameters( &self, clear_time: i32, rain_time: i32, raining: bool, thundering: bool, )
Sets this world’s weather timers and flags.
Minecraft 26.2 owns this state at server scope. Steel intentionally owns it per world so multiple worlds in one domain can have independent weather.
Sourcepub fn is_raining(&self) -> bool
pub fn is_raining(&self) -> bool
Checks whether the rain level is high enough to be considered raining. Used for both visual rendering and gameplay logic (crop growth, fire, mob behavior).
WARNING: this function acquires a lock on the weather field.
if you already have a lock on the weather field, this will DEADLOCK.
Sourcepub fn is_raining_at(&self, pos: BlockPos) -> bool
pub fn is_raining_at(&self, pos: BlockPos) -> bool
Checks whether rain reaches the given block position.
Mirrors vanilla Level.isRainingAt: global rain state, sky exposure,
motion-blocking height, and biome precipitation must all allow rain.
Sourcepub fn is_raining_with_guard(&self, guard: &Weather) -> bool
pub fn is_raining_with_guard(&self, guard: &Weather) -> bool
Checks whether the rain level is sufficient to render rain clientside using the provided guard.
Sourcepub fn is_thundering(&self) -> bool
pub fn is_thundering(&self) -> bool
Checks whether the thunder level and rain level are high enough to be considered thundering. Used for lightning spawning and gameplay logic.
WARNING: this function acquires a lock on the weather field.
if you already have a lock on the weather field, this will DEADLOCK.
Sourcepub fn is_thundering_with_guard(&self, guard: &Weather) -> bool
pub fn is_thundering_with_guard(&self, guard: &Weather) -> bool
Checks whether the thunder level and rain level are sufficient to spawn thunderbolts using the provided guard.
Sourcepub fn sky_light_level(&self) -> f32
pub fn sky_light_level(&self) -> f32
Returns the current vanilla SKY_LIGHT_LEVEL environment attribute.
Sourcepub fn sky_darkening(&self) -> u8
pub fn sky_darkening(&self) -> u8
Returns vanilla Level.skyDarken.
Sourcepub fn sun_angle_degrees(&self) -> f32
pub fn sun_angle_degrees(&self) -> f32
Returns the current vanilla SUN_ANGLE environment attribute in degrees.
Sourcepub fn effective_sky_brightness(&self, pos: BlockPos) -> u8
pub fn effective_sky_brightness(&self, pos: BlockPos) -> u8
Returns sky-layer light after the current sky darkening is subtracted.
Mirrors vanilla LevelReader.getEffectiveSkyBrightness without allowing
block light to raise the result.
Sourcepub fn is_bright_outside(&self) -> bool
pub fn is_bright_outside(&self) -> bool
Returns vanilla Level.isBrightOutside.
Sourcepub fn is_dark_outside(&self) -> bool
pub fn is_dark_outside(&self) -> bool
Returns vanilla Level.isDarkOutside.
Sourcepub fn can_have_weather(&self) -> bool
pub fn can_have_weather(&self) -> bool
Checks whether the world can have weather.
Sourcepub fn can_see_sky(&self, pos: BlockPos) -> bool
pub fn can_see_sky(&self, pos: BlockPos) -> bool
Returns whether the position has unobstructed sky exposure.
Live worlds use the motion-blocking heightmap until Steel has a full live sky-light engine.
pub(super) fn can_see_sky_for_precipitation(&self, pos: BlockPos) -> bool
pub(crate) fn biome_at(&self, pos: BlockPos) -> Option<BiomeRef>
pub(super) fn noise_biome_id( &self, quart_x: i32, quart_y: i32, quart_z: i32, ) -> Option<u16>
pub(super) fn biome_quart_y_indices( min_y: i32, section_count: usize, quart_y: i32, ) -> Option<(usize, usize)>
pub(super) fn biome_temperature(&self, biome: BiomeRef, pos: BlockPos) -> f32
Source§impl World
impl World
Sourcepub(crate) fn contains_player(&self, player: &Player) -> bool
pub(crate) fn contains_player(&self, player: &Player) -> bool
Returns whether this exact player is registered in this world.
fn loaded_world_memberships(player: &Arc<Player>) -> Vec<Arc<World>>
fn reject_duplicate_player_membership( player: &Arc<Player>, target_world: &Arc<World>, operation: &str, ) -> bool
fn take_player_for_removal(&self, player: &Arc<Player>) -> Option<Arc<Player>>
fn attach_player_entity_callback(self: &Arc<Self>, player: &Arc<Player>)
fn register_player_entity(self: &Arc<Self>, player: &Arc<Player>)
fn unride_player_for_removal(&self, player: &Player, store_root_vehicle: bool)
fn remove_root_vehicle_tree_stored_with_player(entity: SharedEntity)
pub(crate) fn unregister_player_entity(&self, player: &Player)
pub(crate) fn register_respawned_player_entity( self: &Arc<Self>, player: &Arc<Player>, )
pub(crate) fn add_respawned_player( self: &Arc<Self>, player: Arc<Player>, ) -> bool
Sourcepub(crate) fn detach_player_for_disconnect(
self: &Arc<Self>,
player: Arc<Player>,
) -> (Arc<Player>, String, PersistentPlayerData)
pub(crate) fn detach_player_for_disconnect( self: &Arc<Self>, player: Arc<Player>, ) -> (Arc<Player>, String, PersistentPlayerData)
Detaches a disconnecting player from live world state and snapshots it.
Persistence happens asynchronously after the server’s pre-tick phase completes.
Sourcepub(crate) fn remove_player_for_world_change(
self: &Arc<Self>,
player: &Arc<Player>,
)
pub(crate) fn remove_player_for_world_change( self: &Arc<Self>, player: &Arc<Player>, )
Removes a player from the world during a world change.
Unlike remove_player, this is synchronous and skips player data saving and tab list
removal — the player stays in the global tab list since they are only switching worlds.
Sourcepub(crate) fn detach_player_for_domain_switch(
self: &Arc<Self>,
player: &Arc<Player>,
) -> Option<(PersistentPlayerData, DomainResidenceToken)>
pub(crate) fn detach_player_for_domain_switch( self: &Arc<Self>, player: &Arc<Player>, ) -> Option<(PersistentPlayerData, DomainResidenceToken)>
Detaches a player for a domain switch and returns its persistence snapshot.
Sourcepub(crate) fn add_player(
self: &Arc<Self>,
player: Arc<Player>,
_reason: ResetReason,
) -> bool
pub(crate) fn add_player( self: &Arc<Self>, player: Arc<Player>, _reason: ResetReason, ) -> bool
Adds a player to the world.
On InitialJoin, sends full tab list + entity spawn synchronization to/from all
players. On WorldChange, this is skipped — the player already exists in all
clients’ tab lists and the entity tracker handles spawning as chunks load.
Source§impl World
impl World
Sourcepub async fn new_with_config(
chunk_runtime: Arc<Runtime>,
key: Identifier,
dimension_type: DimensionTypeRef,
seed: i64,
config: WorldConfig,
generation_pool: Arc<ThreadPool>,
) -> Result<Arc<Self>>
pub async fn new_with_config( chunk_runtime: Arc<Runtime>, key: Identifier, dimension_type: DimensionTypeRef, seed: i64, config: WorldConfig, generation_pool: Arc<ThreadPool>, ) -> Result<Arc<Self>>
Creates a new world with custom configuration.
This allows specifying storage backend (disk or RAM-only) and other options.
Uses Arc::new_cyclic to create a cyclic reference between
the World and its ChunkMap’s WorldGenContext.
§Arguments
chunk_runtime- The Tokio runtime for chunk operationsdimension_type- Vanilla dimension type (overworld, nether, end)seed- The world seedconfig- World configuration including storage options
pub(crate) async fn new_with_config_and_encoding_pool( chunk_runtime: Arc<Runtime>, key: Identifier, dimension_type: DimensionTypeRef, seed: i64, config: WorldConfig, generation_pool: Arc<ThreadPool>, chunk_encoding_pool: Arc<ThreadPool>, ) -> Result<Arc<Self>>
Sourcepub fn tick_game(
self: &Arc<Self>,
tick_count: u64,
runs_normally: bool,
) -> WorldGameTickTimings
pub fn tick_game( self: &Arc<Self>, tick_count: u64, runs_normally: bool, ) -> WorldGameTickTimings
Game tick: weather, time, chunk game tick (broadcasts + random/scheduled ticks), and player logic (without chunk sending).
tick_count- The current tick numberruns_normally- Whether game elements (random ticks, entities) should run. When false (frozen), only essential operations like chunk loading run.
Sourcepub async fn save_all_chunks(&self) -> Result<usize>
pub async fn save_all_chunks(&self) -> Result<usize>
Saves all dirty chunks in this world to disk.
This should be called during graceful shutdown. Returns the number of chunks saved.
Trait Implementations§
Source§impl LevelReader for World
impl LevelReader for World
Source§fn get_block_state(&self, pos: BlockPos) -> BlockStateId
fn get_block_state(&self, pos: BlockPos) -> BlockStateId
Source§fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>
fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>
Source§fn is_face_sturdy_for(
&self,
state: BlockStateId,
pos: BlockPos,
direction: Direction,
support_type: SupportType,
) -> bool
fn is_face_sturdy_for( &self, state: BlockStateId, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool
BlockState.isFaceSturdy for a specific support type. Read moreSource§fn raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8
fn raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8
Source§fn can_see_sky(&self, pos: BlockPos) -> bool
fn can_see_sky(&self, pos: BlockPos) -> bool
BlockAndLightGetter.canSeeSky.Source§fn ambient_light(&self) -> f32
fn ambient_light(&self) -> f32
Source§fn is_face_sturdy(
&self,
state: BlockStateId,
pos: BlockPos,
direction: Direction,
) -> bool
fn is_face_sturdy( &self, state: BlockStateId, pos: BlockPos, direction: Direction, ) -> bool
BlockState.isFaceSturdy with full-face support.Source§fn max_y_exclusive(&self) -> i32
fn max_y_exclusive(&self) -> i32
Source§fn is_outside_build_height(&self, y: i32) -> bool
fn is_outside_build_height(&self, y: i32) -> bool
Source§fn max_local_raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8
fn max_local_raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8
LevelReader.getMaxLocalRawBrightness.Source§fn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32
fn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32
LevelReader.getLightLevelDependentMagicValue.Source§fn pathfinding_cost_from_light_levels(&self, pos: BlockPos) -> f32
fn pathfinding_cost_from_light_levels(&self, pos: BlockPos) -> f32
LevelReader.getPathfindingCostFromLightLevels.Source§impl PistonLevel for World
impl PistonLevel for World
fn is_within_world_border(&self, pos: BlockPos) -> bool
Auto Trait Implementations§
impl !Freeze for World
impl !RefUnwindSafe for World
impl !UnwindSafe for World
impl Send for World
impl Sync for World
impl Unpin for World
impl UnsafeUnpin for World
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<>>§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SignalGetter for Twhere
T: LevelReader,
impl<T> SignalGetter for Twhere
T: LevelReader,
Source§fn is_redstone_conductor(&self, state: BlockStateId, pos: BlockPos) -> bool
fn is_redstone_conductor(&self, state: BlockStateId, pos: BlockPos) -> bool
state conducts direct power at this level position.Source§fn get_direct_signal(&self, pos: BlockPos, direction: Direction) -> i32
fn get_direct_signal(&self, pos: BlockPos, direction: Direction) -> i32
pos toward direction.Source§fn get_direct_signal_to(&self, pos: BlockPos) -> i32
fn get_direct_signal_to(&self, pos: BlockPos) -> i32
pos from its six neighbors.Source§fn get_control_input_signal(
&self,
pos: BlockPos,
direction: Direction,
only_diodes: bool,
) -> i32
fn get_control_input_signal( &self, pos: BlockPos, direction: Direction, only_diodes: bool, ) -> i32
Source§fn has_signal(&self, pos: BlockPos, direction: Direction) -> bool
fn has_signal(&self, pos: BlockPos, direction: Direction) -> bool
pos supplies a signal toward direction.Source§fn get_signal(&self, pos: BlockPos, direction: Direction) -> i32
fn get_signal(&self, pos: BlockPos, direction: Direction) -> i32
pos toward direction.Source§fn get_best_own_or_neighbour_signal(&self, pos: BlockPos) -> i32
fn get_best_own_or_neighbour_signal(&self, pos: BlockPos) -> i32
pos, including the block’s own source value.Source§fn has_neighbor_signal(&self, pos: BlockPos) -> bool
fn has_neighbor_signal(&self, pos: BlockPos) -> bool
pos.Source§fn get_best_neighbor_signal(&self, pos: BlockPos) -> i32
fn get_best_neighbor_signal(&self, pos: BlockPos) -> i32
pos by its six neighbors.