Effects in Animations

Effects in Animations

Sometimes it is much easier to use particles or sounds in animation rather than in animation controller. Animations can have effects in them, such as:

  • Particles
  • Sounds

Particles

Minecraft Particles can be used in entity animations. For example, the phantom has an animation which emits the minecraft:phantom_trail particle constantly. Let's try to add a particle to our entity's attack animation.

RP/entity/my_entity.jsonCopy
json
"particle_effects": {
	"flames": "minecraft:mobflame_emitter"
}
1
2
3

Here we defined a shortname for particle that we are going to use.

You can find a list of particles here or here.

Warning!

Not every particle works there. If you have problems, consider trying another particle. For example, use this one. Also note that some particles emit constantly.

Sounds

If you want to use a sound, you need to define it too.

RP/entity/my_entity.jsonCopy
json
"sound_effects": {
	"meow": "mob.cat.meow"
}
1
2
3

Warning!

Not every sound works there. If you have problems, consider trying another sound. For example, use this one.

Adding Effects to Animation

You can add particles or sounds to your animation mainly or in Blockbench.

Mainly

You need to add the following to your animation:

RP/animations/my_animation.json#my.animationCopy
json
"particle_effects": {
    "0.0": {
        "effect": "flames",
        "locator": "" //You need to add a locator in your model
    }
}
1
2
3
4
5
6
RP/animations/my_animation.json#my.animationCopy
json
"sound_effects": {
    "0.0": {
        "effect": "meow"
	}
}
1
2
3
4
5

You can call more than one particle at the same time:

json
"particle_effects": {
    "0.0": [
        {
            "effect": "particle_1",
            "locator": "locator_1"
    	},
	{
            "effect": "particle_2",
            "locator": "locator_2"
    	}
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
Example
RP/animations/my_animation.jsonCopy
json
{
	"format_version" : "1.8.0",
	"animations" : {
		"animation.sheep.grazing" : {
			"animation_length" : 2.0,
			"loop" : true,
			"particle_effects": {
                "0.0": {
                    "effect": "flames",
                    "locator": "body"
                }
            },
			"sound_effects": {
    			"0.0": {
    			    "effect": "meow"
				}
			},
			"bones" : {
				"head" : {
					"position" : {
						"0" : [ 0.0, 0.0, 0.0 ],
						"0.2" : [ 0.0, -9.0, 0.0 ],
						"1.8" : [ 0.0, -9.0, 0.0 ],
						"2" : [ 0.0, 0.0, 0.0 ]
					},
					"rotation" : {
						"0.2" : {
							"post" : [ "180.0 * (0.2 + 0.07 * math.sin(q.key_frame_lerp_time * 1644.39))", 0.0, 0.0 ],
							"pre" : [ 36.0, 0.0, 0.0 ]
						},
						"1.8" : {
							"post" : [ 36.0, 0.0, 0.0 ],
							"pre" : [ "180.0 * (0.2 + 0.07 * math.sin(q.key_frame_lerp_time * 1644.39))", 0.0, 0.0 ]
						}
					}
				}
			}
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

In Blockbench

First let's add a locator for our particle. Go to "Edit" section, select a group, right-click and choose "Add Locator":

Rename it and move where you want.

Then go to "Animate" section, choose an animation and click on a magic stick icon:

Now click "+" to open menu and specify the data:

You can attach a sound to animation the same way.

Now save your animation and launch the game!

Offscreen Updating

You can set "should_update_bones_and_effects_offscreen" to true inside entity rp scripts for particle and sound effects to update offscreen, by default both of them will stop playing if the entity isn't being rendered on display.

RP/entity/my_entity.json#descriptionCopy
json
"scripts": {
	"should_update_bones_and_effects_offscreen": true
}
1
2
3

Contributors