Skip to main content

World

Struct World 

Source
pub struct World {
    pub dim: String,
}
Expand description

A dimension (minecraft:overworld): every action whose first field is dim.

Fields§

§dim: String

Implementations§

Source§

impl World

Source

pub fn new(dim: impl Into<String>) -> World

Source

pub fn overworld() -> World

Source

pub fn property(&self, pos: BlockPos, name: &str) -> Option<String>

Property name of the block at pos ("energized" → "true").

Source

pub fn set_properties(&self, pos: BlockPos, properties: &str) -> bool

Sets some properties of the block at pos ("energized=true,powered=false"), keeping the rest; false if there’s no block or the state doesn’t take.

Source§

impl World

Source

pub fn nbt(&self, pos: impl Arg<BlockPos>) -> Option<String>

A block entity’s data as SNBT.

Source§

impl World

Source

pub fn set_nbt(&self, pos: impl Arg<BlockPos>, snbt: impl Arg<String>) -> bool

Merges snbt into a block entity’s data.

Source§

impl World

Source

pub fn state(&self, pos: impl Arg<BlockPos>) -> Option<String>

The block state at pos (minecraft:oak_log[axis=y]).

Source§

impl World

Source

pub fn set_state( &self, pos: impl Arg<BlockPos>, state: impl Arg<String>, ) -> bool

Sets the block state at pos.

Source§

impl World

Source

pub fn info(&self, pos: impl Arg<BlockPos>) -> Option<BlockInfo>

The block’s state.

Source§

impl World

Source

pub fn destroy( &self, pos: impl Arg<BlockPos>, drop: impl Arg<bool>, breaker: impl Arg<String>, ) -> bool

Breaks the block (dropping it or not).

Source§

impl World

Source

pub fn bonemeal(&self, pos: impl Arg<BlockPos>) -> bool

Applies bone meal to the block.

Source§

impl World

Source

pub fn use_item( &self, pos: impl Arg<BlockPos>, face: impl Arg<u8>, item: impl Arg<String>, player: impl Arg<String>, ) -> bool

Uses item on a face of the block, as player would.

Source§

impl World

Source

pub fn pour_fluid( &self, pos: impl Arg<BlockPos>, bucket: impl Arg<String>, ) -> bool

Empties a bucket at pos.

Source§

impl World

Source

pub fn redstone_power(&self, pos: impl Arg<BlockPos>) -> Option<u8>

The redstone power reaching the block; None without the dimension.

Source§

impl World

Source

pub fn redstone_signal(&self, pos: impl Arg<BlockPos>) -> Option<u8>

The strongest signal the block gives out; None if it gives none.

Source§

impl World

Source

pub fn set_redstone_output( &self, pos: impl Arg<BlockPos>, level: impl Arg<i32>, ) -> bool

Sets a mod block’s redstone output.

Source§

impl World

Source

pub fn inventory_slot( &self, pos: impl Arg<BlockPos>, slot: impl Arg<u32>, ) -> Option<Stack>

A container’s slot.

Source§

impl World

Source

pub fn set_inventory_slot( &self, pos: impl Arg<BlockPos>, slot: impl Arg<u32>, item: impl Arg<String>, count: impl Arg<u32>, snbt: impl Arg<String>, ) -> bool

Sets a container’s slot.

Source§

impl World

Source

pub fn set_block_tint( &self, pos: impl Arg<BlockPos>, color: impl Arg<i32>, ) -> bool

Tints the block at pos on this client (0xRRGGBB; -1 clears it).

Source§

impl World

Source

pub fn spawn_item( &self, pos: impl Arg<Point>, velocity: impl Arg<Point>, item: impl Arg<String>, count: impl Arg<u32>, snbt: impl Arg<String>, ) -> Option<String>

Drops a stack into the world; the item entity’s uuid.

Source§

impl World

Source

pub fn spawn_particles( &self, pos: impl Arg<Point>, particle: impl Arg<String>, count: impl Arg<i32>, spread: impl Arg<Point>, speed: impl Arg<f64>, ) -> bool

Spawns count particles around pos.

Source§

impl World

Source

pub fn play( &self, pos: impl Arg<Point>, sound: impl Arg<String>, volume: impl Arg<f32>, pitch: impl Arg<f32>, ) -> bool

Plays sound at pos.

Source§

impl World

Source

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

The block at pos (minecraft:stone); None without the dimension.

Source§

impl World

Source

pub fn set_block( &self, pos: impl Arg<BlockPos>, block: impl Arg<String>, ) -> bool

Sets the block at pos; whether it did.

Source§

impl World

Source

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

The time of day of dim; None without the dimension.

Source§

impl World

Source

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

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

Source§

impl World

Source

pub fn is_raining(&self) -> bool

Whether it rains in dim.

Source§

impl World

Source

pub fn set_weather( &self, raining: impl Arg<bool>, duration: impl Arg<i32>, ) -> bool

Starts or stops rain for duration ticks.

Source§

impl World

Source

pub fn is_thundering(&self) -> bool

Whether it thunders in dim.

Source§

impl World

Source

pub fn set_thunder( &self, thundering: impl Arg<bool>, duration: impl Arg<i32>, ) -> bool

Starts or stops thunder.

Source§

impl World

Source

pub fn fill_region( &self, from: impl Arg<BlockPos>, to: impl Arg<BlockPos>, state: impl Arg<String>, ) -> Option<u32>

Fills a box with state; how many blocks changed (None: failed).

Source§

impl World

Source

pub fn scan_region( &self, from: impl Arg<BlockPos>, to: impl Arg<BlockPos>, ) -> Vec<PlacedBlock>

The non-air blocks in a box.

Source§

impl World

Source

pub fn place_feature( &self, pos: impl Arg<BlockPos>, feature: impl Arg<String>, ) -> bool

Places a configured feature at pos.

Source§

impl World

Source

pub fn explode( &self, pos: impl Arg<Point>, power: impl Arg<f32>, fire: impl Arg<bool>, source: impl Arg<String>, ) -> bool

Makes an explosion.

Source§

impl World

Source

pub fn entity_count(&self, entity_type: impl Arg<String>) -> Option<u32>

How many entities of entity_type are in dim (None: no such dimension or type).

Source§

impl World

Source

pub fn entities_in_box( &self, min: impl Arg<Point>, max: impl Arg<Point>, ) -> Vec<String>

The uuids of the entities in a box.

Source§

impl World

Source

pub fn raycast_block( &self, from: impl Arg<Point>, to: impl Arg<Point>, ) -> Option<BlockHit>

The first block a ray hits.

Source§

impl World

Source

pub fn raycast_entity( &self, from: impl Arg<Point>, to: impl Arg<Point>, exclude: impl Arg<String>, ) -> Option<String>

The first entity a ray hits: its uuid.

Trait Implementations§

Source§

impl Clone for World

Source§

fn clone(&self) -> World

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for World

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for World

Source§

impl Hash for World

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for World

Source§

fn eq(&self, other: &World) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for World

Auto Trait Implementations§

§

impl Freeze for World

§

impl RefUnwindSafe for World

§

impl Send for World

§

impl Sync for World

§

impl Unpin for World

§

impl UnsafeUnpin for World

§

impl UnwindSafe for World

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> Arg<T> for T

Source§

fn arg(self) -> T

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.