Modding:Entity Behaviors: Difference between revisions
(→All Behaviors: fix the sides of the behaviors) |
(→All Behaviors: add placeholders for the remaining behaviors) |
||
Line 81: | Line 81: | ||
! style="width: 15em" |Properties | ! style="width: 15em" |Properties | ||
! Side | ! Side | ||
|- | |||
| [[Modding:Entity_Behavior_activitydriven|activitydriven]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_aimingaccuracy|aimingaccuracy]] | | [[Modding:Entity_Behavior_aimingaccuracy|aimingaccuracy]] | ||
Line 89: | Line 95: | ||
| | | | ||
| Universal | | Universal | ||
|- | |||
| [[Modding:Entity_Behavior_antlergrowth|antlergrowth]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_armorstandinventory|armorstandinventory]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_bodytemperature|bodytemperature]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_boss|boss]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_breathe|breathe]] | | [[Modding:Entity_Behavior_breathe|breathe]] | ||
Line 106: | Line 136: | ||
| | | | ||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_commandable|commandable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_controlledphysics|controlledphysics]] | | [[Modding:Entity_Behavior_controlledphysics|controlledphysics]] | ||
Line 114: | Line 150: | ||
stepHeight = 0.6 | stepHeight = 0.6 | ||
| Universal | | Universal | ||
|- | |||
| [[Modding:Entity_Behavior_conversable|conversable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_deaddecay|deaddecay]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_despawn|despawn]] | | [[Modding:Entity_Behavior_despawn|despawn]] | ||
Line 125: | Line 173: | ||
minSeconds = 30<br/> | minSeconds = 30<br/> | ||
| Universal | | Universal | ||
|- | |||
| [[Modding:Entity_Behavior_drunktyping|drunktyping]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_emotionstates|emotionstates]] | | [[Modding:Entity_Behavior_emotionstates|emotionstates]] | ||
Line 134: | Line 188: | ||
states<br/> | states<br/> | ||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_extraskinnable|extraskinnable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_floatupwhenstuck|floatupwhenstuck]] | | [[Modding:Entity_Behavior_floatupwhenstuck|floatupwhenstuck]] | ||
Line 154: | Line 214: | ||
adultEntityCodes = []<br/> | adultEntityCodes = []<br/> | ||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_harvestable|harvestable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_health|health]] | | [[Modding:Entity_Behavior_health|health]] | ||
Line 166: | Line 232: | ||
basemaxhealth = 20<br/> | basemaxhealth = 20<br/> | ||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_hidewatersurface|hidewatersurface]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_hunger|hunger]] | | [[Modding:Entity_Behavior_hunger|hunger]] | ||
Line 181: | Line 253: | ||
currentdairyLevel = 0 | currentdairyLevel = 0 | ||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_idleanimations|idleanimations]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_interpolateposition|interpolateposition]] | | [[Modding:Entity_Behavior_interpolateposition|interpolateposition]] | ||
Line 188: | Line 266: | ||
| | | | ||
| Client | | Client | ||
|- | |||
| [[Modding:Entity_Behavior_milkable|milkable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_mortallywoundable|mortallywoundable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_mouthinventory|mouthinventory]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_multiply|multiply]] | | [[Modding:Entity_Behavior_multiply|multiply]] | ||
Line 206: | Line 302: | ||
requiresFood = true | requiresFood = true | ||
| Universal | | Universal | ||
|- | |||
| [[Modding:Entity_Behavior_multiplybase|multiplybase]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_nametag|nametag]] | | [[Modding:Entity_Behavior_nametag|nametag]] | ||
Line 219: | Line 321: | ||
showtagonlywhentargeted = false<br/> | showtagonlywhentargeted = false<br/> | ||
| Universal | | Universal | ||
|- | |||
| [[Modding:Entity_Behavior_openablecontainer|openablecontainer]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_passivephysics|passivephysics]] | | [[Modding:Entity_Behavior_passivephysics|passivephysics]] | ||
Line 232: | Line 340: | ||
gravityFactor = 1<br/> | gravityFactor = 1<br/> | ||
| Universal | | Universal | ||
|- | |||
| [[Modding:Entity_Behavior_passivephysicsmultibox|passivephysicsmultibox]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_pettable|pettable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_placeblock|placeblock]] | | [[Modding:Entity_Behavior_placeblock|placeblock]] | ||
Line 242: | Line 362: | ||
blockCodes = []<br/> | blockCodes = []<br/> | ||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_playerinventory|playerinventory]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_playerphysics|playerphysics]] | | [[Modding:Entity_Behavior_playerphysics|playerphysics]] | ||
Line 258: | Line 384: | ||
* movable = true | * movable = true | ||
| Universal | | Universal | ||
|- | |||
| [[Modding:Entity_Behavior_reviveondeath|reviveondeath]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_rideable|rideable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_rideableaccessories|rideableaccessories]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_ropetieable|ropetieable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_seatable|seatable]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_selectionboxes|selectionboxes]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| [[Modding:Entity_Behavior_seraphinventory|seraphinventory]] | |||
| | |||
| | |||
| | |||
| | |||
|- | |- | ||
| [[Modding:Entity_Behavior_taskai|taskai]] | | [[Modding:Entity_Behavior_taskai|taskai]] | ||
Line 274: | Line 442: | ||
currenttiredness = 0</br> | currenttiredness = 0</br> | ||
| Universal | | Universal | ||
|- | |||
| [[Modding:Entity_Behavior_villagerinventory|villagerinventory]] | |||
| | |||
| | |||
| | |||
| | |||
|} | |} |
Revision as of 05:32, 6 October 2024
Using Entity Behaviors
Inside the entity json file, entity behaviors can be added to the client section, server section, or both. For example, here is the controlledphysics behavior from deer.json
, added to both the client and server sections. This shows the pre-1.20 style of including the behavior on both sides. Note that the properties are added directly to the behavior object, instead of in a properties object like with blocks and items. Also note that the builtin entity behavior names are all lower case, unlike block and collectible behaviors.
client: {
...
behaviors: [
...
{
code: "controlledphysics",
"stepHeightByType": {
"deer-pampas-*": 2.1251,
"deer-pudu-*": 2.1251,
"deer-redbrocket-*": 2.1251,
"*": 3.1251
}
},
...
],
...
},
server: {
...
behaviors: [
...
{
code: "controlledphysics",
"stepHeightByType": {
"deer-pampas-*": 2.1251,
"deer-pudu-*": 2.1251,
"deer-redbrocket-*": 2.1251,
"*": 3.1251
}
},
...
],
...
},
In 1.20, the behaviorConfigs section was added. For behaviors that added to both sections, the properties may be specified in the behaviorConfigs section to avoid duplicating the properties in both the client and server section. Here is the above example using behaviorConfigs.
behaviorConfigs: {
"controlledphysics": {
"stepHeightByType": {
"deer-pampas-*": 2.1251,
"deer-pudu-*": 2.1251,
"deer-redbrocket-*": 2.1251,
"*": 3.1251
}
},
...
},
client: {
...
behaviors: [
...
{ code: "controlledphysics" },
...
],
...
},
server: {
...
behaviors: [
...
{ code: "controlledphysics" },
...
],
...
},
All Behaviors
Here is a table containing all the entity behaviors of the base game. Of course mods can, and are encouraged to add new behaviors.
Behavior Name | Explanation | Example entities | Properties | Side |
---|---|---|---|---|
activitydriven | ||||
aimingaccuracy | Adds aiming inaccuracy when sprinting, jumping, etc. |
|
Universal | |
antlergrowth | ||||
armorstandinventory | ||||
bodytemperature | ||||
boss | ||||
breathe | The entity will need to breathe and therefore suffocate in other blocks (for example sand). |
|
Universal | |
collectitems | The entity collections items laying around on the ground. |
|
Server | |
commandable | ||||
controlledphysics | Add physics to the entity. |
|
stepHeight = 0.6 |
Universal |
conversable | ||||
deaddecay | ||||
despawn | The entity will despawn under given circumstances. |
|
minPlayerDistance |
Universal |
drunktyping | ||||
emotionstates | Adds emotion states with a given chance. As an example, it can be used to make an animal "hungry" (aggressive) and "saturated" (passive). |
|
states |
Server |
extraskinnable | ||||
floatupwhenstuck | Float up the entity if it gets stuck in a block. |
|
onlyWhenDead = false |
Universal |
grow | The entity will grow and eventually turn into one of its adults. |
|
hoursToGrow = 96 |
Server |
harvestable | ||||
health | Applies custom health to the entity. Means the entity can be hurt as well. |
|
currenthealth = 20 |
Server |
hidewatersurface | ||||
hunger | Adds saturation and hunger, the entity needs to eat in order to stay alive. |
|
currentsaturation = 1200 maxsaturation = 1200 saturationlossdelay = 60 * 24 currentfruitLevel = 0 currentvegetableLevel = 0 currentgrainLevel = 0 currentproteinLevel = 0 currentdairyLevel = 0 |
Server |
idleanimations | ||||
interpolateposition | Interpolates entity position and rotate. Smooths out the animations. It's a visual effect, therefore not available on server side. |
|
Client | |
milkable | ||||
mortallywoundable | ||||
mouthinventory | ||||
multiply | A pack of wolves for example grows in size over time (new babies are born). When installed on the client side, it shows portions eaten info text. |
|
pregnancyDays = 3.0 |
Universal |
multiplybase | ||||
nametag | Adds a name tag to the entity which will be displayed above the entity. |
|
renderRange = 99 |
Universal |
openablecontainer | ||||
passivephysics | Adds physics to the entity. |
|
waterDragFactor = 1 |
Universal |
passivephysicsmultibox | ||||
pettable | ||||
placeblock | The entity will place one of the given block codes from time to time. |
|
minHourDelay = 8 * 24 |
Server |
playerinventory | ||||
playerphysics | Makes an entity controllable by a player. Because this inherits from controlledphysics, do not add both to an entity. |
|
stepHeight = 0.6 |
Universal |
repulseagents | Pushes other entities back. |
|
|
Universal |
reviveondeath | ||||
rideable | ||||
rideableaccessories | ||||
ropetieable | ||||
seatable | ||||
selectionboxes | ||||
seraphinventory | ||||
taskai | Allows you to specify tasks. |
|
aitasks |
Server |
tiredness | The entity will get tired over time. When it is sufficiently tired, it may sleep in a bed. |
|
currenttiredness = 0 |
Universal |
villagerinventory |