pub struct World<'a> { /* private fields */ }Expand description
An ergonomic handle to one dimension’s blocks, bound to a Server.
Implementations§
Source§impl<'a> World<'a>
impl<'a> World<'a>
Sourcepub fn new(server: &'a dyn Server, dimension: impl Into<String>) -> World<'a>
pub fn new(server: &'a dyn Server, dimension: impl Into<String>) -> World<'a>
Bind to dimension (e.g. dimension::OVERWORLD) on server.
Sourcepub fn get_block(&self, pos: BlockPos) -> Option<String>
pub fn get_block(&self, pos: BlockPos) -> Option<String>
Registry id of the block at pos, or None if unavailable.
Sourcepub fn set_block(&self, pos: BlockPos, block_id: &str) -> bool
pub fn set_block(&self, pos: BlockPos, block_id: &str) -> bool
Set the block at pos to block_id; returns whether it was applied.
Sourcepub fn set_time(&self, time: i64) -> bool
pub fn set_time(&self, time: i64) -> bool
Set the time-of-day (0 = dawn, 6000 = noon, 12000 = dusk, 18000 = midnight).
Sourcepub fn is_raining(&self) -> bool
pub fn is_raining(&self) -> bool
Whether it is currently raining in this dimension.
Sourcepub fn set_weather(&self, raining: bool, duration_ticks: i32) -> bool
pub fn set_weather(&self, raining: bool, duration_ticks: i32) -> bool
Start or stop rain. duration_ticks = 0 picks a server-default duration.
Sourcepub fn entity_count(&self, entity_type: &str) -> i32
pub fn entity_count(&self, entity_type: &str) -> i32
Number of loaded entities of entity_type (e.g. "minecraft:zombie")
in this dimension. Returns -1 if the dimension or type is unknown.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for World<'a>
impl<'a> !Send for World<'a>
impl<'a> !Sync for World<'a>
impl<'a> !UnwindSafe for World<'a>
impl<'a> Freeze for World<'a>
impl<'a> Unpin for World<'a>
impl<'a> UnsafeUnpin for World<'a>
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