Confirmedusers
27
edits
Mirotworez (talk | contribs) (Marked this version for translation) |
m (add suggested pixel art programs) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 21: | Line 21: | ||
<!--T:8--> | <!--T:8--> | ||
We will use this texture for our block: [[File:Gold block.png]]. | We will use this texture for our block: [[File:Gold block.png]]. <br> | ||
(To create your own textures, you can use programs like [https://www.dotpdn.com/downloads/pdn.html/ PaintDotNet(free)], [https://www.piskelapp.com/ Piskel(free)], or [https://github.com/aseprite/aseprite/ Aseprite(free open source, or pay for precompiled)]) | |||
<!--T:9--> | <!--T:9--> | ||
Line 32: | Line 33: | ||
<!--T:12--> | <!--T:12--> | ||
Now you need to create a new json file in your editor (we recommend to use an editor with syntax highlighting, such as [https://notepad-plus-plus.org/ Notepad++] or Visual Studio). | Now you need to create a new json file in your editor (we recommend to use an editor with syntax highlighting, such as [https://notepad-plus-plus.org/ Notepad++] or [https://www.sublimetext.com/ Sublime Text]. If you are going to have many json files or some C#, then [https://code.visualstudio.com/ Visual Studio Code] is also a good pick). | ||
<!--T:13--> | <!--T:13--> | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { | ||
code: "mygoldblock", | "code": "mygoldblock", | ||
creativeinventory: { "general": ["*"] }, | "creativeinventory": { "general": ["*"] }, | ||
blockmaterial: "Stone", | "blockmaterial": "Stone", | ||
drawtype: "Cube", | "drawtype": "Cube", | ||
textures: { | "textures": { | ||
all: { base: "block/mygoldtexture" } | "all": { "base": "block/mygoldtexture" } | ||
}, | }, | ||
resistance: 3.5, | "resistance": 3.5, | ||
sounds: { | "sounds": { | ||
"place": "game:block/anvil", | "place": "game:block/anvil", | ||
"walk": "game:walk/stone" | "walk": "game:walk/stone" | ||
Line 113: | Line 114: | ||
Now we need to add those new textures to the json file. | Now we need to add those new textures to the json file. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
textures: { | "textures": { | ||
all: { | "all": { | ||
base: "block/mygoldtexture", | "base": "block/mygoldtexture", | ||
alternates: [{base: "block/mygoldtexture1" }, {base: "block/mygoldtexture2" }, {base: "block/mygoldtexture3" }], | "alternates": [{"base": "block/mygoldtexture1" }, {"base": "block/mygoldtexture2" }, {"base": "block/mygoldtexture3" }], | ||
}, | }, | ||
}, | }, | ||
Line 146: | Line 147: | ||
Now we need to change a few things in our json file. We can add all kinds of different groups, but for now we keep it simple. We are adding group called <code>type</code>, with the states <code>gold</code> and <code>iron</code>. You can use any group code you want. | Now we need to change a few things in our json file. We can add all kinds of different groups, but for now we keep it simple. We are adding group called <code>type</code>, with the states <code>gold</code> and <code>iron</code>. You can use any group code you want. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
variantgroups: [ | "variantgroups": [ | ||
{ code: "type", states: ["gold", "iron"] } | { "code": "type", "states": ["gold", "iron"] } | ||
], | ], | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 157: | Line 158: | ||
<!--T:42--> | <!--T:42--> | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
texturesbytype: { | "texturesbytype": { | ||
"*-gold": { | "*-gold": { | ||
all: { | "all": { | ||
base: "block/mygoldtexture", | "base": "block/mygoldtexture", | ||
alternates: [{base: "block/mygoldtexture1" }, {base: "block/mygoldtexture2" }, {base: "block/mygoldtexture3" }], | "alternates": [{"base": "block/mygoldtexture1" }, {"base": "block/mygoldtexture2" }, {"base": "block/mygoldtexture3" }], | ||
}, | }, | ||
}, | }, | ||
"*-iron": { | "*-iron": { | ||
all: { | "all": { | ||
base: "block/myirontexture", | "base": "block/myirontexture", | ||
alternates: [{base: "block/myirontexture1" }, {base: "block/myirontexture2" }, {base: "block/myirontexture3" }], | "alternates": [{"base": "block/myirontexture1" }, {"base": "block/myirontexture2" }, {"base": "block/myirontexture3" }], | ||
}, | }, | ||
} | } | ||
Line 181: | Line 182: | ||
<!--T:45--> | <!--T:45--> | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
textures: { | "textures": { | ||
all: { | "all": { | ||
base: "block/my{type}texture", | "base": "block/my{type}texture", | ||
alternates: [{base: "block/my{type}texture1" }, {base: "block/my{type}texture2" }, {base: "block/my{type}texture3" }], | "alternates": [{"base": "block/my{type}texture1" }, {"base": "block/my{type}texture2" }, {"base": "block/my{type}texture3" }], | ||
}, | }, | ||
}, | }, | ||
Line 193: | Line 194: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { | ||
code: "myshinyblock", | "code": "myshinyblock", | ||
creativeinventory: { "general": ["*"] }, | "creativeinventory": { "general": ["*"] }, | ||
variantgroups: [ | "variantgroups": [ | ||
{ code: "type", states: ["gold", "iron"] } | { "code": "type", "states": ["gold", "iron"] } | ||
], | ], | ||
blockmaterial: "Stone", | "blockmaterial": "Stone", | ||
drawtype: "cube", | "drawtype": "cube", | ||
textures: { | "textures": { | ||
all: { | "all": { | ||
base: "block/my{type}texture", | "base": "block/my{type}texture", | ||
alternates: [{base: "block/my{type}texture1" }, {base: "block/my{type}texture2" }, {base: "block/my{type}texture3" }], | "alternates": [{"base": "block/my{type}texture1" }, {"base": "block/my{type}texture2" }, {"base": "block/my{type}texture3" }], | ||
}, | }, | ||
}, | }, | ||
resistance: 3.5, | "resistance": 3.5, | ||
sounds: { | "sounds": { | ||
"place": "game:block/anvil", | "place": "game:block/anvil", | ||
"walk": "game:walk/stone" | "walk": "game:walk/stone" | ||
Line 224: | Line 225: | ||
<!--T:50--> | <!--T:50--> | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
variantgroups: [ | "variantgroups": [ | ||
{ code: "type", states: ["gold", "iron"] }, | { "code": "type", "states": ["gold", "iron"] }, | ||
{ code: "condition", states: ["good", "used"]} | { "code": "condition", "states": ["good", "used"]} | ||
], | ], | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 235: | Line 236: | ||
<!--T:52--> | <!--T:52--> | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
texturesbytype: { | "texturesbytype": { | ||
"*-good": { | "*-good": { | ||
all: { | "all": { | ||
base: "block/my{type}texture", | "base": "block/my{type}texture", | ||
}, | }, | ||
}, | }, | ||
"*-used": { | "*-used": { | ||
all: { | "all": { | ||
base: "block/my{type}texture", | "base": "block/my{type}texture", | ||
alternates: [{base: "block/my{type}texture1" }, {base: "block/my{type}texture2" }, {base: "block/my{type}texture3" }], | "alternates": [{"base": "block/my{type}texture1" }, {"base": "block/my{type}texture2" }, {"base": "block/my{type}texture3" }], | ||
}, | }, | ||
}, | }, | ||
Line 268: | Line 269: | ||
Therefore we will change the drawtype from <code>cube</code> to <code>json</code>: | Therefore we will change the drawtype from <code>cube</code> to <code>json</code>: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
drawtype: "json", | "drawtype": "json", | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 274: | Line 275: | ||
and the shape to <code>myshinymodel</code> | and the shape to <code>myshinymodel</code> | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
shape: { base: "block/myshinymodel" }, | "shape": { base: "block/myshinymodel" }, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 280: | Line 281: | ||
Although this would be enough theoretically, we also should determine this block as being non-solid, to prevent graphical glitches. | Although this would be enough theoretically, we also should determine this block as being non-solid, to prevent graphical glitches. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
sidesolid: { | "sidesolid": { | ||
all: "false" | "all": "false" | ||
}, | }, | ||
sideopaque: { | "sideopaque": { | ||
all: "false" | "all": "false" | ||
}, | }, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 302: | Line 303: | ||
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>: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
shapebytype: { | "shapebytype": { | ||
"*-good": { | "*-good": { | ||
base: "block/myshinymodel1", | "base": "block/myshinymodel1", | ||
}, | }, | ||
"*-used": { | "*-used": { | ||
base: "block/myshinymodel", | "base": "block/myshinymodel", | ||
}, | }, | ||
}, | }, |