Modding:Basic Block: Difference between revisions

From Vintage Story Wiki
Line 99: Line 99:
== Variants ==
== Variants ==


Gold is the best, but iron is awesome too ... so what shall will do? Let's add some variants to this block, because we all love iron.
Gold is the best, but iron is awesome too ... so what shall will do? Let's add another variant of this block, because we all love iron.
You could duplicate the blocktype file and rename silver to gold in all the places, or you can simply add another variant to the existing blocktype.
 


=== Variantgroup: Type ===
=== Variantgroup: Type ===
Line 113: Line 115:


The next thing we need to do is set textures by type. So we remove our <code>texture</code> property and replace it with a new property <code>texturesbytype</code>, which will allow us to set different textures for each type.
The next thing we need to do is set textures by type. So we remove our <code>texture</code> property and replace it with a new property <code>texturesbytype</code>, which will allow us to set different textures for each type.


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Line 130: Line 133:
},
},
</syntaxhighlight>
</syntaxhighlight>
You can also use the more compact form. The placeholder {type} will automatically be replaced by the individual variants code.
<syntaxhighlight lang="json">
texture: {
all: {
base: "metal/my{type}texture",
alternates: [{base: "metal/my{type}texture1" }, {base: "metal/my{type}texture2" }, {base: "metal/my{type}texture3" }],
},
},
</syntaxhighlight>


Every group will be added after each other to the blocks name <code>myblockname-mygroup-mysecondgroup</code>. In our example the block name is ignorable so its replaced by <code>*</code>.
Every group will be added after each other to the blocks name <code>myblockname-mygroup-mysecondgroup</code>. In our example the block name is ignorable so its replaced by <code>*</code>.
Confirmedusers, Bureaucrats, editor, Administrators
1,779

edits