Modding:Entity Json Properties

From Vintage Story Wiki
This page contains changes which are not marked for translation.
Other languages:

This page was last verified for Vintage Story version 1.19.


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 rabbit turns into game:rabbit.

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.
(any) bytype
key: string; value: object - Allows different property values to be specified based on the variant code.
allowedVariants
array of strings - Used to trim unnecessary items generated by combined variants.
skipVariants
array of strings - Similar to allowedVariants, but instead skips the creation of listed variants rather than assigning which are allowed.
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 EntityItem and EntityPlayer.

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:

Property Default Explanation
type block Can either be block or item.
code (required) - The complete code (can also include domain) of the item or block.
lastdrop false If true and the quantity dropped is >=1 any subsequent drop in the list will be ignored.
attributes - Tree Attributes that will be attached to the resulting itemstack.
tool - If specified then given tool is required to break this block.
quantity - (one) Determines the quantity of items which will be dropped.

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 avg - var at minimum and age + var at maximum.

Furthermore you can also switch between different distribution modes using the dist property.

Overview - Distribution modes
Name Explanation
uniform Select completely random numbers within avg-var until avg+var.
triangle Select random numbers with numbers near avg being the most commonly selected ones, following a triangle curve.
gaussian Select random numbers with numbers near avg being the most commonly selected ones, following a gaussian curve.
narrowgaussian Select random numbers with numbers near avg being the most commonly selected ones, following a narrow gaussian curve.
inversegaussian Select random numbers with numbers near avg being the least commonly selected ones, following an upside down gaussian curve.
narrowinversegaussian Select random numbers with numbers near avg being the least commonly selected ones, following an upside down gaussian curve.
invexp Select numbers in the form of avg + var, wheras low value of var are preferred.
stronginvexp Select numbers in the form of avg + var, wheras low value of var are strongly preferred.
strongerinvexp Select numbers in the form of avg + var, wheras low value of var are very strongly preferred.
dirac Select completely random numbers within avg-var until avg+var only ONCE and then always 0.

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.
texture
object The texture of the entity. It will overwrite all textures of the shape.
base


overlays


alternates
Default example (player model):
texture: {
		base: "entity/humanoid/player"
	}
Using variantgroups (rock):
texture: {
		base: "entity/humanoid/player-{type}"
	}
Overlay texutre:
	texture: {
		base: "entity/humanoid/player-{type}",
		overlays: [ "entity/humanoid/player-{type}-overlay" ],
	}

Random textures:

	texture: {
		base: "entity/humanoid/player-{type}",
		alternates: [
			{ base: "entity/humanoid/player-{type}2" },
			{ base: "entity/humanoid/player-{type}3"}
		]
	}

Random textures and overlays combined:

	texture: {
		base: "entity/humanoid/player-{type}",
		overlays: [ "entity/humanoid/player-{type}-overlay" ],
		alternates: [
			{ base: "entity/humanoid/player-{type}2", overlays: [ "entity/humanoid/player-{type}2-overlay" ] },
			{ base: "entity/humanoid/player-{type}3", overlays: [ "entity/humanoid/player-{type}3-overlay" ] }
		]
	}
textures
key: string, value: object Can be used to replace specific textures of the shape.
base


overlays


alternates
Replace arrow texture of the shape, the stick texture remains untouched:
	textures: {
		"arrow": { 
			base: "entity/arrow/stone"
		}
	}
shape
object - The shape of the entity.
base
The path to the shape json file, the base dir is assets/shapes/.
shape: { base: "entity/arrow" }
glowlevel
0 ... 255 0 Causes the entity to visually glow if Bloom is enabled.
size
decimal number 1 Can be used to scale the entity up or down.
behaviors
array of object A behavior adds custom abilities to the entity.
floatupwhenstuck
Name Explanation Properties Side
collectitems The entity collections items laying around on the ground. Used by player. Server
health Applies custom health to the entity. Means the entity can be hurt as well. currenthealth = 20, maxhealth = 20, basemaxhealth = 20 Server
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
breathe The entity will need to breathe and therefore suffocate in other blocks (for example sand). Server
playerphysics Makes an entity controllable by a player. stepHeight = 0.6 Universal
controlledphysics Can be controlled by a player. stepHeight = 0.6 Universal
taskai Allows you to specify tasks.
interpolateposition Interpolates entity position and rotate. Smooths out the animations. It's a visual effect, therefore not available on server side. Client
despawn The entity will despawn under given circumstances. minPlayerDistance, belowLightLevel, minSeconds = 30 Server
grow The entity will grow and eventually turn into one of its adults. hoursToGrow = 96, adultEntityCodes = [] Server
multiply A pack of wolves for example grows in size over time (new babies are born). pregnancyDays = 3.0, spawnEntityCode, requiresNearbyEntityCode, requiresNearbyEntityRange = 5, multiplyCooldownDaysMin = 6, multiplyCooldownDaysMax = 12, portionsEatenForMultiply = 3, spawnQuantityMin = 1, spawnQuantityMax = 2, requiresFood = true Server
aimingaccuracy Adds aiming inaccuracy when sprinting, jumping, etc. Universal
emotionstates Adds emotion states with a given chance. As an example, it can be used to make an animal "hungry" (aggressive) and "saturated" (passive). Server
repulseagents Pushes other entities back. Universal
tiredness The entity will get tired over time and needs recover by sleeping in a bed. currenttiredness = 0 Universal
nametag Adds a name tag to the entity which will be displayed above the entity. selectFromRandomName Universal
placeblock The entity will place one of the given block codes from time to time. minHourDelay = 8 * 24, maxHourDelay = 15*24, blockCodes = [] Server
passivephysics Adds physics to the entity. waterDragFactor = 1, airDragFallingFactor = 1, groundDragFactor = 1, gravityFactor = 1 Universal
floatupwhenstuck Float up the entity if it gets stuck in a block. onlyWhenDead = false Universal
animations
array of object WIP
code
string The identifier of the animation.
animation
string The animation code identifier to play.
weight
decimal number 1.0 Animations with a high weight value will be prioritized over the other animations when the animations are combined. For example if the player aims with a bow while jumping around, the aiming animation has a higher weight (for the upper body) so the jumping animation will be reduced.
elementweight
key: string, value: decimal number Allows you to specify a weight for each element individually.
animationspeed
decimal number 1.0 The speed of the animation.
mulwithwalkspeed
boolean false Whether the animation should be affected by the walk speed.
easeinspeed
decimal number 10
easeoutspeed
decimal number 10
triggeredby
Specifies by what the animation is triggered.
oncontrols
array of object An array of activities.
none
idle
move
sprintmode
sneakmode
fly
swim
jump
fall
climb
floorsitting
dead
break
place
matchexact
boolean false
defaultanim
boolean false
blendmode
string Animation blend mode for all elements.
add
Add the animation without taking other animations into considerations.
average
Add the pose and average it together with all other running animations with blendmode Average or AddAverage.
addaverage
Add the animation without taking other animations into consideration, but add it's weight for averaging.
elementblendmode
key: string, value: string Allows you to specify a blend mode for each element individually.
}
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
	},
behaviors
array of object A behavior adds custom abilities to the entity.
floatupwhenstuck
Name Explanation Properties Side
collectitems The entity collections items laying around on the ground. Used by player. Server
health Applies custom health to the entity. Means the entity can be hurt as well. currenthealth = 20, maxhealth = 20, basemaxhealth = 20 Server
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
breathe The entity will need to breathe and therefore suffocate in other blocks (for example sand). Server
playerphysics Makes an entity controllable by a player. stepHeight = 0.6 Universal
controlledphysics Can be controlled by a player. stepHeight = 0.6 Universal
taskai Allows you to specify tasks.
interpolateposition Interpolates entity position and rotate. Smooths out the animations. It's a visual effect, therefore not available on server side. Client
despawn The entity will despawn under given circumstances. minPlayerDistance, belowLightLevel, minSeconds = 30 Server
grow The entity will grow and eventually turn into one of its adults. hoursToGrow = 96, adultEntityCodes = [] Server
multiply A pack of wolves for example grows in size over time (new babies are born). pregnancyDays = 3.0, spawnEntityCode, requiresNearbyEntityCode, requiresNearbyEntityRange = 5, multiplyCooldownDaysMin = 6, multiplyCooldownDaysMax = 12, portionsEatenForMultiply = 3, spawnQuantityMin = 1, spawnQuantityMax = 2, requiresFood = true Server
aimingaccuracy Adds aiming inaccuracy when sprinting, jumping, etc. Universal
emotionstates Adds emotion states with a given chance. As an example, it can be used to make an animal "hungry" (aggressive) and "saturated" (passive). Server
repulseagents Pushes other entities back. Universal
tiredness The entity will get tired over time and needs recover by sleeping in a bed. currenttiredness = 0 Universal
nametag Adds a name tag to the entity which will be displayed above the entity. selectFromRandomName Universal
placeblock The entity will place one of the given block codes from time to time. minHourDelay = 8 * 24, maxHourDelay = 15*24, blockCodes = [] Server
passivephysics Adds physics to the entity. waterDragFactor = 1, airDragFallingFactor = 1, groundDragFactor = 1, gravityFactor = 1 Universal
floatupwhenstuck Float up the entity if it gets stuck in a block. onlyWhenDead = false Universal
spawnConditions
object - Specifies the circumstances of the entity spawn.
runtime
object
group
string
chance
decimal number 1.0 How long it takes to make an attempt to spawn the entity: 1.0 -> 4 seconds, 0.1 -> 40 seconds.
maxquantity
integer 20 Maximum number of entities inside the chunk, if this is exceeded the entity will not spawn there.
mindistancetoplayer
integer 18 Minimum distance the entity can spawn away from the player.
minlightlevel
integer 0
maxlightlevel
integer 32
lightleveltype
string "MaxLight"
onlyblocklight
Will get you just the block light
onlysunlight
Will get you just the sun light unaffected by the day/night cycle
maxlight
Will get you max(onlysunlight, onlyblocklight)
maxtimeofdaylight
Will get you max(sunlight * sunbrightness, blocklight)
groupsize
object { avg: 1, var: 0 } Determines the size of the group. By default the size of the group is always one. Find out more about the random generator.
companions
array of string - Codes of all possible companions.
insideblockcodes
array of string [ "game:air" ] The block codes in which the entity can spawn. Entities which can spawn underwater might use [ "game:water" ] instead.
requiresolidground
boolean true If the entity requires a solid block below it. For example birds and fishes do not require it.
tryonlysurface
boolean false If false the game will also try to spawn the entity below the surface (in a cave for example). For ordinary animals this should be true so they only spawn on the surface.
mintemp
integer -40 Minimum temperature at which the entity can spawn.
maxtemp
integer 40 Maximum temperature at which the entity can spawn.
minrain
decimal number 0 Minimum rain average at which the entity can spawn.
maxrain
decimal number 1 Maximum rain average at which the entity can spawn.
minforest
decimal number 0 Minimum forest density at which the entity can spawn.
maxforest
decimal number 1 Maximum forest density at which the entity can spawn.
minshrubs
decimal number 0 Minimum shrubs density at which the entity can spawn.
maxshrubs
decimal number 1 Maximum shrubs density at which the entity can spawn.
minforestorshrubs
decimal number 0 Minimum shrubs or forest density at which the entity can spawn.
worldgen
object
group
string
triesperchunk
object zero How many tries per chunk the entity has to spawn. Find out more about the random generator.
minlightlevel
integer 0
maxlightlevel
integer 32
lightleveltype
string "MaxLight"
onlyblocklight
Will get you just the block light
onlysunlight
Will get you just the sun light unaffected by the day/night cycle
maxlight
Will get you max(onlysunlight, onlyblocklight)
maxtimeofdaylight
Will get you max(sunlight * sunbrightness, blocklight)
groupsize
object { avg: 1, var: 0 } Determines the size of the group. By default the size of the group is always one. Find out more about the random generator.
companions
array of string - Codes of all possible companions.
insideblockcodes
array of string [ "game:air" ] The block codes in which the entity can spawn. Entities which can spawn underwater might use [ "game:water" ] instead.
requiresolidground
boolean true If the entity requires a solid block below it. For example birds and fishes do not require it.
tryonlysurface
boolean false If false the game will also try to spawn the entity below the surface (in a cave for example). For ordinary animals this should be true so they only spawn on the surface.
mintemp
integer -40 Minimum temperature at which the entity can spawn.
maxtemp
integer 40 Maximum temperature at which the entity can spawn.
minrain
decimal number 0 Minimum rain average at which the entity can spawn.
maxrain
decimal number 1 Maximum rain average at which the entity can spawn.
minforest
decimal number 0 Minimum forest density at which the entity can spawn.
maxforest
decimal number 1 Maximum forest density at which the entity can spawn.
minshrubs
decimal number 0 Minimum shrubs density at which the entity can spawn.
maxshrubs
decimal number 1 Maximum shrubs density at which the entity can spawn.
minforestorshrubs
decimal number 0 Minimum shrubs or forest density at which the entity can spawn.
}



Modding
Green Items require C# coding
Basics

Getting Started | Basic Examples | Theme Pack

Asset System | Textures | Items | Recipes | Blocks | Entities | Model Creator | Animation Basics | VTML & Icons | Packaging & Release | Modinfo | Debugging

Advanced

JSON Patching | Advanced JSON Item | The Remapper | Server-Client Considerations | Compatibility with other mods

Setting up your Development Environment

Advanced Blocks | Advanced Items | Block and Item Interactions | Block Behavior | Block Entity | Particle Effects | World Access | Inventory Handling | Commands | GUIs | Network API | Monkey patching (Harmony)

Data Management

Savegame Data Storage | ModConfig File | Chunk Data Storage | TreeAttribute

Worldgen

WorldGen Concepts | Terrain | Ores | Trees | WorldGen API | NatFloat | EvolvingNatFloat | Json Random Generator

Rendering

Shaders and Renderers

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

List of server commands | List of client commands | Client startup parameters | Server startup parameters | Creative Starter Guide | ServerBlockTicking | Bot System | WorldEdit | Cinematic Camera | Adjustable FPS Video Recording

Example Mods | API Docs | GitHub Repository