Modding:Entity Behaviors: Difference between revisions
(→All Behaviors: harvestable) |
(→Using Entity Behaviors: link to entity properties) |
||
Line 1: | Line 1: | ||
== Using Entity Behaviors == | == 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 <code>deer.json</code>, 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. | Inside the [[Modding:Entity_Json_Properties|entity json file]], entity behaviors can be added to the '''client''' section, '''server''' section, or both. For example, here is the '''controlledphysics''' behavior from <code>deer.json</code>, 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. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
client: { | client: { |
Revision as of 21:10, 21 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 an entity that can move on its own. |
|
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 | Handles calculating the entity drops, updating the animal weight, adjusting the drops based on weight, and the harvest inventory. |
|
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 an entity that cannot move on its own, but it still affected by things like wind and gravity. |
|
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 |
Content Modding | |||||||||
---|---|---|---|---|---|---|---|---|---|
Basics | Content Mods • Developing a Content Mod • Packaging & Release | ||||||||
Tutorials |
|
||||||||
Concepts | Modding Concepts • Modinfo • Variants • Domains • Patching • Remapping • World Properties | ||||||||
Moddable Assets |
|
||||||||
Uncategorized |
|
Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.
Modding | |
---|---|
Modding Introduction | Getting Started • Theme Pack |
Content Modding | Content Mods • Developing a Content Mod • Basic Tutorials • Intermediate Tutorials • Advanced Tutorials • Content Mod Concepts |
Code Modding | Code Mods • Setting up your Development Environment |
Property Overview | Item • Entity • Entity Behaviors • Block • Block Behaviors • Block Classes • Block Entities • Block Entity Behaviors • Collectible Behaviors • World properties |
Workflows & Infrastructure | Modding Efficiency Tips • Mod-engine compatibility • Mod Extensibility • VS Engine |
Additional Resources | Community Resources • Modding API Updates • Programming Languages • List of server commands • List of client commands • Client startup parameters • Server startup parameters Example Mods • API Docs • GitHub Repository |