Modding:Entity Behaviors: Difference between revisions
(→All Behaviors: typo) |
(→All Behaviors: Add all behavior properties mentioned in the asset files) |
||
Line 103: | Line 103: | ||
* animals with horns | * animals with horns | ||
| | | | ||
beginGrowMonth<br/> | |||
c1<br/> | |||
c2<br/> | |||
c3<br/> | |||
growDurationMonths<br/> | |||
grownDurationMonths<br/> | |||
noItemDrop<br/> | |||
overrideType<br/> | |||
shedDurationMonths<br/> | |||
variants<br/> | |||
| Universal | | Universal | ||
|- | |- | ||
Line 124: | Line 134: | ||
* eidolon-immobolized | * eidolon-immobolized | ||
| | | | ||
musicTrack<br/> | |||
| Client | | Client | ||
|- | |- | ||
Line 167: | Line 178: | ||
* villager | * villager | ||
| | | | ||
dialogue<br/> | |||
| Universal | | Universal | ||
|- | |- | ||
Line 174: | Line 186: | ||
* animals | * animals | ||
| | | | ||
decayedBlock<br/> | |||
hoursToDecay<br/> | |||
| Server | | Server | ||
|- | |- | ||
Line 182: | Line 196: | ||
* animals - both sides | * animals - both sides | ||
| | | | ||
afterDays<br/> | |||
belowLightLevel<br/> | |||
minPlayerDistance<br/> | minPlayerDistance<br/> | ||
minSeconds = 30<br/> | minSeconds = 30<br/> | ||
| Universal | | Universal | ||
Line 237: | Line 252: | ||
* harvestable animals | * harvestable animals | ||
| | | | ||
drops<br/> | |||
duration<br/> | |||
fixedweight<br/> | |||
| Universal | | Universal | ||
|- | |- | ||
Line 256: | Line 274: | ||
* boat | * boat | ||
| | | | ||
hideWaterElement<br/> | |||
| Client | | Client | ||
|- | |- | ||
Line 300: | Line 319: | ||
* elk-tamed | * elk-tamed | ||
| | | | ||
whenBelowHealth<br/> | |||
| Universal | | Universal | ||
|- | |- | ||
Line 307: | Line 327: | ||
* racoon | * racoon | ||
| | | | ||
acceptStacks<br/> | |||
| Universal | | Universal | ||
|- | |- | ||
Line 315: | Line 336: | ||
* farm animals - both sides | * farm animals - both sides | ||
| | | | ||
eatAnyway<br/> | |||
growthCapEntityCodes<br/> | |||
growthCapQuantity<br/> | |||
growthCapRange<br/> | |||
pregnancyDays = 3.0<br/> | pregnancyDays = 3.0<br/> | ||
quantityPerDay<br/> | |||
spawnEntityCode<br/> | spawnEntityCode<br/> | ||
requiresNearbyEntityCode<br/> | requiresNearbyEntityCode<br/> | ||
Line 322: | Line 348: | ||
multiplyCooldownDaysMax = 12<br/> | multiplyCooldownDaysMax = 12<br/> | ||
portionsEatenForMultiply = 3<br/> | portionsEatenForMultiply = 3<br/> | ||
spawnEntityCode<br/> | |||
spawnEntityCodes<br/> | |||
spawnQuantityMin = 1<br/> | spawnQuantityMin = 1<br/> | ||
spawnQuantityMax = 2<br/> | spawnQuantityMax = 2<br/> | ||
Line 332: | Line 360: | ||
* chicken-hen | * chicken-hen | ||
| | | | ||
multiplyCooldownDaysMax<br/> | |||
multiplyCooldownDaysMin<br/> | |||
portionsEatenForMultiply<br/> | |||
| Universal | | Universal | ||
|- | |- | ||
Line 384: | Line 415: | ||
* wolf | * wolf | ||
| | | | ||
minGeneration<br/> | |||
| Server | | Server | ||
|- | |- | ||
Line 426: | Line 458: | ||
* villager | * villager | ||
| | | | ||
maxHours<br/> | |||
minHours<br/> | |||
| Server | | Server | ||
|- | |- | ||
Line 450: | Line 484: | ||
* wolf | * wolf | ||
| | | | ||
minGeneration<br/> | |||
| Universal | | Universal | ||
|- | |- |
Revision as of 00:44, 7 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 |
|
beginGrowMonth |
Universal | |
armorstandinventory |
|
Universal | ||
bodytemperature |
|
Universal | ||
boss |
|
musicTrack |
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 |
|
dialogue |
Universal | |
deaddecay |
|
decayedBlock |
Server | |
despawn | The entity will despawn under given circumstances. |
|
afterDays |
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 |
|
drops |
Universal | |
health | Applies custom health to the entity. Means the entity can be hurt as well. |
|
currenthealth = 20 |
Server |
hidewatersurface |
|
hideWaterElement |
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 |
|
whenBelowHealth |
Universal | |
mouthinventory |
|
acceptStacks |
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. |
|
eatAnyway |
Universal |
multiplybase |
|
multiplyCooldownDaysMax |
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 |
|
minGeneration |
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 |
|
maxHours |
Server | |
rideable |
|
Universal | ||
rideableaccessories |
|
Universal | ||
ropetieable |
|
minGeneration |
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 |