Skip to main content

ParticleProvider

Trait ParticleProvider 

pub trait ParticleProvider:
    Send
    + Sync
    + 'static {
    // Required method
    fn tick(&self, particle: &mut ModParticle);
}
Expand description

A mod’s particle provider: NeoForge’s ParticleProvider, held by the game for every particle of its type. Particles of a type share one provider, so per-particle data lives in ModParticle::state, not in the provider.

A tick has no Host and no level: the engine ticks particles inside the render crate, which reaches no gameplay. A provider that needs the world reads it in a hook and keeps what it read.

Required Methods§

fn tick(&self, particle: &mut ModParticle)

Particle.tick: advance particle by one tick. The game has set previous and age already and expires the particle once age passes lifetime; the tick sets position, frame, size, rgba, lifetime and removed. A number that is not finite expires the particle.

Trait Implementations§

§

impl Wire for Box<dyn ParticleProvider>

§

const MIN: usize = 8

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<Box<dyn ParticleProvider>, WireError>

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§