Skip to content

Data Particles

A data particle is a JSON file in data/<namespace>/particle/<id>.json. Its sprite is a PNG in data/<namespace>/textures/. Townstead sends both files to every client when a player joins and after a reload, in the same way as attachment and rig textures. Players need only the data pack.

You can use a data particle wherever Pheno accepts a particle ID: pheno:spawn_particles, the pheno:particle ambient gene, pheno:beam, pheno:cloud, and the block action pheno:spawn_particles. When a registered particle has the same ID as a data particle, Townstead uses the registered particle.

{
"schema": "townstead:particle/v1",
"texture": "examplepack:textures/particle/frost_mote.png",
"frames": 4,
"frame_time": 3,
"lifetime": [20, 40],
"size": [0.08, 0.14],
"colors": ["#BFE8FF", "#FFFFFF"],
"alpha": 0.9,
"glow": true,
"gravity": -0.005,
"drag": 0.92,
"fade_in": 3,
"fade_out": 10,
"shrink": false,
"spin": 4,
"flicker": 0,
"collide": false
}
FieldDefaultNotes
schematownstead:particle/v1. If the schema is wrong, Townstead skips the file.
modsOptional. Townstead loads the file only when these mods are present.
texturerequiredA data-pack texture ID (ns:textures/...png). A resource-pack texture ID also works.
frames1The number of animation frames, one above the other in the texture.
frame_time0Ticks for each frame. With 0, the frames are spread over the life of the particle.
lifetime20Ticks. A number, or [min, max].
size0.1Half the width, in blocks. A number, or [min, max].
colorswhiteOne #RRGGBB tint, or a list. Townstead picks one colour from the list for each particle. You can also write color.
alpha1The highest opacity.
glowfalseFull brightness, whatever the light in the world. Use it for magic. Do not use it for physical things, such as leaves and dust.
gravity0The downward pull each tick. A negative value makes the particle rise.
drag0.96The part of the velocity that the particle keeps each tick.
fade_in / fade_out0Ticks to fade in at the start and to fade out at the end.
shrinkfalseThe size goes down to nothing over the life of the particle.
spin0Degrees each tick, in a random direction.
flicker0A random loss of opacity each tick, from 0 to 1. Use it for embers and foxfire.
collidefalseThe particle stops at blocks.
fade_out_fraction0The particle fades out over this part of its life, in place of a fixed fade_out.
sway / sway_rate0 / 0.3A push to the side each tick that changes direction over time. Use it for wisps and falling leaves.
pulse / pulse_rate0 / 1The size grows and shrinks by this fraction. Use it for twinkles.
tumble0The particle turns back and forth by this many radians, and does not spin.
flare1Size multiplier for the last fifth of the life, for a flame that gets bigger just before it goes out.

pheno:spawn_particles can put its particles in a shape. Each particle moves along the shape at speed:

{
"type": "pheno:spawn_particles",
"particle": "examplepack:frost_mote",
"shape": "ring_in",
"count": 24,
"radius": 2,
"speed": 0.12,
"anchor": "feet",
"delay": 4
}
ShapeLayout
ringA flat circle of radius. The particles move outward.
ring_inThe same circle. The particles move inward.
orbitThe same circle. The particles move around it.
spokesLines from the centre out to radius.
domeA half-sphere of radius. The particles move outward.
helixA spiral of two turns, with radius, that rises height.
burst_upA fountain from a disc of radius. The particles move up.
coneAlong the look direction for length, wider to radius. The particles move forward.
lineAlong the look direction for length. The particles move forward.

anchor puts the shape at the feet, the center (default), or the eyes of the actor. delay starts the burst that many ticks later. With some bursts in a pheno:and, you can make one effect in steps, for example a warning, an impact, and an end.

pheno:screen_effect plays a cue for the focus when the focus is a player.

{ "type": "pheno:screen_effect", "effect": "shake", "intensity": 0.6, "duration": 12, "radius": 8 }
FieldDefaultNotes
effectrequiredflash, vignette, tint, shake, or fov.
color#FFFFFFFor flash, vignette, and tint.
intensity0.5From 0 to 1. For fov, how much wider the view gets, from -0.3 to 0.3. A negative value makes the view narrower.
duration20Ticks, up to 200. Flashes and shakes fade out. The other cues get stronger and then weaker.
radius0Also plays the cue for every other player within this distance.

The Screen Effects setting of each player changes the strength of every cue. Townstead’s reduced-motion setting turns off shakes and FOV changes.

An icon on a gene, skill, or wheel action can be an item ID, or a texture path that ends in .png. Data-pack textures also work here, so the ability catalogue and the ability wheel can show the art of a pack:

{ "type": "pheno:active_ability", "icon": "examplepack:textures/icon/frost_breath.png" }