Modding:Entity Json Properties: Difference between revisions
CreativeMD (talk | contribs) No edit summary |
CreativeMD (talk | contribs) No edit summary |
||
Line 155: | Line 155: | ||
Can be used to add interaction to the entity or other special functionalities. Example uses are <code>EntityItem</code> and <code>EntityPlayer</code>. | Can be used to add interaction to the entity or other special functionalities. Example uses are <code>EntityItem</code> and <code>EntityPlayer</code>. | ||
</td> | </td> | ||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_habitat" data-tt-parent="root">Habitat</div></td> | |||
<td>string</td> | |||
<td>"land"</td> | |||
<td>There is <code>sea</code>, <code>land</code> and <code>air</code></td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_hitboxsize" data-tt-parent="root">HitBoxSize</div></td> | |||
<td>object</td> | |||
<td>x: 0.125, y: 0.125</td> | |||
<td>The size of the hitbox, either to hit the entity or to interact with it.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_eyeheight" data-tt-parent="root">EyeHeight</div></td> | |||
<td>decimal number</td> | |||
<td>0.1</td> | |||
<td>Height of the eyes, measured from the bottom of the hitbox in meters. Used for camera angle and various other things.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_canclimb" data-tt-parent="root">CanClimb</div></td> | |||
<td>boolean</td> | |||
<td>false</td> | |||
<td>Whether the entity can climb on ladders or other blocks which are climbable.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_canclimbanywhere" data-tt-parent="root">CanClimbAnywhere</div></td> | |||
<td>boolean</td> | |||
<td>false</td> | |||
<td>Whether the entity can climb on any block, doesn't matter if it's a ladder or not.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_falldamage" data-tt-parent="root">FallDamage</div></td> | |||
<td>boolean</td> | |||
<td>true</td> | |||
<td>Whether the entity will take fall damage.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_climbtouchdistance" data-tt-parent="root">ClimbTouchDistance</div></td> | |||
<td>decimal number</td> | |||
<td>0.5</td> | |||
<td>Distance at which the entity can climb on something.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_rotatemodelonclimb" data-tt-parent="root">RotateModelOnClimb</div></td> | |||
<td>boolean</td> | |||
<td>false</td> | |||
<td>If true the entity model will be rotated to face the block its climbing on.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_knockbackresistance" data-tt-parent="root">KnockbackResistance</div></td> | |||
<td>decimal number</td> | |||
<td>0.0</td> | |||
<td>The higher the number is the less knockback will be applied. Useful for heavy entities.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_attributes" data-tt-parent="root">Attributes</div></td> | |||
<td>key: string, value: object</td> | |||
<td>-</td> | |||
<td>Custom Attributes associated with this entity.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes" data-invisible="true"></div></td> | |||
<td colspan="3"> | |||
Extra attributes added to the entity. Those are final and cannot be modified. It's a good way to keep things organized and and modifiable. These can be used by behaviors or the entity class: | |||
<syntaxhighlight lang="json"> | |||
attributes: { | |||
"attackPower": 10 | |||
}, | |||
</syntaxhighlight> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_sounds" data-tt-parent="root">Sounds</div></td> | |||
<td>key: string, value: string</td> | |||
<td>-</td> | |||
<td>Sounds of the entity, you can also add your own sounds and play them, but here is a list of default sounds used <code>death</code>, <code>hurt</code>, <code>idle</code>, <code>jump</code>, <code>swim</code> and <code>eat</code></td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_idlesoundchance" data-tt-parent="root">IdleSoundChance</div></td> | |||
<td>decimal number</td> | |||
<td>0.3</td> | |||
<td>How likely it is for the entity to play an idle sound.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_idlesoundrange" data-tt-parent="root">IdleSoundRange</div></td> | |||
<td>decimal number</td> | |||
<td>24</td> | |||
<td>How far the idle sound played by the entity can be heard.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_drops" data-tt-parent="root">Drops</div></td> | |||
<td>array of object</td> | |||
<td>-</td> | |||
<td>The items that should drop from breaking this block.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_drops_info" data-tt-parent="p_drops" data-invisible="true"></div></td> | |||
<td colspan="3"> | |||
'''No drop''' | |||
By default an entity does not drop anything at all: | |||
<syntaxhighlight lang="json"> | |||
drops: [], | |||
</syntaxhighlight> | |||
---- | |||
'''Drop''' | |||
You can also specify an item or block to drop. Therefore you need to define an '''ItemStack''', with the given properties: | |||
<table class="wikitable"> | |||
<tr style="background-color: grey;"> | |||
<th style="background-color: grey;">Property</th> | |||
<th style="background-color: grey;">Default</th> | |||
<th style="background-color: grey;">Explanation</th> | |||
</tr> | |||
<tr> | |||
<td>'''type'''</td> | |||
<td>''block''</td> | |||
<td>Can either be '''''block''''' or '''''item'''''.</td> | |||
</tr> | |||
<tr> | |||
<td>'''code''' (required)</td> | |||
<td>-</td> | |||
<td>The complete code (can also include domain) of the item or block.</td> | |||
</tr> | |||
<tr> | |||
<td>'''lastdrop'''</td> | |||
<td>false</td> | |||
<td>If true and the quantity dropped is >=1 any subsequent drop in the list will be ignored.</td> | |||
</tr> | |||
<tr> | |||
<td>'''attributes'''</td> | |||
<td>-</td> | |||
<td>Tree Attributes that will be attached to the resulting itemstack.</td> | |||
</tr> | |||
<tr> | |||
<td>'''tool'''</td> | |||
<td>-</td> | |||
<td>If specified then given tool is required to break this block.</td> | |||
</tr> | |||
<tr> | |||
<td>'''quantity'''</td> | |||
<td>- (one)</td> | |||
<td>Determines the quantity of items which will be dropped.</td> | |||
</tr> | |||
</table> | |||
For example, if the entity should drop '''charcoalpile''': | |||
<syntaxhighlight lang="json"> | |||
drops: [ | |||
{ type: "item", code: "charcoal" } | |||
], | |||
</syntaxhighlight> | |||
You can also specify drop special itemstack if the entity is killed by certain tool, similar to '''Tallgrass''' which only drops something if it's mined by a knife: | |||
<syntaxhighlight lang="json"> | |||
drops: [ | |||
{ type: "item", code: "drygrass", tool: "knife" }, | |||
], | |||
</syntaxhighlight> | |||
---- | |||
'''Chance drops''' | |||
Let's take a look at an example. This is the drop property of rock: | |||
<syntaxhighlight lang="json"> | |||
drops: [ | |||
{ | |||
type: "item", | |||
code: "stone-{rock}", | |||
quantity: { avg: 2.5, var: 0.5 } | |||
}, | |||
] | |||
</syntaxhighlight> | |||
This will drop 2-3 blocks. | |||
'''''avg''''': Stands for the default drop quantity. If var is 0 or not specified it will always drop the given average. | |||
'''''var''''': How much the drop rate can vary. Meaning the drop rate can be <code>avg - var</code> at minimum and <code>age + var</code> at maximum. | |||
Furthermore you can also switch between different distribution modes using the '''''dist''''' property. | |||
<table class="wikitable mw-collapsible mw-collapsed"> | |||
<tr> | |||
<th colspan="2">Overview - Distribution modes</th> | |||
</tr> | |||
<tr style="background-color: grey;"> | |||
<th style="background-color: grey;">Name</th> | |||
<th style="background-color: grey;">Explanation</th> | |||
</tr> | |||
<tr> | |||
<td>'''uniform'''</td> | |||
<td>''Select completely random numbers within avg-var until avg+var.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''triangle'''</td> | |||
<td>''Select random numbers with numbers near avg being the most commonly selected ones, following a triangle curve.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''gaussian'''</td> | |||
<td>''Select random numbers with numbers near avg being the most commonly selected ones, following a gaussian curve.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''narrowgaussian'''</td> | |||
<td>''Select random numbers with numbers near avg being the most commonly selected ones, following a narrow gaussian curve.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''inversegaussian'''</td> | |||
<td>''Select random numbers with numbers near avg being the least commonly selected ones, following an upside down gaussian curve.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''narrowinversegaussian'''</td> | |||
<td>''Select random numbers with numbers near avg being the least commonly selected ones, following an upside down gaussian curve.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''invexp'''</td> | |||
<td>''Select numbers in the form of avg + var, wheras low value of var are preferred.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''stronginvexp'''</td> | |||
<td>''Select numbers in the form of avg + var, wheras low value of var are strongly preferred.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''strongerinvexp'''</td> | |||
<td>''Select numbers in the form of avg + var, wheras low value of var are very strongly preferred.''</td> | |||
</tr> | |||
<tr> | |||
<td>'''dirac'''</td> | |||
<td>''Select completely random numbers within avg-var until avg+var only ONCE and then always 0.''</td> | |||
</tr> | |||
</table> | |||
---- | |||
'''Multiple Drops''' | |||
Of course you can also define multiple drops at once. A '''Sapling''' for example can drop a sapling and a stick: | |||
<syntaxhighlight lang="json"> | |||
drops: [ | |||
{ | |||
type: "block", | |||
code: "sapling-{wood}", | |||
quantity: { avg: 0.02, var: 0 }, | |||
}, | |||
{ | |||
type: "item", | |||
code: "stick", | |||
quantity: { avg: 0.02, var: 0 }, | |||
} | |||
], | |||
</syntaxhighlight> | |||
---- | |||
'''Last Drop''' | |||
In order to add a special drop, which (if dropped) prevents all other drops, you can use the lastDrop property: | |||
<syntaxhighlight lang="json"> | |||
drops: [ | |||
{ type: "item", code: "stick", quantity: { avg: 0.2, var: 0 }, lastDrop: true }, | |||
{ type: "item", code: "sapling", quantity: { avg: 1.25, var: 0 } } | |||
], | |||
</syntaxhighlight> | |||
The entity will either drop a stick with a chance of 20% or an average of 1.25 saplings. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>client: {</b></td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_renderer" data-tt-parent="root">Renderer</div></td> | |||
<td>string</td> | |||
<td>-</td> | |||
<td>Name of there renderer system that draws this entity.</td> | |||
</tr> | |||
<tr> | |||
<td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>}</b></td> | |||
</tr> | |||
<tr> | |||
<td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>server: {</b></td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_attributes" data-tt-parent="root">Attributes</div></td> | |||
<td>key: string, value: object</td> | |||
<td>-</td> | |||
<td>Custom Attributes associated with this entity only known by the server. They will not be send to the client.</td> | |||
</tr> | |||
<tr> | |||
<td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes" data-invisible="true"></div></td> | |||
<td colspan="3"> | |||
Extra attributes added to the entity for server use only. Those are final and cannot be modified. It's a good way to keep things organized and and modifiable. These can be used by behaviors or the entity class: | |||
<syntaxhighlight lang="json"> | |||
attributes: { | |||
"attackPower": 10 | |||
}, | |||
</syntaxhighlight> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>}</b></td> | |||
</tr> | </tr> | ||
</table> | </table> |
Revision as of 10:55, 26 October 2018
Overview
A complete list of all available properties
Property | Type | Default | Usage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
json |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Core (no byType available) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Code |
string | required | A unique identifier for the entity. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A domain prefix will be added dynamically depending on the location of the file. Every mod and VintageStory itself have a unique prefix. For example the code The code identifier has to be unique inside its domain. In theory there could be equal identifiers with different domain prefixes. Find out more about Domains. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Enabled |
boolean | true | If the entity will be loaded or not. Can be used to temporarily remove the entity. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
VariantGroups |
array of object | - | Allows you define multiple variants of the same entity. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The variantgroups property allows you to define multiple variants of this entity. All of them will have their unique pattern, which will be added to the entity code. An easy example would be a sheep, which can either be small or tall: variantgroups: [
{ code:"size", states: ["small", "tall"] },
],
Meaning there will be two blocks It's also possible to define multiple groups. variantgroups: [
{ code:"size", states: ["small", "tall"] },
{ code:"color", states: ["white", "black"] },
],
As a result you will have 2x2 groups, which will be added one after each other: Additionally it is possible to refer to external lists that are found in the worldproperties folder, such as variantgroups: [
{ loadFromProperties: "block/rock" },
],
Here is a full list of all groups and their variants (you can also find them in the For example, the following creates a variant group named orientation. It contains 5 states. variantgroups: [
{ code: "orientation", states: ["up"], loadFromProperties: "abstract/horizontalorientation" }
],
Unwanted variant states can be filtered out with the
Wondering where some links have gone?
Futhermore there are two ways of combining groups together. So far we covered the default combination mode, which is Imagine you want to implement a living tree, were either flowers, mushrooms or saplings or on it. You can use the variantgroups: [
{ code: "type", loadFromProperties: "block/wood" },
{ code: "flower", loadFromProperties: "block/flower", combine: "additive" },
{ code: "mushroom", loadFromProperties: "block/mushroom", combine: "additive" },
{ code: "sapling", loadFromProperties: "block/wood", combine: "additive" },
],
The living trees exists for every wood type (birch, oak, maple, pine, acacia, kapok) and can either have a flower, mushroom or a sapling suffix: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(any) byType |
key: string; value: object | - | You can create properties for certain variants of the block. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In order to define properties for specific variants you can add byType to the property name. This allows you to define it depending on the type and always follows the same syntax: (property)ByType: {
"selector": property,
"selector2": property2,
...
}
If the selector matches the name of the variant the given property will be used. Keep in mind that only the first matching one will be used (everything below will be ignored). An entity for example has two variants (big, small): falldamagebyType: {
"*-big": true,
"*-small": false
},
Since Vintagestory v1.8 it is also possible to use the variantgroup as a placeholder: variantgroups: [
{ code: "type", states: ["normal", "bamboo"] },
],
texture: { base: "entity/fish/{type}" }
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Common | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Class |
string | "entity" | The entity class can add special functionalities for the entity. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Can be used to add interaction to the entity or other special functionalities. Example uses are |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Habitat |
string | "land" | There is sea , land and air |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
HitBoxSize |
object | x: 0.125, y: 0.125 | The size of the hitbox, either to hit the entity or to interact with it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
EyeHeight |
decimal number | 0.1 | Height of the eyes, measured from the bottom of the hitbox in meters. Used for camera angle and various other things. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CanClimb |
boolean | false | Whether the entity can climb on ladders or other blocks which are climbable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CanClimbAnywhere |
boolean | false | Whether the entity can climb on any block, doesn't matter if it's a ladder or not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FallDamage |
boolean | true | Whether the entity will take fall damage. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ClimbTouchDistance |
decimal number | 0.5 | Distance at which the entity can climb on something. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RotateModelOnClimb |
boolean | false | If true the entity model will be rotated to face the block its climbing on. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
KnockbackResistance |
decimal number | 0.0 | The higher the number is the less knockback will be applied. Useful for heavy entities. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Attributes |
key: string, value: object | - | Custom Attributes associated with this entity. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Extra attributes added to the entity. Those are final and cannot be modified. It's a good way to keep things organized and and modifiable. These can be used by behaviors or the entity class: attributes: {
"attackPower": 10
},
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sounds |
key: string, value: string | - | Sounds of the entity, you can also add your own sounds and play them, but here is a list of default sounds used death , hurt , idle , jump , swim and eat |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IdleSoundChance |
decimal number | 0.3 | How likely it is for the entity to play an idle sound. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IdleSoundRange |
decimal number | 24 | How far the idle sound played by the entity can be heard. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Drops |
array of object | - | The items that should drop from breaking this block. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No drop By default an entity does not drop anything at all: drops: [],
Drop You can also specify an item or block to drop. Therefore you need to define an ItemStack, with the given properties:
For example, if the entity should drop charcoalpile: drops: [
{ type: "item", code: "charcoal" }
],
You can also specify drop special itemstack if the entity is killed by certain tool, similar to Tallgrass which only drops something if it's mined by a knife: drops: [
{ type: "item", code: "drygrass", tool: "knife" },
],
Chance drops Let's take a look at an example. This is the drop property of rock:
drops: [
{
type: "item",
code: "stone-{rock}",
quantity: { avg: 2.5, var: 0.5 }
},
]
This will drop 2-3 blocks. avg: Stands for the default drop quantity. If var is 0 or not specified it will always drop the given average. var: How much the drop rate can vary. Meaning the drop rate can be Furthermore you can also switch between different distribution modes using the dist property.
Multiple Drops Of course you can also define multiple drops at once. A Sapling for example can drop a sapling and a stick: drops: [
{
type: "block",
code: "sapling-{wood}",
quantity: { avg: 0.02, var: 0 },
},
{
type: "item",
code: "stick",
quantity: { avg: 0.02, var: 0 },
}
],
Last Drop In order to add a special drop, which (if dropped) prevents all other drops, you can use the lastDrop property: drops: [
{ type: "item", code: "stick", quantity: { avg: 0.2, var: 0 }, lastDrop: true },
{ type: "item", code: "sapling", quantity: { avg: 1.25, var: 0 } }
],
The entity will either drop a stick with a chance of 20% or an average of 1.25 saplings. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
client: { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Renderer |
string | - | Name of there renderer system that draws this entity. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
server: { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Attributes |
key: string, value: object | - | Custom Attributes associated with this entity only known by the server. They will not be send to the client. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Extra attributes added to the entity for server use only. Those are final and cannot be modified. It's a good way to keep things organized and and modifiable. These can be used by behaviors or the entity class: attributes: {
"attackPower": 10
},
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
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 • Block • Block Behaviors • Block Classes • Block Entities • Block Entity 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 |