Modding:Entity Behaviors: Difference between revisions
(→All Behaviors: taskai) |
(→All Behaviors: typo) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 81: | Line 81: | ||
! style="width: 15em" |Properties | ! style="width: 15em" |Properties | ||
! Side | ! Side | ||
|- | |||
| [[Modding:Entity_Behavior_activitydriven|activitydriven]] | |||
| | |||
| | |||
* villager | |||
| | |||
| Server | |||
|- | |||
| [[Modding:Entity_Behavior_aimingaccuracy|aimingaccuracy]] | |||
| Adds aiming inaccuracy when sprinting, jumping, etc. | |||
| | |||
* player | |||
* playerbot | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_antlergrowth|antlergrowth]] | |||
| | |||
| | |||
* deer | |||
* animals with horns | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_armorstandinventory|armorstandinventory]] | |||
| | |||
| | |||
* armorstand | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_bodytemperature|bodytemperature]] | |||
| | |||
| | |||
* player | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_boss|boss]] | |||
| | |||
| | |||
* eidolon-immobolized | |||
| | |||
| Client | |||
|- | |- | ||
| [[Modding:Entity_Behavior_breathe|breathe]] | | [[Modding:Entity_Behavior_breathe|breathe]] | ||
| The entity will need to breathe and therefore suffocate in other blocks (for example sand). | | The entity will need to breathe and therefore suffocate in other blocks (for example sand). | ||
| | | | ||
* player | * player - both sides | ||
* most animals | * most animals - server only | ||
| | | | ||
| | | Universal | ||
|- | |- | ||
| [[Modding:Entity_Behavior_collectitems|collectitems]] | | [[Modding:Entity_Behavior_collectitems|collectitems]] | ||
Line 98: | Line 142: | ||
| | | | ||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_commandable|commandable]] | |||
| | |||
| | |||
* erel | |||
* locust-hacked | |||
* mechhelper | |||
| | |||
| Universal | |||
|- | |- | ||
| [[Modding:Entity_Behavior_controlledphysics|controlledphysics]] | | [[Modding:Entity_Behavior_controlledphysics|controlledphysics]] | ||
Line 104: | Line 157: | ||
* most entities | * most entities | ||
| | | | ||
stepHeight = 0.6 | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_conversable|conversable]] | |||
| | |||
| | |||
* libraryresonator | |||
* trader | |||
* villager | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_deaddecay|deaddecay]] | |||
| | |||
| | |||
* animals | |||
| | |||
| Server | |||
|- | |||
| [[Modding:Entity_Behavior_despawn|despawn]] | |||
| The entity will despawn under given circumstances. | |||
| | |||
* projectiles - server only | |||
* animals - both sides | |||
| | |||
minPlayerDistance<br/> | |||
belowLightLevel<br/> | |||
minSeconds = 30<br/> | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_drunktyping|drunktyping]] | |||
| | |||
| | |||
* player | |||
| | |||
| Client | |||
|- | |||
| [[Modding:Entity_Behavior_emotionstates|emotionstates]] | |||
| Adds emotion states with a given chance. As an example, it can be used to make an animal "hungry" (aggressive) and "saturated" (passive). | |||
| | |||
* most animals | |||
* most humanoids | |||
| | |||
states<br/> | |||
| Server | |||
|- | |||
| [[Modding:Entity_Behavior_extraskinnable|extraskinnable]] | |||
| | |||
| | |||
* player | |||
* playerbot | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_floatupwhenstuck|floatupwhenstuck]] | |||
| Float up the entity if it gets stuck in a block. | |||
| | |||
* item | |||
* most animals | |||
| | |||
onlyWhenDead = false<br/> | |||
pushVelocityMul = 1<br/> | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_grow|grow]] | |||
| The entity will grow and eventually turn into one of its adults. | |||
| | |||
* pig-wild-piglet | |||
* most baby animals | |||
| | |||
hoursToGrow = 96<br/> | |||
adultEntityCodes = []<br/> | |||
| Server | |||
|- | |||
| [[Modding:Entity_Behavior_harvestable|harvestable]] | |||
| | |||
| | |||
* wolf | |||
* harvestable animals | |||
| | |||
| Universal | | Universal | ||
|- | |- | ||
Line 111: | Line 243: | ||
| | | | ||
* bear | * bear | ||
* player | |||
* most entities | * most entities | ||
| | | | ||
currenthealth = 20<br/> | |||
maxhealth = 20<br/> | |||
basemaxhealth = 20<br/> | |||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_hidewatersurface|hidewatersurface]] | |||
| | |||
| | |||
* boat | |||
| | |||
| Client | |||
|- | |- | ||
| [[Modding:Entity_Behavior_hunger|hunger]] | | [[Modding:Entity_Behavior_hunger|hunger]] | ||
Line 123: | Line 263: | ||
* player | * player | ||
| | | | ||
currentsaturation = 1200 | |||
maxsaturation = 1200 | |||
saturationlossdelay = 60 * 24 | |||
currentfruitLevel = 0 | |||
currentvegetableLevel = 0 | |||
currentgrainLevel = 0 | |||
currentproteinLevel = 0 | |||
currentdairyLevel = 0 | |||
| Server | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_idleanimations|idleanimations]] | |||
| | |||
| | |||
* player | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_interpolateposition|interpolateposition]] | |||
| Interpolates entity position and rotate. Smooths out the animations. It's a visual effect, therefore not available on server side. | |||
| | |||
* most entities | |||
| | |||
| Client | |||
|- | |||
| [[Modding:Entity_Behavior_milkable|milkable]] | |||
| | |||
| | |||
* goal | |||
* sheep-bighorn-female | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_mortallywoundable|mortallywoundable]] | |||
| | |||
| | |||
* elk-tamed | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_mouthinventory|mouthinventory]] | |||
| | |||
| | |||
* racoon | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_multiply|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. | |||
| | |||
* hostile animals - server only | |||
* farm animals - both sides | |||
| | |||
pregnancyDays = 3.0<br/> | |||
spawnEntityCode<br/> | |||
requiresNearbyEntityCode<br/> | |||
requiresNearbyEntityRange = 5<br/> | |||
multiplyCooldownDaysMin = 6<br/> | |||
multiplyCooldownDaysMax = 12<br/> | |||
portionsEatenForMultiply = 3<br/> | |||
spawnQuantityMin = 1<br/> | |||
spawnQuantityMax = 2<br/> | |||
requiresFood = true | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_multiplybase|multiplybase]] | |||
| | |||
| | |||
* chicken-hen | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_nametag|nametag]] | |||
| Adds a name tag to the entity which will be displayed above the entity. | |||
| | |||
* player | |||
* playerbot | |||
* trader | |||
* villager | |||
| | |||
renderRange = 99<br/> | |||
selectFromRandomName<br/> | |||
showtagonlywhentargeted = false<br/> | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_openablecontainer|openablecontainer]] | |||
| | |||
| | |||
* erel | |||
* mechhelper | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_passivephysics|passivephysics]] | |||
| Adds physics to the entity. | |||
| | |||
* item | |||
* thrownstone | |||
* most projectiles | |||
| | |||
waterDragFactor = 1<br/> | |||
airDragFallingFactor = 1<br/> | |||
groundDragFactor = 1<br/> | |||
gravityFactor = 1<br/> | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_passivephysicsmultibox|passivephysicsmultibox]] | |||
| | |||
| | |||
* boat | |||
* boat-construction | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_pettable|pettable]] | |||
| | |||
| | |||
* chicken | |||
* farm animals | |||
* fox | |||
* wolf | |||
| | |||
| Server | |||
|- | |||
| [[Modding:Entity_Behavior_placeblock|placeblock]] | |||
| The entity will place one of the given block codes from time to time. | |||
| | |||
* hen - prior to 1.15 update | |||
| | |||
minHourDelay = 8 * 24<br/> | |||
maxHourDelay = 15*24<br/> | |||
blockCodes = []<br/> | |||
| Server | |||
|- | |||
| [[Modding:Entity_Behavior_playerinventory|playerinventory]] | |||
| | |||
| | |||
* player | |||
| | |||
| Universal | |||
|- | |- | ||
| [[Modding:Entity_Behavior_playerphysics|playerphysics]] | | [[Modding:Entity_Behavior_playerphysics|playerphysics]] | ||
Line 138: | Line 408: | ||
* player | * player | ||
| | | | ||
stepHeight = 0.6 | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_repulseagents|repulseagents]] | |||
| Pushes other entities back. | |||
| | |||
* most entities | |||
| | |||
movable = true<br/> | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_reviveondeath|reviveondeath]] | |||
| | |||
| | |||
* eidolon-immobilized | |||
* trader | |||
* villager | |||
| | |||
| Server | |||
|- | |||
| [[Modding:Entity_Behavior_rideable|rideable]] | |||
| | |||
| | |||
* elk-tamed | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_rideableaccessories|rideableaccessories]] | |||
| | |||
| | |||
* boat | |||
* elk-tamed | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_ropetieable|ropetieable]] | |||
| | |||
| | |||
* elk-tamed | |||
* farm animals | |||
* wolf | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_seatable|seatable]] | |||
| | |||
| | |||
* boat | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_selectionboxes|selectionboxes]] | |||
| | |||
| | |||
* boat | |||
* boat-construction | |||
* elk-tamed | |||
| | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_seraphinventory|seraphinventory]] | |||
| | |||
| | |||
* armorstand-aged | |||
* playerbot | |||
| | |||
| Universal | | Universal | ||
|- | |- | ||
Line 146: | Line 481: | ||
* most entities | * most entities | ||
| | | | ||
* | aitasks | ||
| | | Server | ||
|- | |||
| [[Modding:Entity_Behavior_tiredness|tiredness]] | |||
| The entity will get tired over time. When it is sufficiently tired, it may sleep in a bed. | |||
| | |||
* player | |||
| | |||
currenttiredness = 0</br> | |||
| Universal | |||
|- | |||
| [[Modding:Entity_Behavior_villagerinventory|villagerinventory]] | |||
| | |||
| | |||
* villager | |||
| | |||
| Both | |||
|} | |} |
Latest revision as of 05:53, 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 |
|
Server | ||
aimingaccuracy | Adds aiming inaccuracy when sprinting, jumping, etc. |
|
Universal | |
antlergrowth |
|
Universal | ||
armorstandinventory |
|
Universal | ||
bodytemperature |
|
Universal | ||
boss |
|
Client | ||
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 |
|
Universal | ||
controlledphysics | Add physics to the entity. |
|
stepHeight = 0.6 |
Universal |
conversable |
|
Universal | ||
deaddecay |
|
Server | ||
despawn | The entity will despawn under given circumstances. |
|
minPlayerDistance |
Universal |
drunktyping |
|
Client | ||
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 |
|
Universal | ||
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 |
|
Universal | ||
health | Applies custom health to the entity. Means the entity can be hurt as well. |
|
currenthealth = 20 |
Server |
hidewatersurface |
|
Client | ||
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 |
|
Universal | ||
interpolateposition | Interpolates entity position and rotate. Smooths out the animations. It's a visual effect, therefore not available on server side. |
|
Client | |
milkable |
|
Universal | ||
mortallywoundable |
|
Universal | ||
mouthinventory |
|
Universal | ||
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 |
|
Universal | ||
nametag | Adds a name tag to the entity which will be displayed above the entity. |
|
renderRange = 99 |
Universal |
openablecontainer |
|
Universal | ||
passivephysics | Adds physics to the entity. |
|
waterDragFactor = 1 |
Universal |
passivephysicsmultibox |
|
Universal | ||
pettable |
|
Server | ||
placeblock | The entity will place one of the given block codes from time to time. |
|
minHourDelay = 8 * 24 |
Server |
playerinventory |
|
Universal | ||
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. |
|
movable = true |
Universal |
reviveondeath |
|
Server | ||
rideable |
|
Universal | ||
rideableaccessories |
|
Universal | ||
ropetieable |
|
Universal | ||
seatable |
|
Universal | ||
selectionboxes |
|
Universal | ||
seraphinventory |
|
Universal | ||
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 |
|
Both |