Modding:Block Json Properties: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
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'>
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).
Futhermore 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 190: Line 189:
     <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 201:
     <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>
Confirmedusers, editor, Administrators
886

edits