Skip to main content

ParticleOptions

Struct ParticleOptions 

pub struct ParticleOptions {
    pub ty: ParticleKey,
    pub block: Option<(String, u32)>,
    pub color: [f32; 4],
    pub scale: f32,
    pub to_color: [f32; 3],
    pub trail: Option<([f64; 3], i32)>,
    pub item: Option<Vec<String>>,
    pub item_stack: Option<ItemStack>,
    pub geyser: Option<(i32, f32)>,
    pub vibration: Option<(PositionSource, [f64; 3], i32)>,
    pub legacy_entity_effect: Option<bool>,
    pub legacy_trail_lifetime: bool,
}
Expand description

ParticleOptions with the parameters of the option classes used here.

Fields§

§ty: ParticleKey

Provider identity issued by Registrar::particle_key, never an engine enum.

§block: Option<(String, u32)>

BlockParticleOption: the block’s particle sprite and terrain tint.

§color: [f32; 4]

RGB(A) for dust, spells, entity effects and tinted leaves.

§scale: f32

DustParticleOptions.scale, PowerParticleOption.power, SpellParticleOption.power, SculkChargeParticleOptions.roll, ShriekParticleOption.delay.

§to_color: [f32; 3]

DustColorTransitionOptions.toColor (color is the from colour).

§trail: Option<([f64; 3], i32)>

TrailParticleOption: the point it flies to and how many ticks it takes.

§item: Option<Vec<String>>

ItemParticleOption: the particle sprite of each layer of the item’s model as resolved for the ground.

§item_stack: Option<ItemStack>

Stack sent by ServerLevel.sendParticles; clients resolve its ground model at seed 0. Invalid, unknown or oversized stacks cause the send to return false.

§geyser: Option<(i32, f32)>

GeyserParticleOptions.waterBlocks and GeyserBaseParticleOptions’ waterBlocks and burstImpulseBase (0 where the type has none).

§vibration: Option<(PositionSource, [f64; 3], i32)>

VibrationParticleOption: the listener’s position source, the resolved point the signal flies to and its arrival time in ticks. The source is sent to clients; the resolved point is used for local rendering (ParticleEngine::vibration is the same particle).

§legacy_entity_effect: Option<bool>

Older entity-effect providers use velocity as RGB; true is ambient.

§legacy_trail_lifetime: bool

Older trails choose their lifetime in the provider rather than on the wire.

Implementations§

§

impl ParticleOptions

pub fn item_stack(ty: ParticleKey, stack: ItemStack) -> ParticleOptions

Vanilla ItemParticleOption(type, stack) for server delivery. The receiving client resolves the stack’s ground model with seed 0, using the same path as ClientHost::item_particle_options. A send refuses unknown, invalid or oversized stacks and returns false.

§

impl ParticleOptions

pub fn simple(ty: ParticleKey) -> ParticleOptions

Construct an option for a retained vanilla or custom sprite-provider key.

pub fn geyser(ty: ParticleKey, water_blocks: i32) -> ParticleOptions

GeyserParticleOptions(type, waterBlocks).

pub fn geyser_base( ty: ParticleKey, water_blocks: i32, burst_impulse_base: f32, ) -> ParticleOptions

GeyserBaseParticleOptions(type, waterBlocks, burstImpulseBase).

pub fn vibration( ty: ParticleKey, source: PositionSource, dest: [f64; 3], ticks: i32, ) -> ParticleOptions

VibrationParticleOption(destination, arrivalInTicks): the listener’s position source and the resolved point this engine flies the signal to.

pub fn item(ty: ParticleKey, layers: Vec<String>) -> ParticleOptions

ItemParticleOption: the stack’s layer particle sprites (BreakingItemParticle).

pub fn dust_transition( ty: ParticleKey, from: [f32; 3], to: [f32; 3], scale: f32, ) -> ParticleOptions

DustColorTransitionOptions.

pub fn sculk_to_redstone(ty: ParticleKey) -> ParticleOptions

DustColorTransitionOptions.SCULK_TO_REDSTONE.

pub fn sculk_charge(ty: ParticleKey, roll: f32) -> ParticleOptions

SculkChargeParticleOptions(roll).

pub fn shriek(ty: ParticleKey, delay: i32) -> ParticleOptions

ShriekParticleOption(delay).

pub fn trail( ty: ParticleKey, target: [f64; 3], rgb: u32, duration: i32, ) -> ParticleOptions

TrailParticleOption(target, color, duration).

pub fn block(ty: ParticleKey, sprite: String, tint: u32) -> ParticleOptions

pub fn dust(ty: ParticleKey, rgb: [f32; 3], scale: f32) -> ParticleOptions

DustParticleOptions(color, scale).

pub fn colored(ty: ParticleKey, rgba: [f32; 4]) -> ParticleOptions

Trait Implementations§

§

impl Clone for ParticleOptions

§

fn clone(&self) -> ParticleOptions

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
§

impl Debug for ParticleOptions

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for ParticleOptions

§

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

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

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

Inequality operator !=. Read more
§

impl StructuralPartialEq for ParticleOptions

§

impl Wire for ParticleOptions

§

const MIN: usize

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take(input: &mut Reader<'_>) -> Result<ParticleOptions, WireError>

Decodes one value, leaving any following bytes for the caller.

Auto Trait Implementations§

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

§

impl<T> Put for T
where T: Wire,

§

fn put_to(&self, out: &mut Writer)

Writes it.
§

impl<T> Record for T
where T: Wire,

§

fn encode(&self, out: &mut Writer)

Writes the argument into a hook call.
§

fn apply(&mut self, bytes: &[u8]) -> Result<(), WireError>

Applies one complete reply, refusing malformed or trailing bytes atomically.
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 = 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.