Json:block:worldvariantgroups: Difference between revisions

From Vintage Story Wiki
Update links to point to Modding:Registry_Object_JSON_Parsing
(fix link)
(Update links to point to Modding:Registry_Object_JSON_Parsing)
Line 1: Line 1:
The world properties are stored in the <code>assets/survival/worldproperties</code> folder. They are used to help fill in the [[Modding:Block_Json_Properties#p_variantgroups|variantgroups]] field. 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. 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 [[Modding:Block_Json_Properties#p_skipVariants|skipVariants]] block attribute. Or all states that do not match an expression can be filtered out with the [[Modding:Block_Json_Properties#p_allowedVariants|allowedVariants]] block attribute.
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">
Confirmedusers
261

edits