Trait EntitiesServerHost
pub trait EntitiesServerHost {
// Provided methods
fn summon(
&mut self,
dimension: &str,
kind: &str,
pos: [f64; 3],
nbt: BTreeMap<JavaString, Tag>,
) -> Option<u32> { ... }
fn set_experience_orb(
&mut self,
dimension: &str,
id: u32,
value: Option<i32>,
count: Option<u32>,
age: Option<u32>,
) -> bool { ... }
fn experience_orbs(
&self,
dimension: &str,
min: [f64; 3],
max: [f64; 3],
) -> Vec<ExperienceOrb> { ... }
fn spawn_falling_block(
&mut self,
dimension: &str,
state: BlockState,
pos: [f64; 3],
velocity: [f64; 3],
falling: Falling,
) -> bool { ... }
}Expand description
The server host’s methods of the entities area, implemented by the game and reached through ServerHost.
Provided Methods§
fn summon(
&mut self,
dimension: &str,
kind: &str,
pos: [f64; 3],
nbt: BTreeMap<JavaString, Tag>,
) -> Option<u32>
fn summon( &mut self, dimension: &str, kind: &str, pos: [f64; 3], nbt: BTreeMap<JavaString, Tag>, ) -> Option<u32>
Side: server.
Spawns an entity of kind (minecraft:item_display) at pos in the
level in place, dimension, from nbt (its compound, as /summon <kind> <pos> <nbt> takes it; passengers included): its id. None on a
client’s copy of the world, for another dimension, a position outside
/summon’s bounds, a chunk that isn’t loaded, a kind Horizon can’t
load, or one a mod kept out (native_entity_join_level).
fn set_experience_orb(
&mut self,
dimension: &str,
id: u32,
value: Option<i32>,
count: Option<u32>,
age: Option<u32>,
) -> bool
fn set_experience_orb( &mut self, dimension: &str, id: u32, value: Option<i32>, count: Option<u32>, age: Option<u32>, ) -> bool
Side: server.
Writes the experience orb id’s value (the points a pickup gives), count
(orbs merged into it, each worth value) and age (ticks lived; an orb
despawns at 6000); a None is left as it is. Signed values are preserved,
including zero and negative values.
False, and nothing written, for an orb not in the server level dimension,
a count of 0, and on a client of a server.
fn experience_orbs(
&self,
dimension: &str,
min: [f64; 3],
max: [f64; 3],
) -> Vec<ExperienceOrb>
fn experience_orbs( &self, dimension: &str, min: [f64; 3], max: [f64; 3], ) -> Vec<ExperienceOrb>
Side: server.
The experience orbs of the server level dimension whose box meets
the box min..max, in the level’s order: what a mod reads before it
cancels an orb in native_entity_join_level, to give its points with
PlayerRef::give_experience_points. Empty for a level not in place and on a
client of a server.
fn spawn_falling_block(
&mut self,
dimension: &str,
state: BlockState,
pos: [f64; 3],
velocity: [f64; 3],
falling: Falling,
) -> bool
fn spawn_falling_block( &mut self, dimension: &str, state: BlockState, pos: [f64; 3], velocity: [f64; 3], falling: Falling, ) -> bool
Side: server.
Throws a falling block of state from pos (its bottom centre) at
velocity (blocks a tick) in the level in place, dimension: it
falls, lands and places itself as sand does, or drops as an item
where it can’t. The block at pos is left as it is: take it away first
with native_set_block to make a block fall out of the world. False,
with nothing thrown, on a client’s copy of the world, for another
dimension, an air or unknown state, a chunk that isn’t loaded, a value
that isn’t finite, or with 1024 falling blocks in the level already.
Each axis of velocity is cut to 3.9.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".