Table of Contents

Interface IParticlePropertiesProvider

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Represents a provider of particle properties to be used when generating a particle

public interface IParticlePropertiesProvider
Extension Methods

Properties

Async

If true, will be be spawned in the async particle system, which does not affect main game performance, recommended for large quantities of particles, slightly less optimal for particles that spawn very often

bool Async { get; }

Property Value

bool

BlueEvolve

Return null or 1 if opacity should remain unchanged over time. lifetimeLeft is always a value between 0 and 1

EvolvingNatFloat BlueEvolve { get; }

Property Value

EvolvingNatFloat

Bounciness

float Bounciness { get; }

Property Value

float

DeathParticles

The particle to spawn upon the particle death.

IParticlePropertiesProvider[] DeathParticles { get; }

Property Value

IParticlePropertiesProvider[]

DieInAir

Whether the particle should despawn when in contact with air (e.g. for water bubbles)

bool DieInAir { get; }

Property Value

bool

DieInLiquid

Whether the particle should despawn when in contact with liquids

bool DieInLiquid { get; }

Property Value

bool

DieOnRainHeightmap

If true, particle dies if it falls below the rain height at its given location

bool DieOnRainHeightmap { get; }

Property Value

bool

GravityEffect

How strongly the particle is affected by gravity (0 = no gravity applied)

float GravityEffect { get; }

Property Value

float

GreenEvolve

Return null or 1 if opacity should remain unchanged over time. lifetimeLeft is always a value between 0 and 1

EvolvingNatFloat GreenEvolve { get; }

Property Value

EvolvingNatFloat

LifeLength

How long the particle should live (default = 1)

float LifeLength { get; }

Property Value

float

LightEmission

If this particle emits light, this is its RGBA. Does not actually brighten the scene around it, but prevents incorrect lighting of particles when everything else around it is dark

int LightEmission { get; }

Property Value

int

OpacityEvolve

Return null or 1 if opacity should remain unchanged over time. lifetimeLeft is always a value between 0 and 1

EvolvingNatFloat OpacityEvolve { get; }

Property Value

EvolvingNatFloat

ParentVelocity

Vec3f ParentVelocity { get; }

Property Value

Vec3f

ParentVelocityWeight

float ParentVelocityWeight { get; }

Property Value

float

ParticleModel

Cube or Quad?

EnumParticleModel ParticleModel { get; }

Property Value

EnumParticleModel

Pos

Position in the world where the particle should spawn

Vec3d Pos { get; }

Property Value

Vec3d

Quantity

How many particles should spawn? For every particle spawned, all of belows methods are called once. E.g. if quantity is 10, GetPos(), GetVelocity(),... is called 10 times.

float Quantity { get; }

Property Value

float

RandomVelocityChange

bool RandomVelocityChange { get; }

Property Value

bool

RedEvolve

Return null or 1 if opacity should remain unchanged over time. lifetimeLeft is always a value between 0 and 1

EvolvingNatFloat RedEvolve { get; }

Property Value

EvolvingNatFloat

SecondaryParticles

The secondary particle properties. Secondary particles are particles that are emitted from an in-flight particle.

IParticlePropertiesProvider[] SecondaryParticles { get; }

Property Value

IParticlePropertiesProvider[]

SecondarySpawnInterval

Determines the interval of time that must elapse during it's parent particle's lifetime before this one will spawn. This is only honored if this particle is defined as a secondary particle.

float SecondarySpawnInterval { get; }

Property Value

float

SelfPropelled

If true, a particle will restore it's initial velocity once it's obstruction has been cleared e.g. Smokes will start flying upwards again if is currently stuck under a block and the block is removed

bool SelfPropelled { get; }

Property Value

bool

Size

Size of the particle

float Size { get; }

Property Value

float

SizeEvolve

Size change over time

EvolvingNatFloat SizeEvolve { get; }

Property Value

EvolvingNatFloat

SwimOnLiquid

bool SwimOnLiquid { get; }

Property Value

bool

TerrainCollision

If true, the particle will collide with the terrain

bool TerrainCollision { get; }

Property Value

bool

VelocityEvolve

Velocity change over time (acts as a multiplier to the velocity)

EvolvingNatFloat[] VelocityEvolve { get; }

Property Value

EvolvingNatFloat[]

VertexFlags

See also VertexFlags

int VertexFlags { get; }

Property Value

int

Methods

BeginParticle()

Called just before a new particle is being created. You can use this to produce e.g. alternating kinds of particles

void BeginParticle()

FromBytes(BinaryReader, IWorldAccessor)

For reading from the network

void FromBytes(BinaryReader reader, IWorldAccessor resolver)

Parameters

reader BinaryReader
resolver IWorldAccessor

GetRgbaColor(ICoreClientAPI)

The particles Rgba Color

int GetRgbaColor(ICoreClientAPI capi)

Parameters

capi ICoreClientAPI

Returns

int

GetVelocity(Vec3d)

In what direction should the particle fly/fall

Vec3f GetVelocity(Vec3d pos)

Parameters

pos Vec3d

Returns

Vec3f

Init(ICoreAPI)

Called before the particle provider is used for particle creation

void Init(ICoreAPI api)

Parameters

api ICoreAPI

PrepareForSecondarySpawn(ParticleBase)

Updates instance related state for secondary particles based on the given parent particle instance

void PrepareForSecondarySpawn(ParticleBase particleInstance)

Parameters

particleInstance ParticleBase

The parent IParticleInstance from which this secondary particle is being spawned

ToBytes(BinaryWriter)

For sending over the network

void ToBytes(BinaryWriter writer)

Parameters

writer BinaryWriter