Modding:Block Json Properties: Difference between revisions

From Vintage Story Wiki
No edit summary
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
== Overview ==
== Overview ==
An incomplete list of all available properties
A complete list of all available properties


<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
   <tr style='background-color: gray;'>
   <tr>
     <th width='300' align='left'>Property</th>
     <th width='300' align='left'>Property</th>
     <th width='200' align='left'>Type</th>
     <th width='200' align='left'>Type</th>
Line 17: Line 17:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Core (no byType available)</b></td>
     <td colspan="4" class="propHeader"><b>Core (no byType available)</b></td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 28: Line 28:
     <td scope="row"><div class="tt" data-tt-id="p_code_info" data-tt-parent="p_code" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_code_info" data-tt-parent="p_code" data-invisible="true"></div></td>
     <td colspan="3">
     <td colspan="3">
A '''domain prefix''' will be added dynamically depending on the location of the file. Every mod and the VintageStory itself have a unique prefix.
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 '''<code>stone</code>''' would turn into '''<code>game:stone</code>'''.  
For example the code '''<code>stone</code>''' turns into '''<code>game:stone</code>'''.  


The code identifier has to be unique, at least inside his domain, so in theory there can be equal identifiers with different domain prefixes.
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 [[Basic Modding#Domains|Domains]].
Find out more about [[Basic Modding#Domains|Domains]].
     </td>
     </td>
Line 51: Line 51:
     <td scope="row"><div class="tt" data-tt-id="p_variantgroups_info" data-tt-parent="p_variantgroups" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_variantgroups_info" data-tt-parent="p_variantgroups" data-invisible="true"></div></td>
     <td colspan="3">
     <td colspan="3">
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.
The variantgroups property allows you to define multiple variants of this block. All of them will have their unique pattern, which will be added to the block code.


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


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>:
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>. It's a good way to keep everything organized:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
variantgroups: [
variantgroups: [
Line 89: Line 89:
----
----


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


Let's take a look at a different example (flowerpot), which uses the <code>additive</code> combination mode:
Let's take a look at a different example (flowerpot), which uses the <code>additive</code> combination mode:
Line 104: Line 104:
The variants are <code>flowerpot-raw</code>, <code>flowerpot-empty</code>, <code>flowerpot-{all flowers}</code>, <code>flowerpot-{all mushrooms}</code> and <code>flowerpot-{all saplings}</code>.
The variants are <code>flowerpot-raw</code>, <code>flowerpot-empty</code>, <code>flowerpot-{all flowers}</code>, <code>flowerpot-{all mushrooms}</code> and <code>flowerpot-{all saplings}</code>.


Things might get clearer if we look at another example:
<code>Additive</code> mode could also be called separate, since it defines a variant separate from all the other groups:
 
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
variantgroups: [
variantgroups: [
Line 114: Line 115:


In this case, the result would be <code>same-raw</code>, <code>same-baked</code>, <code>different-raw</code>, <code>different-baked</code>, <code>red</code> and <code>green</code>
In this case, the result would be <code>same-raw</code>, <code>same-baked</code>, <code>different-raw</code>, <code>different-baked</code>, <code>red</code> and <code>green</code>
The <code>additive</code> combination means all states will be added as a separate variant.
     </td>
     </td>
   </tr>
   </tr>
Line 174: Line 173:
"*-south-*-closed-right": 180
"*-south-*-closed-right": 180
}
}
},
</syntaxhighlight>
Since Vintagestory v1.8 it is also possible to use the variantgroup as a placeholder:
<syntaxhighlight lang="json">
variantgroups: [
{ code: "type", states: ["normal", "bamboo"] },
],
textures: {
horizontals: { base: "block/hay/{type}-side" },
verticals: { base: "block/hay/{type}-top" },
},
},
</syntaxhighlight>
</syntaxhighlight>
Line 179: Line 189:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Specific</b></td>
     <td colspan="4" class="propHeader"><b>Specific</b></td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 190: Line 200:
     <td scope="row"><div class="tt" data-tt-id="p_class_info" data-tt-parent="p_class" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_class_info" data-tt-parent="p_class" data-invisible="true"></div></td>
     <td colspan="3">
     <td colspan="3">
A complete tutorial of how to create your own class can be found [[Advanced Blocks|here]].
It can be used to open guis or adding other extra functionality to the block. A complete tutorial of how to add your own class to the game can be found [[Advanced Blocks|here]].
</td>
</td>
   </tr>
   </tr>
Line 202: Line 212:
     <td scope="row"><div class="tt" data-tt-id="p_entityclass_info" data-tt-parent="p_entityclass" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_entityclass_info" data-tt-parent="p_entityclass" data-invisible="true"></div></td>
     <td colspan="3">
     <td colspan="3">
A complete tutorial of creating your own entityclass can be found [[Block Entity|here]].
A chest for example uses the BlockEntity to store the inventory. A tutorial of creating your own entityclass can be found [[Block Entity|here]].
</td>
</td>
   </tr>
   </tr>
Line 209: Line 219:
     <td>array of object</td>
     <td>array of object</td>
     <td>-</td>
     <td>-</td>
     <td>A behavior adds custom abilities such as falling block..</td>
     <td>A behavior adds custom abilities such as falling block.</td>
   </tr>
   </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_behaviors_info" data-tt-parent="p_behaviors" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_behaviors_info" data-tt-parent="p_behaviors" data-invisible="true"></div></td>
     <td colspan="3">
     <td colspan="3">
Here is an overview of all exisiting behaviors, if you want to create your own custom behavior you can read [[Adding Block Behavior]].
Here is an overview of most exisiting behaviors, if you want to create your own custom behavior you can read [[Adding Block Behavior]].
To see all of the current behaviors in the game see [[Json:block:behaviors|All Block Behaviors]]
{{:json:block:behavior}}
{{:json:block:behavior}}
</td>
</td>
Line 544: Line 555:
     <td>0 ... 255</td>
     <td>0 ... 255</td>
     <td>0</td>
     <td>0</td>
     <td>Basic glow level for all the blocks model elements.</td>
     <td>Causes the block to visually glow if Bloom is enabled. Basic glow level for all the blocks model elements.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 677: Line 688:
     <td>'''lastdrop'''</td>
     <td>'''lastdrop'''</td>
<td>false</td>
<td>false</td>
<td>If true and the quantity dropped is >=1 any subsequent drop will be ignored.</td>
<td>If true and the quantity dropped is >=1 any subsequent drop in the list will be ignored.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 734: Line 745:
'''''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.
'''''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.


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


<table class="wikitable mw-collapsible mw-collapsed">
<table class="wikitable mw-collapsible mw-collapsed">
Line 833: Line 844:
     <td>-</td>
     <td>-</td>
     <td>Particles that should spawn in regular intervals from this block.</td>
     <td>Particles that should spawn in regular intervals from this block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_particleproperties_info" data-tt-parent="p_particleproperties" data-invisible="true"></div></td>
    <td colspan="3">
{{:json:block:particle}}
</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 906: Line 923:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Common</b></td>
     <td colspan="4" class="propHeader"><b>Common</b></td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 997: Line 1,014:
     <td>key: string, value: object</td>
     <td>key: string, value: object</td>
     <td>-</td>
     <td>-</td>
     <td>Custom Attributes that's always assiociated with this item.</td>
     <td>Custom Attributes associated with this block.</td>
   </tr>
   </tr>
   <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 scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes" data-invisible="true"></div></td>
     <td colspan="3">
     <td colspan="3">
Extra attributes added to a block. Those are final and cannot be modified. It's a good way to keep things oragnized and and modifiable. The '''oreblastingbomb''' for example has attributes, which define its radius and type. These can be used by behaviors and blockentities:
Extra attributes added to a block. Those are final and cannot be modified. It's a good way to keep things organized and and modifiable. The '''oreblastingbomb''' for example has attributes, which define its radius and type. These can be used by behaviors and blockentities:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
     attributes: {
     attributes: {
        "blastRadius": { type: "Int", value: 4 },
"blastRadius": 4,
        "blastType": { type: "Int", value: 0 },
"blastType": 0,
    },
},
</syntaxhighlight>
</syntaxhighlight>
</td>
</td>
Line 1,021: Line 1,038:
     <td>integer</td>
     <td>integer</td>
     <td>-</td>
     <td>-</td>
     <td>The temperature at which it burns.</td>
     <td>The temperature at which it burns in degrees Celsius.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,027: Line 1,044:
     <td>decimal number</td>
     <td>decimal number</td>
     <td>-</td>
     <td>-</td>
     <td>For how long it burns.</td>
     <td>For how long it burns in seconds.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,033: Line 1,050:
     <td>integer</td>
     <td>integer</td>
     <td>500</td>
     <td>500</td>
     <td>How many degrees celsius it can resists before it ignites.</td>
     <td>How many degrees celsius it can resists before it ignites (not implemented yet).</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,039: Line 1,056:
     <td>integer</td>
     <td>integer</td>
     <td>-</td>
     <td>-</td>
     <td>How many degrees celsius it takes to smelt/transform this into another. Only used when put in a stove and Melted is set.</td>
     <td>How many degrees celsius it takes to smelt/transform this into another. Only used when put in a stove and SmeltedStack is set.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,069: Line 1,086:
     <td>boolean</td>
     <td>boolean</td>
     <td>true</td>
     <td>true</td>
     <td>If set, the block/item is smeltable in a furnace and this is the resulting itemstack once the MeltingPoint has been reached for the supplied duration.</td>
     <td>If set to true, the block/item requires a smelting/cooking/baking container such as the Crucible. If false, it can be directly baked/melted without smelting/cooking/baking container.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,082: Line 1,099:
</syntaxhighlight>
</syntaxhighlight>


Futhermore it can be used to define smelting processes. An example would be an '''ingotmold''' which turns into an ingotmold-burned:
Furthermore it can be used to define smelting processes. An example would be an '''ingotmold''' which turns into an ingotmold-burned:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
     combustiblePropsByType: {
     combustiblePropsByType: {
Line 1,121: Line 1,138:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Rendering</b></td>
     <td colspan="4" class="propHeader"><b>Rendering</b></td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,127: Line 1,144:
     <td>key: string, value: object</td>
     <td>key: string, value: object</td>
     <td></td>
     <td></td>
     <td>The texture definitions for the block as seen in the world, when dropped on the ground or held in the hand.</td>
     <td>The texture definitions for the block as seen in the world, when dropped on the ground or held in the hand. Within a mod, to refer to a texture from the base game, prefix the path with "game:" (i.e. base: "game:path/to/texture") </td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,341: Line 1,358:
     <td></td>
     <td></td>
     <td>2</td>
     <td>2</td>
     <td>Culls all faces that are adjacent to opaque faces and faces adjacent to blocks of the same id.</td>
     <td>Culls all faces that are adjacent to opaque faces and faces adjacent to blocks of the same id (Example usage: Ice blocks).</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,347: Line 1,364:
     <td></td>
     <td></td>
     <td>3</td>
     <td>3</td>
     <td>Culls all faces that are adjacent to opaque faces and the bottom, east or south faces adjacent to blocks of the same id. This causes to still leave one single face inbetween instead of 2, eliminating any z-fighting.</td>
     <td>Culls all faces that are adjacent to opaque faces and the bottom, east or south faces adjacent to blocks of the same id. This causes to still leave one single face in between instead of 2, eliminating any z-fighting.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,353: Line 1,370:
     <td></td>
     <td></td>
     <td>4</td>
     <td>4</td>
     <td>Same as Merge but checks for equal material.</td>
     <td>Same as Merge but checks for equal material (Example usage: Plain glass and all colored glass blocks).</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,359: Line 1,376:
     <td></td>
     <td></td>
     <td>5</td>
     <td>5</td>
     <td>Same as Collapse but checks for equal material.</td>
     <td>Same as Collapse but checks for equal material (Example usage: All leaves blocks).</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,441: Line 1,458:
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_lighthsv" data-tt-parent="root">LightHsv</div></td>
     <td scope="row"><div class="tt" data-tt-id="p_lighthsv" data-tt-parent="root">LightHsv</div></td>
     <td>array of 0 ... 255</td>
     <td>byte array with 3 elements. See http://tyron.at/vs/vslightwheel.html for valid values</td>
     <td>-</td>
     <td>-</td>
     <td>For light emitting blocks: hue, saturation and brightness value.</td>
     <td>For light emitting blocks: hue, saturation and brightness value.</td>
Line 1,494: Line 1,511:
   </tr>
   </tr>
</table>
</table>
{{Navbox/modding|Vintage Story}}
42

edits