Modding:Block Json Properties: Difference between revisions

From Vintage Story Wiki
No edit summary
No edit summary
Line 75: Line 75:
----
----


Additionally it is possible to refer to world properties, such as <code>block/rock</code>, which contains all states of all rock types. This used for <code>gravel</code>, <code>sand</code> and <code>rock</code>:
Additionally it is possible to refer to external lists that are found in the worldproperties folder, such as <code>block/rock</code>, which contains all states of all rock types. This used for <code>gravel</code>, <code>sand</code> and <code>rock</code>:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
variantgroups: [
variantgroups: [

Revision as of 10:43, 25 September 2017

Overview

An incomplete list of all available properties

Property Type Default Usage
json
Core (no byType available)
Code
string - A unique identifier for the block.

A domain prefix will be added dynamically depending on the location of the file. Every mod and the VintageStory itself have a unique prefix. For example the code stone would turn into game:stone. The code identifier has to be unique, at least inside his domain, so in theory there can be equal identifiers with different domain prefixes. Find out more about Domains.

Enabled
boolean true If the block will be loaded or not. Can be used to temporarily remove the block.
VariantGroups
array of object - Allows you define multiple variants of the same block.

The variantgroups property allows you to define multiple variants of this block. All of them will have their unique code, which will added to the code.

An easy example would be a bowl, which can either be raw or burned:

	variantgroups: [
		{ code:"type", states: ["raw", "burned"] },
	],

Meaning there will be two blocks bowl-raw and bowl-burned.


It's also possible to define multiple groups.

	variantgroups: [
		{ code:"state", states: ["closed", "opened"] },
		{ code:"contents", states: ["empty", "cabbage"] },
	],

As a result you will have 2x2 groups, which will be added one after each other: barrel-closed-empty, barrel-closed-cabbage, barrel-opened-empty and barrel-opened-cabbage.


Additionally it is possible to refer to external lists that are found in the worldproperties folder, such as block/rock, which contains all states of all rock types. This used for gravel, sand and rock:

	variantgroups: [
		{ loadFromProperties: "block/rock" },
	],

Here is a full list of all groups and their variants (you can also find them in the assets/worldproperties folder): The world properties are stored in the assets/survival/worldproperties folder. They are used to help fill in the variantgroups field. Instead of directly specifying every state in the variant group, the states can be loaded from a world property through the loadFromProperties key. The states from multiple world properties can be added with the loadFromPropertiesCombine key, which takes an array of strings. The states key can still be optionally added to the variant group to specify additional states.

For example, the following creates a variant group named orientation. It contains 5 states. north, east, south, and west are loaded from the abstract/horizontalorientation world property. up is added to the list of states.

	variantgroups: [
		{ code: "orientation", states: ["up"], loadFromProperties: "abstract/horizontalorientation" }
	],

Unwanted variant states can be filtered out with the skipVariants property. Or all states that do not match an expression can be filtered out with the allowedVariants property.

Name States
abstract/alloy -
abstract/coating n, e, s, w, u, d, ud, ns, ew, nd, ed, sd, wd, su, wu, nu, eu, es, sw, nw, ne, nwd, ned, esd, swd, nwu, neu, esu, swu, nsd, ewd, sud, wud, nud, eud, nsu, ewu, nes, esw, nsw, new, newd, nesd, eswd, nswd, eswu, nswu, newu, nesu, nesw, ewud, nsud, neud, esud, swud, nwud, neswd, neswu, newud, nesud, eswud, nswud, neswud
abstract/fertility verylow, low, medium, compost, high
abstract/grasscoverage none, verysparse, sparse, normal
abstract/horizontalorientation north, east, south, west
abstract/rockgroup -
abstract/verticalorientation up, down
block/flower catmint, cornflower, forgetmenot, edelweiss, heather, horsetail, orangemallow, wilddaisy, westerngorse, cowparsley, goldenpoppy, lilyofthevalley, woad, redtopgrass
block/fruit blueberry, cranberry, redcurrant, whitecurrant, blackcurrant, saguaro, pineapple, redapple, pinkapple, yellowapple, cherry, peach, pear, orange, mango, breadfruit, lychee, pomegranate
block/grass -
block/herb basil, chamomile, cilantro, lavender, marjoram, mint, saffron, sage, thyme
block/metal bismuth, bismuthbronze, blackbronze, brass, chromium, copper, cupronickel, electrum, gold, iron, meteoriciron, lead, molybdochalkos, platinum, nickel, silver, stainlesssteel, steel, tin, tinbronze, titanium, uranium, zinc
block/mushroom flyagaric, fieldmushroom, almondmushroom, bitterbolete, blacktrumpet, chanterelle, commonmorel, deathcap, devilstooth, devilbolete, earthball, elfinsaddle, golddropmilkcap, greencrackedrussula, indigomilkcap, jackolantern, kingbolete, lobster, orangeoakbolete, paddystraw, puffball, redwinecap, saffronmilkcap, violetwebcap, witchhat, beardedtooth, chickenofthewoods, dryadsaddle, pinkoyster, tinderhoof, whiteoyster, reishi, funeralbell, deerear, livermushroom, pinkbonnet, shiitake
block/ore-gem-cut diamond, emerald, peridot
block/ore-gem-rough diamond,emerald,olivine_peridot
block/ore-graded nativecopper,limonite,quartz_nativegold,galena,cassiterite,chromite,ilmenite,sphalerite,quartz_nativesilver,galena_nativesilver,bismuthinite,magnetite,hematite,malachite,pentlandite,uranium,wolframite,rhodochrosite
block/ore-nugget nativecopper,limonite,nativegold,galena,cassiterite,chromite,ilmenite,sphalerite,nativesilver,bismuthinite,magnetite,hematite,malachite,pentlandite,uranium,wolframite,rhodochrosite
block/ore-ungraded alum,lapislazuli,corundum,anthracite,borax,cinnabar,lignite,bituminouscoal,sylvite,quartz,olivine,sulfur,fluorite,graphite,kernite,phosphorite
block/painting howl,elk,underwater,prey,forestdawn,fishandtherain,bogfort,castleruin,cow,hunterintheforest,seraph,sleepingwolf,sunkenruin,traveler,oldvillage,lastday,sodhouse
block/rock andesite,chalk,chert,conglomerate,limestone,claystone,granite,sandstone,shale,basalt,peridotite,phyllite,slate,bauxite
block/rockwithdeposit andesite,chalk,chert,conglomerate,limestone,claystone,granite,sandstone,shale,basalt,peridotite,phyllite,slate,obsidian,kimberlite,scoria,tuff,bauxite,halite,suevite,whitemarble,redmarble,greenmarble
block/tallgrass veryshort,short,mediumshort,medium,tall,verytall,eaten
block/toolmetal bismuth,bismuthbronze,blackbronze,brass,copper,gold,iron,meteoriciron,lead,molybdochalkos,silver,steel,tinbronze
block/wood birch,oak,maple,pine,acacia,kapok,baldcypress,larch,redwood,ebony,walnut,purpleheart
Icon Sign.png

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.



Futhermore there are two ways of combining together groups. So far we covered the default combination mode, which is multiplicative (the total count of variants is the product of all states).

Let's take a look at a different example (flowerpot), which uses the additive combination mode:

	variantgroups: [
		{ code: "type", states: ["raw"] },
		{ code: "empty", states: ["empty"], combine: "additive" },
		{ code: "flower", loadFromProperties: "block/flower", combine: "additive" },
		{ code: "mushroom", loadFromProperties: "block/mushroom", combine: "additive" },
		{ code: "sapling", loadFromProperties: "block/wood", combine: "additive" },
	],

The variants are flowerpot-raw, flowerpot-empty, flowerpot-{all flowers}, flowerpot-{all mushrooms} and flowerpot-{all saplings}.

Things might get clearer if we look at another example:

	variantgroups: [
		{ code: "something", states: ["same", "different"] },
		{ code: "type", states: ["raw", "baked"] },
		{ code: "empty", states: ["red", "green"], "combine": "additive" },
	],

In this case, the result would be same-raw, same-baked, different-raw, different-baked, red and green

The additive combination means all states will be added as a separate variant.

Specific
maxstacksize
number 64 Determines the maximum amount you can stack the block in one slot.
enabled
boolean true If the block will be added to game or not.
class
string block The block class
entityclass
string - The blockentity class
behaviors
array of strings empty

Adding behaviors to your block

Block behaviors are an array of objects with properties attached to your block. They are added through the behaviors field at the top level (same level as the code field) of a block json file. Below is an example of two behaviors, one with properties and one without properties.

{
  ...
  code: "exampleblock",
  ...
  behaviors: [{name: "behavior1", properties: {myProperty1: "myValue1", myProperty2: "myValue2"}},{name: "behavior2"}],
  ...
}

All Block Behaviors

Here is a table containing all properties of the base game as of 1.18.14.

Behavior Name Properties Used by Blocks
BlockEntityInteract - door
BreakIfFloating - termitemound, crackedrock, meteorite, ore, ore, ore, rock, rottenlog
BreakSnowFirst - tallgrass, stonepath
CanAttach
  • sides
drystonefence, woodenfence, roughhewnfence
CanIgnite - torch
CollectFrom - henbox
Container - storagevessel, stove, hopper, quern, crate, labeledchest, trunk, chest, firepit, stationarybasket
Decor
  • sides
  • sidedVariants
  • nwOrientable
  • drawIfCulled
  • alternateZOffset
  • notFullFace
  • removable
  • thickness
linen, mediumcarpet, rushmat, smallcarpet, wallpaper, wool, hotspringbacteriasmooth, hotspringbacteria, attachingplant, overlay, overlay, oxidation, transition, fallenleaves, caveart
Door - door
DropNotSnowCovered - fern, flower
ExchangeOnInteract
  • exchangeStates (string array of block states)
  • sounds (path from sounds folder)
  • actionLangCode (language key from the lang file)
trapdoor
FiniteSpreadingLiquid
  • liquidCollisionSound (path from sounds folder)
  • sourceReplacementCode (block code)
  • flowingReplacementCode (block code)
  • collidesWith (other liquid)
  • spreadDelay (int, default: 0)
boilingwater, water, lava, saltwater
Harvestable
  • harvestTime (float, seconds, default: 0)
  • harvestedStack (BlockDropItemStack)
  • harvestingSound (path from sounds folder)
  • harvestedBlockCode (block code)
bigberrybush, saguarocactus, smallberrybush, log-resin
HeatSource
  • heatStrength (float)
boilingwater, lava, forge, firepit, pitkiln, coalpile, ember, fire
HorizontalAttachable
  • handleDrops (bool, default: true)
  • dropBlockFace (Compass Direction, default: "north")
  • dropBlock (block name)
  • attachmentAreas (side -> RotatableCube)
  • attachmentArea (cuboid)
tapestry, torchholder, mushroom, canvas, moldrack, painting, shelf, toolrack
HorizontalOrientable
  • dropBlockFace (Compass Direction, default: "North")
  • drop (block name)
agedwallpaperplanks, altar, bellows, bloomerybase, brake, cage, churn, clayoven, clutch, cokeovendoor, condenser, crank, creativerotor, helvehammerbase, jonas, labeledchest, metalpartpile, palisadestakes, palisadewall, pulverizerframe, resonator, skep, slantedroofing, slantedroofingcornerinner, slantedroofingcornerouter, statictranslocator, stationarybasket, stonecoffinsection, stove, trunk, verticalboiler, wagonwheels, windmillrotor, workbench
HorizontalUpDownOrientable - -
Ignitable - charcoalpit, clayoven, firepit
JonasBoilerDoor - jonas
JonasGasifier - jonas
JonasHydraulicPump - jonas
Ladder
  • dropBlockFace (face direction, Default: north)
  • isFlexible (bool, default: false)
ladder
Lockable - archimedesscrew, chest, chute, cokeovendoor, crate, door, hopper, irondoor, labeledchest, roughhewnfencegate, stationarybasket, storagevessel, trapdoor, trunk, woodenfencegate
MilkingContainer - woodbucket
Multiblock
  • sizex
  • sizey
  • sizez
  • type
  • cposition
jonas, riftward, verticalboiler, banner, trunk, painting
MyceliumHost - creativegrass, forestfloor, log, soil
NoParticles - claybrickchimney
NWOrientable - bookshelves (legacy), claybrickchimney, fruitpress, fruitpresstop, mannequin, slantedroofingridge, transmission, trough, woodenpath, woodentoggle
OmniAttachable
  • facingCode (string, default: orientation)
  • attachmentAreas (side -> RotatableCube)
crystal, lantern
OmniRotatable
  • rotateH (bool, default: false)
  • rotateV (bool, default: false)
  • rotateV4 (bool, default: false)
  • rotateSides (bool, default: false)
  • facing (string, "block" or "player", default: "player")
  • dropChance(float, default: 1)
brickslabs, clayshinglelabs, cobblestoneslab, glassslab, mudbrickslab, plankslab, polishedrockslab, quartzslab, stonebrickslab, trapdoor
Pillar
  • invertedPlacement (bool, default: false)
carvedlog, debarkedlog, hay, log, lognarrow, planks, plaster, quartzpillar, stackedbamboo, woodenaxle
Pumpkin
  • vineGrowthStage(int)
  • vineGrowthQuantity(NatFloat)
crop
PushEventOnBlockBroken
  • eventName (string)
bamboo, bambooleaves, leaves, leavesbranchy, leavesnarrow, log, lognarrow, logsection
RainDrip - -
Reinforcable - -
RightClickPickup
  • dropsPickupMode (bool, default: false)
  • sound (path from sounds folder)
  • placeSound (path from sounds folder)
basereturnteleporter, bowl, bowl-meal, clayplanter, claypot, crock, crucible, egg, flowerpot, ingotmold, jug, lantern, looseflints, looseores, loosestick, loosestones, metal, oillamp, pan, pie, pineapple, pumpkin, seashell, storagevessel, toolmold, wateringcan, woodbucket
RopeTieable - roughhewnfence, woodenfence
Slab - -
Steaming - boilingwater
SneakPlacing - pan, pie, wateringcan
Unplaceable - bloomerychimney, bowl, bowl-meal, clayplanter, claypot, crock, crucible, flowerpot, ingotmold, jug, metal, pineapple, pumpkin, storagevessel, toolmold, wateringcan
Unstable
  • attachedToFaces (default: down)
  • attachmentAreas (side -> RotatableCube)
bunchocandles, crop, deadcrop, firepit, oreblastingbomb, silvertorchcactus, verticalboiler, wildbeehive, woodenpath, woodenrails
UnstableFalling
  • attachableFaces (string array)
  • attachmentArea (cuboid)
  • attachmentAreas (side -> RotatableCube)
  • ignorePlaceTest (bool, default: false)
  • exceptions (block code array)
  • fallSideways (bool, default: false)
  • dustIntensity (float, default: 0)
  • fallSidewaysChance (float, default: 0.3)
  • fallSound (path from sounds folder)
  • impactDamageMul (float, default 1)
anvil, anvilpart, barrel, barrelcactus, bloomerychimney, bonyremains, bonysoil, carcass, chair, chandelier, cheese, churn, clayplanter, coalpile, dirtygravel, displaycase, drycarcass, egg, flowerpot, gravel, groundstorage, ingotmold, knappingsurface, lightningrod, looseboulders, looseflints, loosegears, looseores, loosestick, loosestones, lootvessel, metal, metalpartpile, muddygravel, oillamp, omoktabletop, pan, pie, quern, sand, seashell, sieve, sludgygravel, snowlayer, stonecoffinlid, storagevessel, table, talldisplaycase, toolmold, wateringcan, woodbucket
WrenchOrientable
  • hideInteractionHelpInSurvival (bool, default: false)
  • baseCode (string)
banner, brickslabs, brickstairs, carvedlog, chute, clayshinglelabs, clayshinglestairs, clutter, cobblestoneslab, cobblestonestairs, debarkedlog, glassslab, jonas, log, mudbrickslab, planks, plankslab, plankstairs, plaster, polishedrockslab, quartzpillar, quartzslab, quartzstairs, stonebrickslab, stonebrickstairs, stonepathstairs
WorldEditFixGhostBlockPlace - -
Icon Sign.png

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.


blockmaterial
string The blocks material. Amongst others, it will determine how quickly a specific tool can mine it.
Json:block:material
resistance
How many seconds it takes to break the block (excluding speed mining bonus). Decimal numbers are allowed.
creativeinventory
arrays In which creative inventory tabs the block should be visible in.
Rendering
renderpass
string (of enum) opaque Determines how the block will be drawn.
opaque
0 Used for solid blocks with no half transparency.
opaquenocull
1 Used for non-solid single faced blocks, such as tall grass.
transparent
2 Use for solid halftransparent blocks, such as glass
liquid
3 Used for liquids, produces waves.
topsoil
4 Used for grass covered blocks. Allows for a smooth transition from grass to soil, while still allowing climate tinting of grass.
shape
shape For the json drawtype, the shape definition of the block as shown in the world, dropped on the ground or held in hand.
base
The path to the shape json file, the base dir is assets/shapes/.
rotateX
float 0
rotateY
float 0
rotateZ
float 0
shapeinventory
shape For the json drawtype, the shape definition of the block as shown in the players inventory.
base
The path to the shape json file, the base dir is assets/shapes/.
rotateX
float 0
rotateY
float 0
rotateZ
float 0
ambientocclusion
boolean true If ambient occlusion will be applied to the block.
drawtype
string (of enum) cube Determines how the block is tesselated, select JSON for being able to use custom JSON Models. The other values are hardcoded methods of tesselating the block. Check Drawtypes for a full list.
blockLayer_1
0
blockLayer_2
1
blockLayer_3
2
blockLayer_4
3
blockLayer_5
4
blockLayer_6
5
blockLayer_7
6
json
7 Will draw a json model.
empty
8 Nothing will be drawn.
cube
9 Draws an ordinary cube.
cross
10
transparent
11
liquid
12
crossandsnowlayer
13
textures
key: direction, value: texture The texture definitions for the block as seen in the world, when dropped on the ground or held in the hand.
base


overlays


alternates
The dictionary contains multiple named textures. Different tessellators expect different texture names. Most tessellators accept the special "all" alias to set all textures at once. Default example (glass):
textures: {
		all: { base: "block/glass" },
	}
Using variantgroups (rock):
textures: {
		all: {base: "block/stone/rock/{rock}" },
	}

There are a few aliases that set multiple textures at the same time:

  • all - sets all textures for tessellators that support the alias
  • sides - "west", "east", "north", "south", "up", and "down"
  • horizontals - "west", "east", "north", and "south"
  • verticals - "up" and "down"
  • westeast - "west" and "east"
  • northsouth - "north" and "south"

For example, hay block uses two aliases:

textures: {
		horizontals: { base: "block/hay/{type}-side" },
		verticals: { base: "block/hay/{type}-top" },
	},
There are many options to rotate textures, combine them, and randomize the textures by block location.
texturesinventory
key: direction, value: texture The texture definitions for the block as seen in the player inventory. Overrides the textures definition if set.
sideopaque
key: direction, value: boolean true Determines if given block face is fully opaque. If yes, the opposite face of the adjacent block will not be drawn for efficiency reasons.
all

east

west

up

down

north

south
sidesolid
key: direction, value: boolean true Determins if given block side is solid. If true, other blocks like torches can be attached to it
all

east

west

up

down

north

south
Sound
sounds
key: string, value: string The sounds to be played when a player interacts with this block.
place
player/build Sound to played when placing this block.
walk
walk/default Sound to played when walking on this block.
break
player/destruct Sound to played when breaking this block.
hit
- Currently unused.
inside
- Sound to played when moving inside block (only works for blocks that have no collisionbox, naturally).