This assumes that you know how to add new nodes, and that you understand how to code stuff.
Example:
(This is the code for the leaves in my minitrees mod)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_node('minitrees:leaves', {
description =("Mini Leaves"),
drawtype = "nodebox",
tiles = {
'leaves.png',
},
selection_box = {
type = "fixed",
fixed = { -1/3, -1/3, -1/3, 1/3, 1/3, 1/3 }
},
node_box = {
type = "fixed",
fixed = {
{ -1/3, -0.5, -1/3, 1/3, 0.5, 1/3 },
{ -0.5, -1/3, -1/3, -1/3, 1/3, 1/3 },
{ 1/3, -1/3, -1/3, 0.5, 1/3, 1/3 },
{ -1/3, -1/3, 1/3, 1/3, 1/3, 0.5 },
{ -1/3, -1/3, -0.5, 1/3, 1/3, -1/3 },
},
},
sunlight_propagates = true,
paramtype = "light",
walkable = true,
groups = { snappy = 3, choppy = 3 },
sounds = default.node_sound_wood_defaults(),
})
All nodes have to be made of one rectangular prism or multiple rectanglular prisms.
This is the part that makes the shape of it:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
selection_box = {
type = "fixed",
fixed = { -1/3, -1/3, -1/3, 1/3, 1/3, 1/3 }
},
node_box = {
type = "fixed",
fixed = {
{ -1/3, -0.5, -1/3, 1/3, 0.5, 1/3 },
{ -0.5, -1/3, -1/3, -1/3, 1/3, 1/3 },
{ 1/3, -1/3, -1/3, 0.5, 1/3, 1/3 },
{ -1/3, -1/3, 1/3, 1/3, 1/3, 0.5 },
{ -1/3, -1/3, -0.5, 1/3, 1/3, -1/3 },
},
},
Each line of numbers stands for each rectangular prism in the node. The numbers in each line stand for (in this order):
{ -x, -y, -z, x, y, z }
or, more simply:
{ left side, bottom, back, right side, top, front }
They are measured from the middle of the nodebox (0), and the edge of the nodebox is 0.5 or 1/2 (one half)
If the middle of the nodebox is inside the node, then the first 3 coordinates will be negitive, and the last 3 will be positive.
Here is a picture:
You can use as many rectangular prisms as you want, but it is better to use fewer.