-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2adf390
Showing
16 changed files
with
72,592 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<h1>ENTITY EVENTS DOCUMENTATION </br>Version: 1.21.20.3</h1> | ||
<h2><p id="Index">Index</p></h2> | ||
<table border="1"> | ||
<tr> <th><a href="#This describes the structure of the Events section.">This describes the structure of the Events section.</a></th> </tr> | ||
<tr> <th><a href="#Overview">Overview</a></th> </tr> | ||
<tr> <th><a href="#Versioned Changes">Versioned Changes</a></th> </tr> | ||
<tr> <th><a href="#Randomize Node">Randomize Node</a></th> </tr> | ||
<tr> <th><a href="#Sequence Node">Sequence Node</a></th> </tr> | ||
<tr> <th><a href="#Trigger">Trigger</a></th> </tr> | ||
<tr> <th><a href="#Add Component Group">Add Component Group</a></th> </tr> | ||
<tr> <th><a href="#Remove Component Group">Remove Component Group</a></th> </tr> | ||
<tr> <th><a href="#Set Entity Property">Set Entity Property</a></th> </tr> | ||
<tr> <th><a href="#Queue Command">Queue Command</a></th> </tr> | ||
</table> | ||
<a href="#Index">Back to top</a> | ||
<h1><p id="This describes the structure of the Events section.">This describes the structure of the Events section.</p></h1> | ||
|
||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Overview">Overview</p></h1> | ||
|
||
</br> Entity events can be structured by a combination of 'sequence' and 'randomize' nodes.</br> 'sequence' nodes are array nodes and will execute all entries in order from first element to last.</br> 'randomize' nodes are array nodes that will pick one entry to execute, based on a weight.</br> 'filters' can also be added within 'sequence' and 'randomize' nodes to restrict execution.</br></br> Within 'randomize' and 'sequence' nodes, you can specify a few operations.</br> 'trigger', 'filters', 'add', and 'remove'.</br> You can read about 'filters' in the 'Filters' section of the documentation.</br> 'trigger' can be used to fire additional entity events when an event is hit.</br> 'add' can be used to add component groups to your entity.</br> 'remove' can be used to remove component groups from your entity.</br></br> When an event is received, the effects of that event are determined immediately, but those changes</br> are not applied to the entity until the entity ticks on the server side of the game. This means</br> filters in later entries in a 'sequence' array won't see changes from earlier in that array.</br> It also means that when one entity sends an event to another entity, it could take effect on the same</br> game tick or on the next tick, depending on whether the target entity has already been updated.</br> </br><a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Versioned Changes">Versioned Changes</p></h1> | ||
|
||
</br> A 'format_version' of '1.19.20' or higher is required to properly evaluate filters specified on an entity event definition</br> at the root level of the event, that is any filter that is not underneath a 'sequence' or 'randomize' node.</br> Content with a lower version will use the old behavior, which was to ignore root level filters.</br> </br><a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Randomize Node">Randomize Node</p></h1> | ||
|
||
</br> The 'randomize' node is an array node that will pick one entry to execute, based on a weight.</br> If no weight is specified, a node will have a weight of 1.0.</br> If you add a weight of 4.0 in one node, and 8.0 in another, then those nodes will have a 33.33% (4 / (4 + 8)) and 66.66% (8 / (4 + 8)) chance of executing, respectively.</br> </br><h2></h2> | ||
Example:<br / ><textarea readonly="true" cols="42" rows="9"> | ||
|
||
"randomize": [ | ||
{ | ||
"weight": <float> | ||
// actions like 'add' or 'remove' | ||
} | ||
] | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Sequence Node">Sequence Node</p></h1> | ||
|
||
<h2></h2> | ||
Example:<br / ><textarea readonly="true" cols="36" rows="11"> | ||
|
||
"sequence": [ | ||
{ | ||
// I will execute first! c: | ||
}, | ||
{ | ||
// I will execute last! :c | ||
} | ||
] | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Trigger">Trigger</p></h1> | ||
|
||
Triggers additional entity events when hit. For example, you could use a randomize node in minecraft:entity_spawned to choose either an adult or baby event for adding component groups.</br><h2></h2> | ||
Example:<br / ><textarea readonly="true" cols="42" rows="21"> | ||
|
||
"sample:spawn_adult": { | ||
// add adult component groups | ||
}, | ||
"sample:spawn_baby": { | ||
// add baby component groups | ||
}, | ||
"minecraft:entity_spawned": { | ||
"randomize": [ | ||
{ | ||
"weight": 50.0, | ||
"trigger": "sample:spawn_adult" | ||
}, | ||
{ | ||
"weight": 50.0, | ||
"trigger": "sample:spawn_baby" | ||
} | ||
] | ||
} | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Add Component Group">Add Component Group</p></h1> | ||
|
||
Adds component groups to the current entity. These groups must be defined in the 'component_groups' section of the file. As entities can only have one component of each type active, any components in a group that is being added will replace previously added components. Additionally, adding a component group that is already active will cause those components to be re-initialized. For some types of components like minecraft:is_baby, re-initializing an already active component has no effect, but for other component types the associated logic will start over. For example, an already-added minecraft:timer that is added again will start its timing logic over.</br><h2></h2> | ||
Example:<br / ><textarea readonly="true" cols="66" rows="11"> | ||
|
||
"sequence": [ | ||
{ | ||
"add": { "component_groups": [ "one" ] } | ||
}, | ||
{ | ||
"add": { "component_groups": [ "two", "five", "etc.." ] } | ||
} | ||
] | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Remove Component Group">Remove Component Group</p></h1> | ||
|
||
Removes component groups from the current entity. This can be any group you have defined in the 'component_groups' section of the file.</br><h2></h2> | ||
Example:<br / ><textarea readonly="true" cols="69" rows="11"> | ||
|
||
"sequence": [ | ||
{ | ||
"remove": { "component_groups": [ "one" ] } | ||
}, | ||
{ | ||
"remove": { "component_groups": [ "two", "five", "etc.." ] } | ||
} | ||
] | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Set Entity Property">Set Entity Property</p></h1> | ||
|
||
Sets the value of an entity property. The property must be defined in the 'properties' section of the file. </br><h2></h2> | ||
Example:<br / ><textarea readonly="true" cols="36" rows="6"> | ||
|
||
"set_property": { | ||
"minecraft:has_nectar": false | ||
} | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Queue Command">Queue Command</p></h1> | ||
|
||
Queues a command to be run on the entity. The command will run within the next tick unless the entity has been removed.</br><h2></h2> | ||
Example:<br / ><textarea readonly="true" cols="36" rows="6"> | ||
|
||
"queue_command": { | ||
"command": "say I have died!" | ||
} | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<h1>ENTITY TIMELINE EVENTS DOCUMENTATION </br>Version: 1.21.20.3</h1> | ||
<h2><p id="Index">Index</p></h2> | ||
<table border="1"> | ||
<tr> <th><a href="#Animation Controller Events">Animation Controller Events</a></th> </tr> | ||
<tr> <th><a href="#Animation Events">Animation Events</a></th> </tr> | ||
<tr> <th><a href="#Animation Notes">Animation Notes</a></th> </tr> | ||
<tr> <th><a href="#Events">Events</a></th> </tr> | ||
<tr> <th><a href="#General Notes">General Notes</a></th> </tr> | ||
</table> | ||
<a href="#Index">Back to top</a> | ||
<h1><p id="Animation Controller Events">Animation Controller Events</p></h1> | ||
|
||
</br>Animation controllers can trigger events on entry or exit of a state. Events to trigger on state entry go in the "on_entry" section, those on exit go in the "on_exit" section.</br><h2></h2> | ||
<br / ><textarea readonly="true" cols="105" rows="23"> | ||
|
||
{ | ||
"format_version": "1.8.0", | ||
"animation_controllers": { | ||
"controller.animation.test": { | ||
"states": { | ||
"default": { | ||
"on_entry": [ | ||
"event1", // note that these events can be any event, slash command, Molang, or entity event | ||
"event2", | ||
"event3" | ||
], | ||
"on_exit": [ | ||
"event1", | ||
"event2" | ||
] | ||
}, | ||
} | ||
} | ||
} | ||
} | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Animation Events">Animation Events</p></h1> | ||
|
||
</br>Animations can have a timeline dedicated to events. The "timeline" section contains the event timeline list. Below there are various examples where particular times can trigger a single event, or an array of events:</br><h2></h2> | ||
<br / ><textarea readonly="true" cols="68" rows="32"> | ||
|
||
{ | ||
"format_version": "1.8.0", | ||
"animations": { | ||
"animation.test_events": { | ||
"timeline": { | ||
"2.0": "@s minecraft:entity_born", | ||
"4.0": [ "@s minecraft:ageable_grow_up" ] | ||
}, | ||
"animation_length": 5.0 | ||
}, | ||
"animation.test_molang": { | ||
"timeline": { | ||
"0.0": "variable.pop_smoke = 1; variable.pop_bubbles = 0;", | ||
"3.0": [ | ||
"variable.pop_smoke = 0;", | ||
"variable.pop_bubbles = 1;" | ||
] | ||
} | ||
}, | ||
"animation.test_commands": { | ||
"timeline": { | ||
"1.0": "/tell @a timeline command1", | ||
"2.0": [ | ||
"/tell @a timeline command 2.1", | ||
"/tell @a timeline command 2.2" | ||
], | ||
"3.0": [ "/tell @a command 3" ] | ||
} | ||
} | ||
} | ||
} | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Animation Notes">Animation Notes</p></h1> | ||
|
||
</br>Entity events occur in animations, which normally occur on the client (via resource packs), but can also occur on the server (via behavior packs). As the server side of the game has no visual aspects to it, obviously no bone-based animations can occur. However, a traditional animation is basically a timeline of events, with the events being bone positions for an animated visual rig that moves the entity's visual shape around. The mechanisms for the Bedrock animation system are state machines (Animation Controllers), and timelines (Animations). These concepts apply directly to the triggering of events, thus the animation system can execute on the server (minus the visual aspects), with the intent of driving entity events. </br></br>To use entity events on the server (in a behavior pack), add animation controllers and animations to a behavior pack just as you would to a resource pack. Add animation and animation controllers to an "animations" section in the description field of an entity. These animations and animation controllers will run on the server just as if they were on the client in a resource pack. Add the "scripts" section with an "animate" subsection to specify which animations/animation-controllers to have run.</br></br>Client side (resource pack) events do not require special setup as the client side entities usually already have animations and animation controllers in place. Just add your events where you need them in animations or animation controllers.</br><h2></h2> | ||
<br / ><textarea readonly="true" cols="106" rows="30"> | ||
|
||
{ | ||
// Example of the schema for a server-side entity, modified to run animations and animation controllers | ||
"format_version": "1.8.0", | ||
"minecraft:entity": { | ||
"description": { | ||
"identifier": "minecraft:cat", | ||
... | ||
"animations": { | ||
"anim1": "animation.anim1", | ||
"anim2": "animation.anim2", | ||
"anim_controller1": "controller.animation.test1", | ||
"anim_controller2": "controller.animation.test2" | ||
}, | ||
"scripts": { | ||
// note that only these animations and animation controllers will automatically run: | ||
"animate": [ | ||
"anim1", | ||
"anim_controller1", | ||
... | ||
] | ||
} | ||
... | ||
}, | ||
... | ||
}, | ||
... | ||
} | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="Events">Events</p></h1> | ||
|
||
</br>Events consist of three categories, all represented by a string:</br>- Entity events</br>- Slash Commands</br>- Molang Expressions</br></br>In detail:</br></br>Entity Events: Server side (behavior packs) only. Currently, we only support entity events to self, and these take the form "@s event". These are events declared in the events section of the entity definition file. For example, in the cat.json, "minecraft:ageable_grow_up" event causes the kitten to grow up. This would take the form of "@s minecraft:ageable_grow_up"</br></br>Slash commands: Server side (behavior packs) only. Any slash command can be invoked, such as "/particle minecraft:example_smoke_puff ~ ~ ~". The assumed entity for the slash command is the invoking entity, so this particular slash command will spawn a smoke puff effect at the entity's location.</br></br>Molang Expressions: This executes a Molang expression. The primary usage is to set Molang variables that can be used later. For example, a state transition might be looking at a particluar Molang variable, and this expression could change that variable. A particle effect on the entity might change color due to Molang variables that the effect uses for color tints. An animation to move an arm might use a Molang variable that was set by an animation event.</br><h2></h2> | ||
<br / ><textarea readonly="true" cols="95" rows="12"> | ||
|
||
// entity event (behavior packs only), put the particular event name after the @s | ||
"@s minecraft:entity_event" | ||
|
||
// slash command (behavior packs only), can be any server-side slash command | ||
// is invoked from the entity, so a teleport, for example, will teleport the entity by default | ||
"/tell @a this is a message" | ||
|
||
// Molang Expressions, executes a Molang expression on the entity | ||
"variable.something_to_set = 3;" | ||
|
||
</textarea> </br> | ||
<a href="#Index">Back to top</a><br><br> | ||
|
||
<h1><p id="General Notes">General Notes</p></h1> | ||
|
||
</br>This document contains details for driving various events via entity .json data. Entity events can go in both behavior and resource packs. Behavior packs use the same animations and animation controllers setup that are used in resource packs, albeit with a different method in the entity .json itself to activate the animations.</br></br>Entity events are a way to drive gameplay and entity state changes in the Bedrock engine. These events can typically include slash commands (behavior packs only), entity events (e.g. become an adult), and Molang expressions (e.g. set the Molang variable "variable.foo" to 3 on a particular entity). Animations and Animation controllers provide a method for driving state machines and timelines for an entity. For example, a particular animation controller could be in a particular state, and running a particular animation, and we want events triggered when entering/exiting that state. Alternately, an "animation" could be running, and we wish to fire off events during that animation. The entity event timeline mechanic makes this possible.</br><a href="#Index">Back to top</a><br><br> | ||
|
Oops, something went wrong.