Json:block:worldvariantgroups: Difference between revisions

From Vintage Story Wiki
Document loadFromPropertiesCombine
m (Add the modding navbox)
(Document loadFromPropertiesCombine)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
The world properties are stored in the <code>assets/survival/worldproperties</code> folder. They are used to help create variant groups. Instead of directly specifying every state in the variant group, the states can be loaded from a world property. The <code>states</code> key can still be optionally added to the variant group to specify additional states.
The world properties are stored in the <code>assets/survival/worldproperties</code> folder. They are used to help fill in the [[Modding:Registry_Object_JSON_Parsing#Enumerating_variants|variantgroups]] field. Instead of directly specifying every state in the variant group, the states can be loaded from a world property through the <code>loadFromProperties</code> key. The states from multiple world properties can be added with the <code>loadFromPropertiesCombine</code> key, which takes an array of strings. The <code>states</code> 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. <code>north</code>, <code>east</code>, <code>south</code>, and <code>west</code> are loaded from the <code>abstract/horizontalorientation</code> world property. <code>up</code> is added to the list of states.
For example, the following creates a variant group named orientation. It contains 5 states. <code>north</code>, <code>east</code>, <code>south</code>, and <code>west</code> are loaded from the <code>abstract/horizontalorientation</code> world property. <code>up</code> is added to the list of states.
Line 8: Line 8:
</syntaxhighlight>
</syntaxhighlight>


Unwanted variant states can be filtered out with the <code>skipVariants</code> option at the top level of the block.
Unwanted variant states can be [[Modding:Registry_Object_JSON_Parsing#Filtering_out_variants|filtered]] out with the <code>skipVariants</code> property. Or all states that do not match an expression can be filtered out with the <code>allowedVariants</code> property.


<table class="wikitable">
<table class="wikitable">
Line 21: Line 21:
   <tr>
   <tr>
     <td>abstract/coating</td>
     <td>abstract/coating</td>
<td style="font-style: italic;">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</td>
<td style="font-style: italic;">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</td>
   </tr>
   </tr>
   <tr>
   <tr>
Confirmedusers
261

edits