Modding:Basic Block: Difference between revisions

From Vintage Story Wiki
No edit summary
No edit summary
Line 15: Line 15:
We will add a gold block to the game using this texture: [[File:Gold block.png]].
We will add a gold block to the game using this texture: [[File:Gold block.png]].


Now we need to create the following folders inside our workspace<code>assets\mygoldblock\textures\blocks\</code>. Rename the texture to <code>mygoldtexture.png</code> and paste it into the <code>texture</code> folder.
Now we need to create the following folders inside our workspace<code>assets/mygoldblock/textures/blocks/</code>. Rename the texture to <code>mygoldtexture.png</code> and paste it into the <code>texture</code> folder.


== The Block file ==
== The Block file ==
Line 50: Line 50:
* '''sounds''': The sounds to be played when placing/breaking or walking on the block. The prefix <code>game:</code> means this will use the vanilla assets, otherwise it will try to find those sounds inside your mod zip file.
* '''sounds''': The sounds to be played when placing/breaking or walking on the block. The prefix <code>game:</code> means this will use the vanilla assets, otherwise it will try to find those sounds inside your mod zip file.


Create another folder inside your workspace <code>assets\mygoldblock\blocktypes\</code> and save the json file in there.
Create another folder inside your workspace <code>assets/mygoldblock/blocktypes/</code> and save the json file in there.


== Naming the Block ==
== Naming the Block ==


To give the block a proper name, we need to create another json file and save it inside a new created folder <code>assets\mygoldblock\lang\en.json</code>
To give the block a proper name, we need to create another json file and save it inside a new created folder <code>assets/mygoldblock/lang/en.json</code>


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Line 211: Line 211:
In order to use a custom shape we need to create one first. The engine only supports the model/shape format that's created by the [[VS Model Creator]].
In order to use a custom shape we need to create one first. The engine only supports the model/shape format that's created by the [[VS Model Creator]].


Once you have created your own shape you need to export it as a json file, create a new folder <code>assets\myshinyblock\shapes\blocks\</code> and save the file in there. In our example we will use this model [http://wiki.vintagestory.at/images/3/38/Myshinymodel.json Myshinymodel.json] and move it to <code>assets\myshinyblock\shapes\blocks\myshinymodel.json</code>.
Once you have created your own shape you need to export it as a json file, create a new folder <code>assets/myshinyblock/shapes/blocks/</code> and save the file in there. In our example we will use this model [http://wiki.vintagestory.at/images/3/38/Myshinymodel.json Myshinymodel.json] and move it to <code>assets/myshinyblock/shapes/blocks/myshinymodel.json</code>.
Now we need to specify the model inside our block type json file.
Now we need to specify the model inside our block type json file.


Line 240: Line 240:
== Variants of Custom Shapes ==
== Variants of Custom Shapes ==


I created another model for the blocks in good condition ([http://wiki.vintagestory.at/images/f/fa/Myshinymodel1.json myshinymodel1.json]), because they should look more awesome, than the ones in used conditions. Therefore we need to copy the json file to <code>assets\myshinyblock\shapes\blocks\</code> as well.
I created another model for the blocks in good condition ([http://wiki.vintagestory.at/images/f/fa/Myshinymodel1.json myshinymodel1.json]), because they should look more awesome, than the ones in used conditions. Therefore we need to copy the json file to <code>assets/myshinyblock/shapes/blocks/</code> as well.


In order to specify the shape by type we need to remove the property <code>shape</code> and replace it with <code>shapebytype</code>:
In order to specify the shape by type we need to remove the property <code>shape</code> and replace it with <code>shapebytype</code>: