-
Notifications
You must be signed in to change notification settings - Fork 1
Particles
Using the particle API you can spawn particles from Minecraft. These work similarly to the /particle command in-game. For particles with special properties like dust, they are placed in the name.
Most of the article assumes you know to avoid calling the player in init.
particles:newParticle(particleID,position,velocity)If you're looking on the Minecraft wiki then the particle id is the name under the 'Java Edition ID Name' column. Or, it's the same id used by the /particle command. If you're using Minecraft particles you can exclude the Minecraft "mod name".
particles:newParticle("minecraft:explosion",player:getPos())I've added the player position, but excluded the velocity.
Dust example, it's color is included in its name:
particles:newParticle("dust 0 1 1 1",player:getPos())This will spawn an aqua dust particle as the color values need a number between 0 and 1, the fourth number is the alpha. I excluded the 'minecraft:' mod name to demonstrate that it's unnecessary.
To spawn a particle at a modelPart's position you'll need to get the position matrix of that part, and insert it into the position like normal.
particles:newParticle("explosion",modelPart:partToWorldMatrix():apply())Where modelPart is a reference to a real modelPart in your avatar.
You can store a reference to a specific particle, and then use it later to change its properties wile it still exists in the world.
local boom = particles["explosion"]
function events.entity_init()
boom:spawn():setPos(player:getPos())
endIt's in an entity_init event to protect from an entity init error
Spawns the particle with its current properties (set with the other functions)
Gets if the particle is still in the world
Sets the position of the particle
Gets the position of the particle
Sets the particle color, most particles don't support it. The alpha value can be excluded
Gets the color as set by setcolor
Sets the scale of the particle
Gets the scale of the particle
Sets the velocity of the particle
Gets the velocity of the particle
Sets how long the particle should stay in the world. Particles with animations will animate in relation to their life left, so longer lives will make the animation play slower.
Gets the lifetime
Sets the strength of gravity
Gets the gravity value
I honestly don't know what this does at time of writing
Gets the power
Sets if the particle will experience physics
Gets if the particle has physics
Sets the scale of the particle, identical to setScale
Gets the size of the particle
Spawns custom particles that you make in Blockbench. Find here in the Discord.
Please use the official wiki at https://wiki.figuramc.org/
THIS WIKI IS DEPRECATED. Please use the official wiki at https://wiki.figuramc.org/
Start Here
Tutorials
- Action Wheel
- Metadata
- Custom Items
- Glowing Textures
- Reading Documentation
- Key Detection
- ModelPart Indexing
- Spawning Particles
- Pings
- Playing Sounds
- Tables
Globals
Enums