Skip to main content

World

Struct World 

Source
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>

Source

pub fn new(server: &'a dyn Server, dimension: impl Into<String>) -> World<'a>

Bind to dimension (e.g. dimension::OVERWORLD) on server.

Source

pub fn get_block(&self, pos: BlockPos) -> Option<String>

Registry id of the block at pos, or None if unavailable.

Source

pub fn set_block(&self, pos: BlockPos, block_id: &str) -> bool

Set the block at pos to block_id; returns whether it was applied.

Source

pub fn time(&self) -> Option<i64>

Game time in ticks since world creation.

Source

pub fn set_time(&self, time: i64) -> bool

Set the time-of-day (0 = dawn, 6000 = noon, 12000 = dusk, 18000 = midnight).

Source

pub fn is_raining(&self) -> bool

Whether it is currently raining in this dimension.

Source

pub fn set_weather(&self, raining: bool, duration_ticks: i32) -> bool

Start or stop rain. duration_ticks = 0 picks a server-default duration.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.