Table of Contents

Class SimpleParticleProperties

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

A configurable implementation of IParticlePropertiesProvider

public class SimpleParticleProperties : IParticlePropertiesProvider
Inheritance
SimpleParticleProperties
Implements
Inherited Members
Extension Methods

Constructors

SimpleParticleProperties()

public SimpleParticleProperties()

SimpleParticleProperties(float, float, int, Vec3d, Vec3d, Vec3f, Vec3f, float, float, float, float, EnumParticleModel)

public SimpleParticleProperties(float minQuantity, float maxQuantity, int color, Vec3d minPos, Vec3d maxPos, Vec3f minVelocity, Vec3f maxVelocity, float lifeLength = 1, float gravityEffect = 1, float minSize = 1, float maxSize = 1, EnumParticleModel model = EnumParticleModel.Cube)

Parameters

minQuantity float
maxQuantity float
color int
minPos Vec3d
maxPos Vec3d
minVelocity Vec3f
maxVelocity Vec3f
lifeLength float
gravityEffect float
minSize float
maxSize float
model EnumParticleModel

Fields

AddPos

public Vec3d AddPos

Field Value

Vec3d

AddQuantity

public float AddQuantity

Field Value

float

AddVelocity

public Vec3f AddVelocity

Field Value

Vec3f

ClimateColorMap

The color map for climate color mapping. Leave null for no coloring by climate

public string ClimateColorMap

Field Value

string

Color

public int Color

Field Value

int

ColorByBlock

public Block ColorByBlock

Field Value

Block

LifeLength

public float LifeLength

Field Value

float

MaxSize

public float MaxSize

Field Value

float

MinPos

public Vec3d MinPos

Field Value

Vec3d

MinQuantity

public float MinQuantity

Field Value

float

MinSize

public float MinSize

Field Value

float

MinVelocity

public Vec3f MinVelocity

Field Value

Vec3f

SeasonColorMap

The color map for season color mapping. Leave null for no coloring by season

public string SeasonColorMap

Field Value

string

SelfPropelled

public bool SelfPropelled

Field Value

bool

WindAffectednes

public float WindAffectednes

Field Value

float

addLifeLength

public float addLifeLength

Field Value

float

randTL

public static ThreadLocal<Random> randTL

Field Value

ThreadLocal<Random>

tmpPos

protected Vec3d tmpPos

Field Value

Vec3d

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

public bool Async { get; set; }

Property Value

bool

BlueEvolve

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

public EvolvingNatFloat BlueEvolve { get; set; }

Property Value

EvolvingNatFloat

Bounciness

public float Bounciness { get; set; }

Property Value

float

DeathParticles

The particle to spawn upon the particle death.

public IParticlePropertiesProvider[] DeathParticles { get; set; }

Property Value

IParticlePropertiesProvider[]

DieInAir

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

public bool DieInAir { get; }

Property Value

bool

DieInLiquid

Whether the particle should despawn when in contact with liquids

public bool DieInLiquid { get; }

Property Value

bool

DieOnRainHeightmap

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

public bool DieOnRainHeightmap { get; set; }

Property Value

bool

GravityEffect

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

public float GravityEffect { get; set; }

Property Value

float

GreenEvolve

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

public EvolvingNatFloat GreenEvolve { get; set; }

Property Value

EvolvingNatFloat

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

public int LightEmission { get; set; }

Property Value

int

OpacityEvolve

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

public EvolvingNatFloat OpacityEvolve { get; set; }

Property Value

EvolvingNatFloat

ParentVelocity

public Vec3f ParentVelocity { get; set; }

Property Value

Vec3f

ParentVelocityWeight

public float ParentVelocityWeight { get; set; }

Property Value

float

ParticleModel

Cube or Quad?

public EnumParticleModel ParticleModel { get; set; }

Property Value

EnumParticleModel

Pos

Position in the world where the particle should spawn

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

public float Quantity { get; }

Property Value

float

RandomVelocityChange

public bool RandomVelocityChange { get; set; }

Property Value

bool

RedEvolve

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

public EvolvingNatFloat RedEvolve { get; set; }

Property Value

EvolvingNatFloat

SecondaryParticles

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

public IParticlePropertiesProvider[] SecondaryParticles { get; set; }

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.

public float SecondarySpawnInterval { get; }

Property Value

float

ShouldDieInAir

public bool ShouldDieInAir { get; set; }

Property Value

bool

ShouldDieInLiquid

public bool ShouldDieInLiquid { get; set; }

Property Value

bool

ShouldSwimOnLiquid

public bool ShouldSwimOnLiquid { get; set; }

Property Value

bool

Size

Size of the particle

public float Size { get; }

Property Value

float

SizeEvolve

Size change over time

public EvolvingNatFloat SizeEvolve { get; set; }

Property Value

EvolvingNatFloat

SwimOnLiquid

public bool SwimOnLiquid { get; }

Property Value

bool

TerrainCollision

If true, the particle will collide with the terrain

public bool TerrainCollision { get; }

Property Value

bool

VelocityEvolve

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

public EvolvingNatFloat[] VelocityEvolve { get; }

Property Value

EvolvingNatFloat[]

VertexFlags

See also VertexFlags

public int VertexFlags { get; set; }

Property Value

int

WindAffected

public bool WindAffected { get; set; }

Property Value

bool

WithTerrainCollision

public bool WithTerrainCollision { get; set; }

Property Value

bool

rand

public static Random rand { get; }

Property Value

Random

Methods

BeginParticle()

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

public void BeginParticle()

Clone(IWorldAccessor)

public SimpleParticleProperties Clone(IWorldAccessor worldForResovle)

Parameters

worldForResovle IWorldAccessor

Returns

SimpleParticleProperties

FromBytes(BinaryReader, IWorldAccessor)

For reading from the network

public void FromBytes(BinaryReader reader, IWorldAccessor resolver)

Parameters

reader BinaryReader
resolver IWorldAccessor

GetRgbaColor(ICoreClientAPI)

The particles Rgba Color

public int GetRgbaColor(ICoreClientAPI capi)

Parameters

capi ICoreClientAPI

Returns

int

GetVelocity(Vec3d)

In what direction should the particle fly/fall

public Vec3f GetVelocity(Vec3d pos)

Parameters

pos Vec3d

Returns

Vec3f

Init(ICoreAPI)

Called before the particle provider is used for particle creation

public void Init(ICoreAPI api)

Parameters

api ICoreAPI

PrepareForSecondarySpawn(ParticleBase)

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

public 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

public void ToBytes(BinaryWriter writer)

Parameters

writer BinaryWriter

UseLighting()

public bool UseLighting()

Returns

bool