[Mod] NonCubic Blocks Mod [1.4] [noncubic]

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by Don » Post

Nodeboxes help keep the cubic look so in a way they are good. They are also easier to learn how to make. The nodebox editor makes it really easy. The nodebox editor also gives the option to export to mesh. This makes it easier to make mesh nodes without learning to use blender.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Nathan.S
Member
Posts: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by Nathan.S » Post

Correct, a box has a top, bottom, left, right, front, and back so yes, six faces, each face is two triangles so yes you get twelve polys for every nodebox.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
jp
Banned
Posts: 947
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith
Location: France

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by jp » Post

HulkSmashRocks wrote:Nodeboxes are 6 faces, not 4 though?
Oops, indeed - was tired. Corrected ;) And yes, a nodebox is a mesh with 12 triangles and 8 vertices. Now make the total with 50 nodeboxes in a model, which have been placed thousands of times in a map... Rather scary, isn't it ?

So to sum it up : if you're making a primitive shape, a nodebox model is OK. But if you're trying to make a realistic shape and you autistically stick with the nodeboxes, you should feel ashamed to offer such inefficient and vulgar turd to your users just for avoiding a couple of hours of learning Blender and reaching the excellence. No pain, no gain.

Not My Real Account
New member
Posts: 2
Joined: Sat Aug 13, 2016 00:29

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by Not My Real Account » Post

I'm unable to craft the milling machine. Has the recipe changed? I'm attempting to craft in in my inventory with (from left to right) a stone brick block, stick, and stone brick block on the top row, three wood planks in the middle row, and a stick, an empty space, and a stick on the bottom row.

KCoombes
Member
Posts: 427
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt
Location: SW Florida, USA

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by KCoombes » Post

Try this:

output = 'noncubic:mill',
recipe = {
{'default:cobble', 'default:stick', 'default:cobble'},
{'default:wood', 'default:wood', 'default:wood'},
{'default:stick', "", 'default:stick'},

User avatar
MineYoshi
Member
Posts: 5373
Joined: Wed Jul 08, 2015 13:20
Contact:

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by MineYoshi » Post

KCoombes wrote:Try this:

output = 'noncubic:mill',
recipe = {
{'default:cobble', 'default:stick', 'default:cobble'},
{'default:wood', 'default:wood', 'default:wood'},
{'default:stick', "", 'default:stick'},
Exactly This:

CobbleStone - Stick - CobbleStone
Wood - Wood - Wood
Stick - Empty - Stick
Have a nice day! :D

Not My Real Account
New member
Posts: 2
Joined: Sat Aug 13, 2016 00:29

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by Not My Real Account » Post

MineYoshi wrote:
KCoombes wrote:Try this:

output = 'noncubic:mill',
recipe = {
{'default:cobble', 'default:stick', 'default:cobble'},
{'default:wood', 'default:wood', 'default:wood'},
{'default:stick', "", 'default:stick'},
Exactly This:

CobbleStone - Stick - CobbleStone
Wood - Wood - Wood
Stick - Empty - Stick
I have tried the recipe that was suggested here, using both planks and "tree" in place of "wood," and still have not succeeded in crafting the milling machine. Does this have something to do with the version of Minetest I am running (0.4.14), or perhaps I have not installed the correct version of the mod? Also, how do I craft doors with this mod?

KCoombes
Member
Posts: 427
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt
Location: SW Florida, USA

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by KCoombes » Post

Not My Real Account wrote:-snip-
I have tried the recipe that was suggested here, using both planks and "tree" in place of "wood," and still have not succeeded in crafting the milling machine. Does this have something to do with the version of Minetest I am running (0.4.14), or perhaps I have not installed the correct version of the mod? Also, how do I craft doors with this mod?
I have no problems running this mod with 0.4.14. There are no doors in this mod.

User avatar
Drachenbauer32
Member
Posts: 105
Joined: Wed Aug 28, 2019 18:11

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by Drachenbauer32 » Post

Hello

you made the inner edge slopes different than the rest:
You have a long list of fixed values in the "node_box"-property.

so they do not react.to the detail_level.

I found a way to calculate them like the others:

for the upright one:

Code: Select all

    local detail = detail_level

    local slopebox_1 = {}
    for i = 0, detail - 1 do
        slopebox_1[i + 1] = {
            -0.5, ( i / detail ) - 0.5, ( i / detail ) - 0.5,
            0.5, ( ( i + 1 ) / detail ) - 0.5, 0.5
        }
    end

    local slopebox_2 = {}
    for i = 1, detail - 1 do
        slopebox_2[i] = {
            ( i / detail ) - 0.5, ( i / detail ) - 0.5, -0.5,
            0.5, ( ( i + 1 ) / detail ) - 0.5, 0.5
        }
    end

    local slopeinneredgebox = {}
    for i = 0, #slopebox_1 do
        slopeinneredgebox_1[i + 1] = slopebox_1[i + 1]
    end
    for i = 0, #slopebox_2 do
        slopeinneredgebox_2[i + 1 + #slopebox_1] = slopebox_2[i + 1]
    end
and for the upside down one:

Code: Select all

    local detail = detail_level

    local slopeupsdwnbox_1 = {}
    for i = 0, detail - 1 do
        slopeupsdwnbox_1[i + 1] = {
            -0.5, -1 * ( ( ( i + 1 ) / detail ) - 0.5 ), ( i / detail ) - 0.5,
            0.5, -1 * ( ( i / detail ) - 0.5 ), 0.5
        }
    end

    local slopeupsdwnbox_2 = {}
    for i = 1, detail - 1 do
        slopeupsdwnbox_2[i] = {
            ( i / detail ) - 0.5, -1 * ( ( ( i + 1 ) / detail ) - 0.5 ), -0.5,
            0.5, -1 * ( ( i / detail ) - 0.5 ), 0.5
        }
    end

    local slopeupdwninneredgebox = {}
    for i = 0, #slopeupdwnbox_1 do
        slopeupdwninneredgebox[i + 1] = slopeupdwnbox_1[i + 1]
    end
    for i = 0, #slopeupdwnbox_2 do
        slopeupdwninneredgebox[i + 1 + #slopeupdwnbox_1] = slopeupdwnbox_2[i + 1]
    end
at first it calculates a nodebox list identical to the normal (or upside down) slope.
then it calculates a seccond list, rotated 90° arounf the vertical axis and than it fills both lists into a third list, that goes into the "node_box" property.

another tip:
you have 10 wall elements (name : "element" with the name of it´s shape)
in their "node_box" properties change 0.3 to 0.3125 and -0.3 to -0.3125 to make the walls exact 10 texture-pixels thick.
For the "stick" change 0.15 to 0.125 and -0.15 to -0.125 and it´s base-square fit´s exact 4x4 texture-pixels.

And i´m looking for a way to fix a little issue with the cylinders and sphere:
the last nodebox for them is invisible, because it´s size in one direction is 0.
So they don´t touch the neighbor-node on this side (for the horizontal clynder and the sphere it´s below them and for the upright cylinder it´s one side).

They need one more layer of the maximum whide
Last edited by Drachenbauer32 on Thu Oct 31, 2019 21:50, edited 8 times in total.

User avatar
Drachenbauer32
Member
Posts: 105
Joined: Wed Aug 28, 2019 18:11

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by Drachenbauer32 » Post

Now i found the solution for the cylinders and the sphere:

Code: Select all

    local detail = detail_level
    local sehne

    local cylbox = {}
    for i = 1, detail do
        if i <= detail / 2 then
            sehne = math.sqrt( 0.25 - ( ( ( i / detail ) - 0.5 ) ^ 2 ) )
        elseif i == detail / 2 + 0.5 then
            sehne = 0.5                   -- For uneven numbers at detail_level
        else
            sehne = math.sqrt( 0.25 - ( ( ( ( i - 1 ) / detail ) - 0.5 ) ^ 2 ) )
        end
        cylbox[i] = {
            ( ( i - 1 ) / detail ) - 0.5, -0.5, -sehne,
            (i / detail) - 0.5, 0.5, sehne
        }
    end
this is for the upright cylinder.

And for the other two it looks similar, just with their different nodebox-adding-line at the end of the code-snippet.

With this code they touch all sides of the surrounding node-cube.

For the pyramid (the half block high one) i made this:

Code: Select all

    local detail = detail_level

    local pyrabox = {}
    for i = 0, math.ceil ( detail / 2 ) - 1 do
        pyrabox[i + 1] = {
            ( i / detail ) - 0.5, ( i / detail ) - 0.5, ( i / detail ) - 0.5,
            0.5 - ( i / detail ), ( ( i + 1 ) / detail ) - 0.5, 0.5 - ( i / detail )
        }
    end
and for the curved edges i make this

Code: Select all

    local detail = detail_level
    local sehne

    local quartercyclebox = {}
    for i = 1, detail do
        if i > detail / 2 then
            sehne = math.sqrt(0.25 - ( ( ( ( i - 1 ) / detail ) - 0.5 ) ^ 2 ) )
        else
            sehne = 0.5
        end
        quartercyclebox[i] = {
            -0.5, ( ( i - 1 ) / detail ) - 0.5, -sehne,
            0.5, ( i / detail ) - 0.5, 0.5
        }
    end
So their box-layers have the same hight as at all other detail_level-sensitive nodes.
they are now all made from a stack of flat rectangle layers.
the thicknes of a layer is: full node size / deteil_level.

all code snippets in this post can use an uneven number as the detail_level, too.

a tip for all detail_level-sensitive nodes:
use the calculated list as the selection-box too and the player can move along the shape of the node and see the highlight-frames fitting the shape, if pointing it. .

I also found a way to write some calculations (wich use the detail-value 2x) simpler (that they now use the detail-value only 1x)
I turned "(i / detail) - 0.5 + (1 / detail)" into "( ( i + 1 ) / detail ) - 0.5" and
"(i / detail) - 0.5 - (1 / detail)" into "( ( i - 1 ) / detail ) - 0.5".
For each of theese two lines both variants have the same result, but the seccond variant looks simpler.

i norw placed them into the code-snippets, i placed in my two posts here.
Last edited by Drachenbauer32 on Thu Oct 31, 2019 22:01, edited 2 times in total.

User avatar
Drachenbauer32
Member
Posts: 105
Joined: Wed Aug 28, 2019 18:11

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by Drachenbauer32 » Post

Here is now the whoole code with all my modifications on the existing nodes.:

Code: Select all

-- NonCubic Blocks MOD v1.4
------------ by yves_de_beck

-- HERE YOU CAN CHANGE THE DETAIL-LEVEL:
----------------------------------------
detail_level = 16

-- HERE YOU CAN DE/ACTIVATE BACKGROUND FOR MILLING MENU:
--------------------------------------------------------
allow_menu_background = false

-- Includes:
------------
dofile(minetest.get_modpath("noncubic") .. "/mill.lua")

-- VAR DECLARATION:
-------------------
noncubic = {}

-- REGISTER NONCUBIC FORMS, CREATE MODELS AND RECIPES:
------------------------------------------------------

-- SLOPE
--------
function noncubic.register_slope(subname, description, images, recipeitem, groups)

    local detail = detail_level

    local slopebox = {}
    for i = 0, detail - 1 do
        slopebox[i + 1] = {
            -0.5, (i / detail) - 0.5, (i / detail) - 0.5,
            0.5, ((i + 1) / detail) - 0.5, 0.5
        }
    end

    minetest.register_node(":noncubic:slope_" .. subname, {
        description = description .. " Slope",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = slopebox,
        },
        node_box = {
            type = "fixed",
            fixed = slopebox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:slope_' .. subname .. ' 6',
        recipe = {
            { recipeitem, "", "" },
            { recipeitem, recipeitem, "" },
            { recipeitem, recipeitem, recipeitem },
        },
    })
    minetest.register_craft({
        output = 'noncubic:slope_' .. subname .. ' 6',
        recipe = {
            { "", "", recipeitem },
            { "", recipeitem, recipeitem },
            { recipeitem, recipeitem, recipeitem },
        },
    })
end


-- SLOPE Lying
----------------
function noncubic.register_slope_lying(subname, description, images, recipeitem, groups)

    local detail = detail_level

    local slopeboxlying = {}
    for i = 0, detail - 1 do
        slopeboxlying[i + 1] = {
            (i / detail) - 0.5, -0.5, (i / detail) - 0.5,
            ((i + 1) / detail) - 0.5, 0.5, 0.5
        }
    end

    minetest.register_node(":noncubic:slope_lying_" .. subname, {
        description = description .. " Slope Lying",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = slopeboxlying,
        },
        node_box = {
            type = "fixed",
            fixed = slopeboxlying,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:slope_lying_' .. subname .. ' 1',
        recipe = {
            { "", "", "" },
            { "", 'noncubic:slope_' .. subname, "" },
            { "", "", "" },
        },
    })
end

-- SLOPE EDGE
-------------
function noncubic.register_slope_edge(subname, description, images, recipeitem, groups)

    local detail = detail_level

    local slopeboxedge = {}
    for i = 0, detail - 1 do
        slopeboxedge[i + 1] = {
            (i / detail) - 0.5, (i / detail) - 0.5, (i / detail) - 0.5,
            0.5, ((i + 1) / detail) - 0.5, 0.5
        }
    end

    minetest.register_node(":noncubic:slope_edge_" .. subname, {
        description = description .. " Slope Edge",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = slopeboxedge,
        },
        node_box = {
            type = "fixed",
            fixed = slopeboxedge,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:slope_edge_' .. subname .. ' 3',
        recipe = {
            { "", "", "" },
            { recipeitem, "", "" },
            { recipeitem, recipeitem, "" },
        },
    })
    minetest.register_craft({
        output = 'noncubic:slope_edge_' .. subname .. ' 3',
        recipe = {
            { "", "", "" },
            { "", "", recipeitem },
            { "", recipeitem, recipeitem },
        },
    })
end

-- SLOPE INNER EDGE
-------------------
function noncubic.register_slope_inner_edge(subname, description, images, recipeitem, groups)

    local detail = detail_level

    local slopebox_1 = {}
    for i = 0, detail - 1 do
        slopebox_1[i + 1] = {
            -0.5, ( i / detail ) - 0.5, ( i / detail ) - 0.5,
            0.5, ( ( i + 1 ) / detail ) - 0.5, 0.5
        }
    end

    local slopebox_2 = {}
    for i = 1, detail - 1 do
        slopebox_2[i] = {
            ( i / detail ) - 0.5, ( i / detail ) - 0.5, -0.5,
            0.5, ( ( i + 1 ) / detail ) - 0.5, 0.5
        }
    end

    local slopeinneredgebox = {}
    for i = 0, #slopebox_1 do
        slopeinneredgebox[i + 1] = slopebox_1[i + 1]
    end
    for i = 0, #slopebox_2 do
        slopeinneredgebox[i + 1 + slopebox_1] = slopebox_2[i + 1]
    end

    minetest.register_node(":noncubic:slope_inner_edge_" .. subname, {
        description = description .. " Slope Inner Edge",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = slopeinneredgebox,
        },
        node_box = {
            type = "fixed",
            fixed = slopeinneredgebox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:slope_inner_edge_' .. subname .. ' 3',
        recipe = {
            { "", "", recipeitem },
            { recipeitem, "", "" },
            { recipeitem, recipeitem, "" },
        },
    })
    minetest.register_craft({
        output = 'noncubic:slope_inner_edge_' .. subname .. ' 3',
        recipe = {
            { recipeitem, "", "" },
            { "", "", recipeitem },
            { "", recipeitem, recipeitem },
        },
    })
end

-- SLOPE UPSIDE DOWN
--------------------
function noncubic.register_slope_upsdown(subname, description, images, recipeitem, groups)

    if subname == "dirt" then
        return
    end

    local detail = detail_level

    local slopeupsdwnbox = {}
    for i = 0, detail - 1 do
        slopeupsdwnbox[i + 1] = {
            -0.5, -1 * (((i + 1) / detail) - 0.5), (i / detail) - 0.5,
            0.5, -1 * ((i / detail) - 0.5), 0.5
        }
    end

    minetest.register_node(":noncubic:slope_upsdown_" .. subname, {
        description = description .. " Slope Upside Down",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = slopeupsdwnbox,
        },
        node_box = {
            type = "fixed",
            fixed = slopeupsdwnbox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:slope_upsdown_' .. subname .. ' 6',
        recipe = {
            { recipeitem, recipeitem, recipeitem },
            { "", recipeitem, recipeitem },
            { "", "", recipeitem },
        },
    })
    minetest.register_craft({
        output = 'noncubic:slope_upsdown_' .. subname .. ' 6',
        recipe = {
            { recipeitem, recipeitem, recipeitem },
            { recipeitem, recipeitem, "" },
            { recipeitem, "", "" },
        },
    })
end

-- SLOPE EDGE UPSIDE DOWN
-------------------------
function noncubic.register_slope_upsdown_edge(subname, description, images, recipeitem, groups)

    if subname == "dirt" then
        return
    end

    local detail = detail_level

    local slopeupsdwnboxedge = {}
    for i = 0, detail - 1 do
        slopeupsdwnboxedge[i + 1] = {
            (i / detail) - 0.5, -1 * (((i + 1) / detail) - 0.5), (i / detail) - 0.5,
            0.5, -1 * ((i / detail) - 0.5), 0.5
        }
    end

    minetest.register_node(":noncubic:slope_upsdown_edge_" .. subname, {
        description = description .. " Slope Upside Down Edge",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = slopeupsdwnboxedge,
        },
        node_box = {
            type = "fixed",
            fixed = slopeupsdwnboxedge,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:slope_upsdown_edge_' .. subname .. ' 3',
        recipe = {
            { "", recipeitem, recipeitem },
            { "", "", recipeitem },
            { "", "", "" },
        },
    })
    minetest.register_craft({
        output = 'noncubic:slope_upsdown_edge_' .. subname .. ' 3',
        recipe = {
            { recipeitem, recipeitem, "" },
            { recipeitem, "", "" },
            { "", "", "" },
        },
    })
end

-- SLOPE INNER EDGE UPSIDE DOWN
-------------------------------
function noncubic.register_slope_upsdown_inner_edge(subname, description, images, recipeitem, groups)

    if subname == "dirt" then
        return
    end

    local detail = detail_level

    local slopeupsdwnbox_1 = {}
    for i = 0, detail - 1 do
        slopeupsdwnbox_1[i + 1] = {
            -0.5, -1 * ( ( ( i + 1 ) / detail ) - 0.5 ), ( i / detail ) - 0.5,
            0.5, -1 * ( ( i / detail ) - 0.5 ), 0.5
        }
    end

    local slopeupsdwnbox_2 = {}
    for i = 1, detail - 1 do
        slopeupsdwnbox_2[i] = {
            ( i / detail ) - 0.5, -1 * ( ( ( i + 1 ) / detail ) - 0.5 ), -0.5,
            0.5, -1 * ( ( i / detail ) - 0.5 ), 0.5
        }
    end

    local slopeupsdwninneredgebox = {}
    for i = 0, #slopeupsdwnbox_1 do
        slopeupsdwninneredgebox[i + 1] = slopeupsdwnbox_1[i + 1]
    end
    for i = 0, #slopeupsdwnbox_2 do
        slopeupsdwninneredgebox[i + 1 + slopeupsdwnbox_1] = slopeupsdwnbox_2[i + 1]
    end

    minetest.register_node(":noncubic:slope_upsdown_inner_edge_" .. subname, {
        description = description .. " Slope Upside Down Inner Edge",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = slopeupsdwninneredgebox,
        },
        node_box = {
            type = "fixed",
            fixed = slopeupsdwninneredgebox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:slope_upsdown_inner_edge_' .. subname .. ' 3',
        recipe = {
            { "", recipeitem, recipeitem },
            { "", "", recipeitem },
            { recipeitem, "", "" },
        },
    })
    minetest.register_craft({
        output = 'noncubic:slope_upsdown_inner_edge_' .. subname .. ' 3',
        recipe = {
            { recipeitem, recipeitem, "" },
            { recipeitem, "", "" },
            { "", "", recipeitem },
        },
    })
end

-- PYRAMID
----------
function noncubic.register_pyramid(subname, description, images, recipeitem, groups)

    local detail = detail_level

    local pyrabox = {}
    for i = 0, math.ceil ( detail / 2 ) - 1 do
        pyrabox[i + 1] = {
            ( i / detail ) - 0.5, ( i / detail ) - 0.5, ( i / detail ) - 0.5,
            0.5 - ( i / detail ), ( ( i + 1 ) / detail ) - 0.5, 0.5 - ( i / detail )
        }
    end

    minetest.register_node(":noncubic:pyramid_" .. subname, {
        description = description .. " Pyramid",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = pyrabox,
        },
        node_box = {
            type = "fixed",
            fixed = pyrabox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:pyramid_' .. subname .. ' 3',
        recipe = {
            { "", "", "" },
            { "", recipeitem, "" },
            { recipeitem, "", recipeitem },
        },
    })
end

-- SPIKE
--------
function noncubic.register_spike(subname, description, images, recipeitem, groups)

    if subname == "dirt" then
        return
    end

    local detail = detail_level

    local spikebox = {}
    for i = 0, detail - 1 do
        spikebox[i + 1] = {
            ( i / detail / 2 ) - 0.5, (i / detail) - 0.5, ( i / detail / 2 ) - 0.5,
            0.5 - ( i / detail / 2 ), ( ( i + 1 ) / detail ) - 0.5, 0.5 - ( i / detail / 2 )
        }
    end

    minetest.register_node(":noncubic:spike_" .. subname, {
        description = description .. " Spike",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = spikebox,
        },
        node_box = {
            type = "fixed",
            fixed = spikebox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:spike_' .. subname .. ' 5',
        recipe = {
            { "", recipeitem, "" },
            { recipeitem, "", recipeitem },
            { recipeitem, "", recipeitem },
        },
    })
end

-- BLOCK ONE CURVED EDGE
------------------------
function noncubic.register_onecurvededge(subname, description, images, recipeitem, groups)

    local detail = detail_level
    local sehne

    local quartercyclebox = {}
    for i = 1, detail do
        if i > detail / 2 then
            sehne = math.sqrt(0.25 - ( ( ( ( i - 1 ) / detail ) - 0.5 ) ^ 2 ) )
        else
            sehne = 0.5
        end
        quartercyclebox[i] = {
            -0.5, ( ( i - 1 ) / detail ) - 0.5, -sehne,
            0.5, ( i / detail ) - 0.5, 0.5
        }
    end

    minetest.register_node(":noncubic:onecurvededge_" .. subname, {
        description = description .. " One Curved Edge Block",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = quartercyclebox,
        },
        node_box = {
            type = "fixed",
            fixed = quartercyclebox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:onecurvededge_' .. subname .. ' 8',
        recipe = {
            { "", recipeitem, recipeitem },
            { recipeitem, recipeitem, recipeitem },
            { recipeitem, recipeitem, recipeitem },
        },
    })
end

-- BLOCK TWO CURVED EDGE
------------------------
function noncubic.register_twocurvededge(subname, description, images, recipeitem, groups)

    local detail = detail_level
    local sehne

    local quartercyclebox2 = {}
    for i = 1, detail do
        if i > detail / 2 then
            sehne = math.sqrt( 0.25 - ( ( ( ( i - 1 ) / detail ) - 0.5 ) ^ 2 ) )
        else
            sehne = 0.5
        end
        quartercyclebox2[i] = {
            -sehne, ( ( i - 1 ) / detail ) - 0.5, -sehne,
            0.5, ( i / detail ) - 0.5, 0.5
        }
    end

    minetest.register_node(":noncubic:twocurvededge_" .. subname, {
        description = description .. " Two Curved Edge Block",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = quartercyclebox2,
        },
        node_box = {
            type = "fixed",
            fixed = quartercyclebox2,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:twocurvededge_' .. subname .. ' 3',
        recipe = {
            { "", "", "" },
            { 'noncubic:onecurvededge_' .. subname, "", "" },
            { 'noncubic:onecurvededge_' .. subname, 'noncubic:onecurvededge_' .. subname, "" },
        },
    })
end

-- CYLINDER
-----------
function noncubic.register_cylinder(subname, description, images, recipeitem, groups)

    local detail = detail_level
    local sehne

    local cylbox = {}
    for i = 1, detail do
        if i <= detail / 2 then
            sehne = math.sqrt( 0.25 - ( ( ( i / detail ) - 0.5 ) ^ 2 ) )
        elseif i == detail / 2 + 0.5 then
            sehne = 0.5                   -- For uneven numbers at detail_level
        else
            sehne = math.sqrt( 0.25 - ( ( ( ( i - 1 ) / detail ) - 0.5 ) ^ 2 ) )
        end
        cylbox[i] = {
            ( ( i - 1 ) / detail ) - 0.5, -0.5, -sehne,
            (i / detail) - 0.5, 0.5, sehne
        }
    end

    minetest.register_node(":noncubic:cylinder_" .. subname, {
        description = description .. " Cylinder",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = cylbox,
        },
        node_box = {
            type = "fixed",
            fixed = cylbox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:cylinder_' .. subname .. ' 6',
        recipe = {
            { recipeitem, recipeitem, "" },
            { recipeitem, recipeitem, "" },
            { recipeitem, recipeitem, "" },
        },
    })
    minetest.register_craft({
        output = 'noncubic:cylinder_' .. subname .. ' 1',
        recipe = {
            { "", "", "" },
            { "", 'noncubic:cylinder_horizontal_' .. subname, "" },
            { "", "", "" },
        },
    })
end

-- CYLINDER HORIZONTAL
----------------------
function noncubic.register_cylinder_horizontal(subname, description, images, recipeitem, groups)

    if subname == "dirt" then
        return
    end

    local detail = detail_level
    local sehne

    local cylbox_horizontal = {}
    for i = 1, detail do
        if i <= detail / 2 then
            sehne = math.sqrt( 0.25 - ( ( ( i / detail ) - 0.5 ) ^ 2 ) )
        elseif i == detail / 2 + 0.5 then
            sehne = 0.5                   -- For uneven numbers at detail_level
        else
            sehne = math.sqrt( 0.25 - ( ( ( ( i - 1 ) / detail ) - 0.5 ) ^ 2 ) )
        end
        cylbox_horizontal[i] = {
            -0.5, ((i - 1) / detail) - 0.5, -sehne,
            0.5, (i / detail) - 0.5, sehne
        }
    end

    minetest.register_node(":noncubic:cylinder_horizontal_" .. subname, {
        description = description .. " Cylinder Horizontal",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = cylbox_horizontal,
        },
        node_box = {
            type = "fixed",
            fixed = cylbox_horizontal,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:cylinder_horizontal_' .. subname .. ' 6',
        recipe = {
            { "", "", "" },
            { recipeitem, recipeitem, recipeitem },
            { recipeitem, recipeitem, recipeitem },
        },
    })
    minetest.register_craft({
        output = 'noncubic:cylinder_horizontal_' .. subname .. ' 1',
        recipe = {
            { "", "", "" },
            { "", 'noncubic:cylinder_' .. subname, "" },
            { "", "", "" },
        },
    })
end

-- SPHERE
---------
function noncubic.register_sphere(subname, description, images, recipeitem, groups)

    local detail = detail_level
    local sehne

    local spherebox = {}
    for i = 1, detail do
        if i <= detail / 2 then
            sehne = math.sqrt( 0.25 - ( ( ( i / detail ) - 0.5 ) ^ 2 ) )
        elseif i == detail / 2 + 0.5 then
            sehne = 0.5                   -- For uneven numbers at detail_level
        else
            sehne = math.sqrt( 0.25 - ( ( ( ( i - 1 ) / detail ) - 0.5 ) ^ 2 ) )
        end
        spherebox[i] = {
            -sehne, ( ( i - 1 ) / detail ) - 0.5, -sehne,
            sehne, ( i / detail ) - 0.5, sehne
        }
    end

    minetest.register_node(":noncubic:cylinder_sphere_" .. subname, {
        description = description .. " Sphere",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = spherebox,
        },
        node_box = {
            type = "fixed",
            fixed = spherebox,
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:cylinder_sphere_' .. subname .. ' 4',
        recipe = {
            { "", recipeitem, "" },
            { recipeitem, "", recipeitem },
            { "", recipeitem, "" },
        },
    })
end

-- ELEMENT STRAIGHT
-------------------
function noncubic.register_element_straight(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_straight_" .. subname, {
        description = description .. " Element Straight",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = { -0.3125, -0.5, -0.5, 0.3125, 0, 0.5 },
        },
        node_box = {
            type = "fixed",
            fixed = { -0.3125, -0.5, -0.5, 0.3125, 0, 0.5 },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_straight_' .. subname .. ' 12',
        recipe = {
            { "", recipeitem, "" },
            { "", recipeitem, "" },
            { "", recipeitem, "" },
        },
    })
end

-- ELEMENT EDGE
---------------
function noncubic.register_element_edge(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_edge_" .. subname, {
        description = description .. " Element Edge",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = {
                { 0.3125, -0.5, -0.3125, 0.5, 0, 0.3125 },
                { -0.3125, -0.5, -0.3125, 0.3125, 0, 0.5 },
            },
        },
        node_box = {
            type = "fixed",
            fixed = {
                { 0.3125, -0.5, -0.3125, 0.5, 0, 0.3125 },
                { -0.3125, -0.5, -0.3125, 0.3125, 0, 0.5 },
            },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_edge_' .. subname .. ' 10',
        recipe = {
            { recipeitem, recipeitem, recipeitem },
            { "", "", recipeitem },
            { "", "", recipeitem },
        },
    })
end

-- ELEMENT T
------------
function noncubic.register_element_t(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_t_" .. subname, {
        description = description .. " Element T",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = {
                { 0.3125, -0.5, -0.3125, 0.5, 0, 0.3125 },
                { -0.3125, -0.5, -0.5, 0.3125, 0, 0.5 },
            },
        },
        node_box = {
            type = "fixed",
            fixed = {
                { 0.3125, -0.5, -0.3125, 0.5, 0, 0.3125 },
                { -0.3125, -0.5, -0.5, 0.3125, 0, 0.5 },
            },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_t_' .. subname .. ' 8',
        recipe = {
            { "", "", "" },
            { recipeitem, recipeitem, recipeitem },
            { "", recipeitem, "" },
        },
    })
end

-- ELEMENT CROSS
----------------
function noncubic.register_element_cross(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_cross_" .. subname, {
        description = description .. " Element Cross",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = {
                { -0.5, -0.5, -0.3125, 0.5, 0, 0.3125 },
                { -0.3125, -0.5, -0.5, 0.3125, 0, 0.5 },
            },
        },
        node_box = {
            type = "fixed",
            fixed = {
                { -0.5, -0.5, -0.3125, 0.5, 0, 0.3125 },
                { -0.3125, -0.5, -0.5, 0.3125, 0, 0.5 },
            },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_cross_' .. subname .. ' 10',
        recipe = {
            { "", recipeitem, "" },
            { recipeitem, recipeitem, recipeitem },
            { "", recipeitem, "" },
        },
    })
end

-- ELEMENT END
--------------
function noncubic.register_element_end(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_end_" .. subname, {
        description = description .. " Element End",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = { -0.3125, -0.5, -0.3125, 0.3125, 0, 0.5 },
        },
        node_box = {
            type = "fixed",
            fixed = { -0.3125, -0.5, -0.3125, 0.3125, 0, 0.5 },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_end_' .. subname .. ' 8',
        recipe = {
            { "", "", "" },
            { "", recipeitem, "" },
            { "", recipeitem, "" },
        },
    })
end

-- ELEMENT STRAIGHT DOUBLE
--------------------------
function noncubic.register_element_straight_double(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_straight_double_" .. subname, {
        description = description .. " Element Straight Double",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = { -0.3125, -0.5, -0.5, 0.3125, 0.5, 0.5 },
        },
        node_box = {
            type = "fixed",
            fixed = { -0.3125, -0.5, -0.5, 0.3125, 0.5, 0.5 },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_straight_double_' .. subname .. ' 1',
        recipe = {
            { "", "", "" },
            { "", 'noncubic:element_straight_' .. recipeitem, "" },
            { "", 'noncubic:element_straight_' .. recipeitem, "" },
        },
    })
end

-- ELEMENT EDGE DOUBLE
----------------------
function noncubic.register_element_edge_double(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_edge_double_" .. subname, {
        description = description .. " Element Edge Double",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = {
                { 0.3125, -0.5, -0.3125, 0.5, 0.5, 0.3125 },
                { -0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.5 },
            },
        },
        node_box = {
            type = "fixed",
            fixed = {
                { 0.3125, -0.5, -0.3125, 0.5, 0.5, 0.3125 },
                { -0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.5 },
            },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_edge_double_' .. subname .. ' 1',
        recipe = {
            { "", "", "" },
            { "", 'noncubic:element_edge_' .. recipeitem, "" },
            { "", 'noncubic:element_edge_' .. recipeitem, "" },
        },
    })
end

-- ELEMENT T DOUBLE
-------------------
function noncubic.register_element_t_double(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_t_double_" .. subname, {
        description = description .. " Element T Double",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = {
                { 0.3125, -0.5, -0.3125, 0.5, 0.5, 0.3125 },
                { -0.3125, -0.5, -0.5, 0.3125, 0.5, 0.5 },
            },
        },
        node_box = {
            type = "fixed",
            fixed = {
                { 0.3125, -0.5, -0.3125, 0.5, 0.5, 0.3125 },
                { -0.3125, -0.5, -0.5, 0.3125, 0.5, 0.5 },
            },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_t_double_' .. subname .. ' 1',
        recipe = {
            { "", "", "" },
            { "", 'noncubic:element_t_' .. recipeitem, "" },
            { "", 'noncubic:element_t_' .. recipeitem, "" },
        },
    })
end

-- ELEMENT CROSS DOUBLE
-----------------------
function noncubic.register_element_cross_double(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_cross_double_" .. subname, {
        description = description .. " Element Cross Double",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = {
                { -0.5, -0.5, -0.3125, 0.5, 0.5, 0.3125 },
                { -0.3125, -0.5, -0.5, 0.3125, 0.5, 0.5 },
            },
        },
        node_box = {
            type = "fixed",
            fixed = {
                { -0.5, -0.5, -0.3125, 0.5, 0.5, 0.3125 },
                { -0.3125, -0.5, -0.5, 0.3125, 0.5, 0.5 },
            },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_cross_double_' .. subname .. ' 1',
        recipe = {
            { "", "", "" },
            { "", 'noncubic:element_cross_' .. recipeitem, "" },
            { "", 'noncubic:element_cross_' .. recipeitem, "" },
        },
    })
end

-- ELEMENT END DOUBLE
---------------------
function noncubic.register_element_end_double(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:element_end_double_" .. subname, {
        description = description .. " Element End Double",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = { -0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.5 },
        },
        node_box = {
            type = "fixed",
            fixed = { -0.3125, -0.5, -0.3125, 0.3125, 0.5, 0.5 },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:element_end_double_' .. subname .. ' 1',
        recipe = {
            { "", "", "" },
            { "", 'noncubic:element_end_' .. recipeitem, "" },
            { "", 'noncubic:element_end_' .. recipeitem, "" },
        },
    })
end

-- STICK
--------
function noncubic.register_stick(subname, description, images, recipeitem, groups)

    minetest.register_node(":noncubic:stick_" .. subname, {
        description = description .. " Stick",
        tiles = images,
        drawtype = "nodebox",
        paramtype = "light",
        paramtype2 = "facedir",
        walkable = true,
        selection_box = {
            type = "fixed",
            fixed = { -0.125, -0.5, -0.125, 0.125, 0.5, 0.125 },
        },
        node_box = {
            type = "fixed",
            fixed = { -0.125, -0.5, -0.125, 0.125, 0.5, 0.125 },
        },
        groups = groups,
    })
    minetest.register_craft({
        output = 'noncubic:stick_' .. subname .. ' 8',
        recipe = {
            { 'default:stick', "", "" },
            { "", "", "" },
            { recipeitem, "", "" },
        },
    })
end

-- REGISTER NEW NONCUBIC'S PART 2:
----------------------------------

local wood_types = {
    { "wood",          "Wooden",        {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1} },
    { "junglewood",    "Jungle Wood",   {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1} },
    { "pine_wood",     "Pine Wood",     {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1} },
    { "acacia_wood",   "Acacia Wood",   {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1} },
    { "aspen_wood",    "Aspen Wood",    {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1} },
    { "tree",          "Tree",          {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, tree = 1} },
    { "jungletree",    "Jungle Tree",   {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, tree = 1} },
    { "pine_tree",     "Pine Tree",     {choppy = 3, oddly_breakable_by_hand = 1, flammable = 3, tree = 1} },
    { "acacia_tree",   "Acacia Tree",   {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, tree = 1} },
    { "aspen_tree",    "Aspen Tree",    {choppy = 3, oddly_breakable_by_hand = 1, flammable = 3, tree = 1} },
    { "leaves",        "Leaves",        {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1} },
    { "jungleleaves",  "Jungle Leaves", {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1} },
    { "pine_needles",  "Pine Needles",  {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1} },
    { "acacia_leaves", "Acacia Leaves", {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1} },
    { "aspen_leaves",  "Aspen Leaves",  {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1} }
}

local stone_types = {
    { "stone",                  "Stone",                     "stone",                  { cracky = 3 } },
    { "cobble",                 "Cobblestone",               "cobble",                 { cracky = 3 } },
    { "mossycobble",            "Mossy Cobblestone",         "mossycobble",            { cracky = 3 } },
    { "stonebrick",             "Stone Brick",               "stone_brick",            { cracky = 2 } },
    { "stone_block",            "Stone Block",               "stone_block",            { cracky = 2 } },
    { "desert_stone",           "Desert Stone",              "desert_stone",           { cracky = 3 } },
    { "desert_cobble",          "Desert Cobblestone",        "desert_cobble",          { cracky = 3 } },
    { "desert_stonebrick",      "Desert Stone Brick",        "desert_stone_brick",     { cracky = 2 } },
    { "desert_stone_block",     "Desert Stone Block",        "desert_stone_block",     { cracky = 2 } },
    { "sandstone",              "Sandstone",                 "sandstone",              { cracky = 3, crumbly = 1 } },
    { "sandstonebrick",         "Sandstone Brick",           "sandstone_brick",        { cracky = 2 } },
    { "sandstone_block",        "Sandstone Block",           "sandstone_block",        { cracky = 2 } },
    { "desert_sandstone",       "Desert Sandstone",          "desert_sandstone",       { cracky = 3, crumbly = 1 } },
    { "desert_sandstonebrick",  "Desert Sandstone Brick",    "desert_sandstone_brick", { cracky = 2 } },
    { "desert_sandstone_block", "Desert Sandstone Block",    "desert_sandstone_block", { cracky = 2 } },
    { "silver_sandstone",       "Silver Sandstone",          "silver_sandstone",       { cracky = 3, crumbly = 1 } },
    { "silver_sandstonebrick",  "Silver Sandstone Brick",    "silver_sandstone_brick", { cracky = 2 } },
    { "silver_sandstone_block", "Silver Sandstone Block",    "silver_sandstone_block", { cracky = 2 } },
    { "obsidian",               "Obsidian",                  "obsidian",               { cracky = 1, level = 2 } },
    { "obsidianbrick",          "Obsidian Brick",            "obsidian_brick",         { cracky = 1, level = 2 } },
    { "obsidian_block",         "Obsidian Block",            "obsidian_block",         { cracky = 1, level = 2 } },
    { "brick",                  "Brick",                     "brick",                  { cracky = 3 } }
}

local metal_types = {
    { "steelblock",  "Steel Block",  "steel_block",  { cracky = 1, level = 2 } },
    { "tinblock",    "Tin Block",    "tin_block",    { cracky = 1, level = 2 } },
    { "copperblock", "Copper Block", "copper_block", { cracky = 1, level = 2 } },
    { "bronzeblock", "Bronze Block", "bronze_block", { cracky = 1, level = 2 } },
    { "goldblock",   "Gold Block",   "gold_block",   { cracky = 1 } }
}

-- REGISTER NONCUBIC NODES: noncubic.register_xyz(subname, desc_xyz, images, recipeitem, groups)
-------------------------------------------------------------------------------------------------------------

function noncubic.register_slope_edge_etc(subname, description, images, recipeitem, groups)
    noncubic.register_slope(subname, description, images, recipeitem, groups)
    noncubic.register_slope_lying(subname, description, images, recipeitem, groups)
    noncubic.register_slope_edge(subname, description, images, recipeitem, groups)
    noncubic.register_slope_inner_edge(subname, description, images, recipeitem, groups)
    noncubic.register_slope_upsdown(subname, description, images, recipeitem, groups)
    noncubic.register_slope_upsdown_edge(subname, description, images, recipeitem, groups)
    noncubic.register_slope_upsdown_inner_edge(subname, description, images, recipeitem, groups)
    noncubic.register_pyramid(subname, description, images, recipeitem, groups)
    noncubic.register_spike(subname, description, images, recipeitem, groups)
    noncubic.register_onecurvededge(subname, description, images, recipeitem, groups)
    noncubic.register_twocurvededge(subname, description, images, recipeitem, groups)
    noncubic.register_cylinder(subname, description, images, recipeitem, groups)
    noncubic.register_cylinder_horizontal(subname, description, images, recipeitem, groups)
    noncubic.register_sphere(subname, description, images, recipeitem, groups)

end


-- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC NODES:
-----------------------------------------------------------

-- WOOD
-------

for i = 1, #wood_types do
    local name, description, groups = unpack(wood_types[i])

    noncubic.register_slope_edge_etc(name,
        description,
        { "default_" .. name .. ".png" },
        "default:" .. name,
        groups)
end

-- STONE
--------

for i = 1, #stone_types do
    local name, description, texture, groups = unpack(stone_types[i])

    noncubic.register_slope_edge_etc(name,
        description,
        { "default_" .. texture .. ".png" },
        "default:" .. name,
        groups)
end

-- METAL
--------
for i = 1, #metal_types do
    local name, description, texture, groups = unpack(metal_types[i])

    noncubic.register_slope_edge_etc(name,
        description,
        { "default_" .. texture .. ".png" },
        "default:" .. name,
        groups)
end

-- DIRT
-------
noncubic.register_slope_edge_etc("dirt",
    "Dirt",
    { "default_grass.png", "default_dirt.png", "default_grass.png" },
    "default:dirt",
    { snappy = 2, choppy = 2, oddly_breakable_by_hand = 3 })

-- REGISTER WALL ELEMNTS: noncubic.register_xyz(subname3, recipeitem3, groups3, images3, desc_element_xyz)
----------------------------------------------------------------------------------------------------
function noncubic.register_elements(subname, description, images, recipeitem, groups)
    noncubic.register_element_straight(subname, description, images, recipeitem, groups)
    noncubic.register_element_edge(subname, description, images, recipeitem, groups)
    noncubic.register_element_t(subname, description, images, recipeitem, groups)
    noncubic.register_element_cross(subname, description, images, recipeitem, groups)
    noncubic.register_element_end(subname, description, images, recipeitem, groups)
    noncubic.register_element_straight_double(subname, description, images, recipeitem, groups)
    noncubic.register_element_edge_double(subname, description, images, recipeitem, groups)
    noncubic.register_element_t_double(subname, description, images, recipeitem, groups)
    noncubic.register_element_cross_double(subname, description, images, recipeitem, groups)
    noncubic.register_element_end_double(subname, description, images, recipeitem, groups)
end

-- REGISTER MATERIALS AND PROPERTIES FOR HALF AND NORMAL HEIGHT ELEMENTS:
-------------------------------------------------------------------------

-- WOOD
-------
for i = 1, #wood_types do
    local name, description, groups = unpack(wood_types[i])

    noncubic.register_elements(name,
        description,
        { "default_" .. name .. ".png" },
        "default:" .. name,
        groups)
end

-- STONE
--------
for i = 1, #stone_types do
    local name, description, texture, groups = unpack(stone_types[i])

    noncubic.register_elements(name,
        description,
        { "default_" .. texture .. ".png" },
        "default:" .. name,
        groups)
end

-- METAL
--------
for i = 1, #metal_types do
    local name, description, texture, groups = unpack(metal_types[i])

    noncubic.register_elements(name,
        description,
        { "default_" .. texture .. ".png" },
        "default:" .. name,
        groups)
end

-- REGISTER MATERIALS AND PROPERTIES FOR STICKS:
------------------------------------------------

-- WOOD
-------

for i = 1, #wood_types do
    local name, description, groups = unpack(wood_types[i])

    noncubic.register_stick(name,
        description,
        { "default_" .. name .. ".png" },
        "default:" .. name,
        groups)
end

-- STONE
--------

for i = 1, #stone_types do
    local name, description, texture, groups = unpack(stone_types[i])

    noncubic.register_stick(name,
        description,
        { "default_" .. texture .. ".png" },
        "default:" .. name,
        groups)
end

-- METAL
--------
for i = 1, #metal_types do
    local name, description, texture, groups = unpack(metal_types[i])

    noncubic.register_stick(name,
        description,
        { "default_" .. texture .. ".png" },
        "default:" .. name,
        groups)
end

Last edited by Drachenbauer32 on Thu Oct 31, 2019 22:20, edited 13 times in total.

User avatar
Drachenbauer32
Member
Posts: 105
Joined: Wed Aug 28, 2019 18:11

Re: [Mod] NonCubic Blocks Mod [1.4] [noncubic]

by Drachenbauer32 » Post

Not My Real Account wrote:-snip-
I have tried the recipe that was suggested here, using both planks and "tree" in place of "wood," and still have not succeeded in crafting the milling machine. Does this have something to do with the version of Minetest I am running (0.4.14), or perhaps I have not installed the correct version of the mod? Also, how do I craft doors with this mod?
For me it worked with 3 "apple wood planks".

an other tip:
For upside down nodes, you just can use the same calculations for the horizontal directions.
For the vertical direction change "( i / detail ) - 0.5" into "-1 * ( ( ( i + 1 ) / detail ) - 0.5 )" and
"( ( i + 1 ) / detail ) - 0.5" into "-1 * ( ( i / detail ) - 0.5 )".
That inverts the order of the different sized flat layers on the stack.

I also found a way to clean up the code of the seccond registration-part, that adds more materials with less code:
Material specific infos are in some arrays now and the registration-functions literate through the arrays.
So just add a new line with material infos to an array to make the code use it.
I also moved the shape-specific parts of the descriptions directly into the minetest.register_node-areas.
so the surrounding functions need only one description-part, each,

And i changed a bit, how the nodes ar grouped in the surrounding functions:
I grouped all 10 narrow wall-elemints together in one function.
I think, there is no need to make theese wall elements out of dirt.
and the stick does nort need a surrounding function, gecause it´s not grouped with other node shapes.
Maybe also all shapes can be grouped in one single surrounding function, because they all ask .

If the node-names in the minetest.register_node-areas start with a ":" (in front of the mod-name-part in the node-name), it´s possible to call the surrounding functions at the bottom of the code in other mod-lua-files to create shapes from own custom materials.
But i´m not sure, how to make souch an other mod add the materials to the mill-compatible node-materials.
I only know how to add materials directly in the mill-code.

The full code in the previous post is updated to show all this stuff.

And i upgraded the mill to use all theese materials, in a similar way with material-arrays:

Code: Select all

material = {}
shape = {}
size = "0"
make_ok = {}
exclude = {}
anzahl = {}
showbackground = "--"
showlabelin = "label[0,5.5;In:]"
showlabelout = "label[4.5,5.5;Out:]"


minetest.register_node("noncubic:mill", {
    description = "Milling Machine",
    tiles = {
        "cnc_top.png", "cnc_bottom.png", "cnc_side.png",
        "cnc_side.png", "cnc_side.png", "cnc_front.png"
    },
    drawtype = "nodebox",
    paramtype = "light",
    paramtype2 = "facedir",
    node_box = {
        type = "fixed",
        fixed = {
            { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
        },
    },
    selection_box = {
        type = "fixed",
        fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
    },
    groups = { oddly_breakable_by_hand = 2, cracky = 3, dig_immediate = 1 },
    can_dig = function(pos, player)
        local meta = minetest.env:get_meta(pos);
        local inv = meta:get_inventory()
        if not inv:is_empty("ingot") then
            return false
        elseif not inv:is_empty("res") then
            return false
        end
        return true
    end,
    on_construct = function(pos)
        local meta = minetest.env:get_meta(pos)
        if allow_menu_background == true or allow_menu_background == 1 then
            showbackground = "background[-0.15,-0.25;8.40,11.75;milling_background.png]"
        end

        meta:set_string("formspec", "invsize[8,11;]" ..
                showlabelin ..
                "list[current_name;ingot;1,5.5;1,1;]" ..
                showlabelout ..
                "list[current_name;res;6,5.5;1,1;]" ..
                "label[0,0;Choose Milling Program:]" ..
                "image_button[0,0.5;1,1;slope.png;slope; ]" ..
                "image_button[1,0.5;1,1;slope_edge.png;slope_edge; ]" ..
                "image_button[2,0.5;1,1;slope_inner_edge.png;slope_inner_edge; ]" ..
                "image_button[3,0.5;1,1;pyramid.png;pyramid; ]" ..
                "image_button[4,0.5;1,1;spike.png;spike; ]" ..
                "image_button[5,0.5;1,1;cylinder.png;cylinder; ]" ..
                "image_button[6,0.5;1,1;sphere.png;sphere; ]" ..
                "image_button[0,1.5;1,1;slope_upsdwn.png;slope_upsdwn; ]" ..
                "image_button[1,1.5;1,1;slope_edge_upsdwn.png;slope_edge_upsdwn; ]" ..
                "image_button[2,1.5;1,1;slope_inner_edge_upsdwn.png;slope_inner_edge_upsdwn; ]" ..
                "image_button[5,1.5;1,1;cylinder_horizontal.png;cylinder_hor; ]" ..
                "image_button[0,2.5;1,1;slope_lying.png;slope_lying; ]" ..
                "image_button[1,2.5;1,1;onecurvededge.png;onecurvededge; ]" ..
                "image_button[2,2.5;1,1;twocurvededge.png;twocurvededge; ]" ..
                "label[0,3.5;Slim Elements half / normal height:]" ..
                "image_button[0,4;1,0.5;full.png;full; ]" ..
                "image_button[0,4.5;1,0.5;half.png;half; ]" ..
                "image_button[1,4;1,1;element_straight.png;element_straight; ]" ..
                "image_button[2,4;1,1;element_end.png;element_end; ]" ..
                "image_button[3,4;1,1;element_cross.png;element_cross; ]" ..
                "image_button[4,4;1,1;element_t.png;element_t; ]" ..
                "image_button[5,4;1,1;element_edge.png;element_edge; ]" ..
                "image_button[7,0.5;1,1;stick.png;stick; ]" ..
                "list[current_player;main;0,7;8,4;]" ..
                showbackground)
        meta:set_string("infotext", "Milling Machine")
        local inv = meta:get_inventory()
        inv:set_size("ingot", 1)
        inv:set_size("res", 1)
    end,
    on_receive_fields = function(pos, formname, fields, sender)
        local meta = minetest.env:get_meta(pos)
        local inv = meta:get_inventory()

        -- REGISTER MILLING PROGRAMMS AND OUTPUTS:
        ------------------------------------------

        if fields["full"] then
            size = "1"
            return
        end

        if fields["half"] then
            size = "0"
            return
        end

        if fields["slope"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "2"
            shape = "noncubic:slope_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["slope_edge"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "2"
            shape = "noncubic:slope_edge_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["slope_inner_edge"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "1"
            shape = "noncubic:slope_inner_edge_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["pyramid"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "2"
            shape = "noncubic:pyramid_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["spike"] then
            make_ok = "0"
            exclude = "1"
            anzahl = "1"
            shape = "noncubic:spike_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["cylinder"] then
            make_ok = "0"
            exclude = "1"
            anzahl = "1"
            shape = "noncubic:cylinder_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["cylinder_hor"] then
            make_ok = "0"
            exclude = "1"
            anzahl = "1"
            shape = "noncubic:cylinder_horizontal_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["sphere"] then
            make_ok = "0"
            exclude = "1"
            anzahl = "1"
            shape = "noncubic:cylinder_sphere_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["slope_upsdwn"] then
            make_ok = "0"
            exclude = "1"
            anzahl = "2"
            shape = "noncubic:slope_upsdown_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["slope_edge_upsdwn"] then
            make_ok = "0"
            exclude = "1"
            anzahl = "2"
            shape = "noncubic:slope_upsdown_edge_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["slope_inner_edge_upsdwn"] then
            make_ok = "0"
            exclude = "1"
            anzahl = "1"
            shape = "noncubic:slope_upsdown_inner_edge_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["slope_lying"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "1"
            shape = "noncubic:slope_lying_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["onecurvededge"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "1"
            shape = "noncubic:onecurvededge_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["twocurvededge"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "1"
            shape = "noncubic:twocurvededge_"
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["element_straight"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "4"
            shape = "noncubic:element_straight_"
            if size == "1" then
                exclude = "1"
                anzahl = "2"
                shape = "noncubic:element_straight_double_"
            end
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["element_end"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "4"
            shape = "noncubic:element_end_"
            if size == "1" then
                exclude = "1"
                anzahl = "2"
                shape = "noncubic:element_end_double_"
            end
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["element_cross"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "2"
            shape = "noncubic:element_cross_"
            if size == "1" then
                exclude = "1"
                anzahl = "1"
                shape = "noncubic:element_cross_double_"
            end
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["element_t"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "2"
            shape = "noncubic:element_t_"
            if size == "1" then
                exclude = "1"
                anzahl = "1"
                shape = "noncubic:element_t_double_"
            end
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["element_edge"] then
            make_ok = "0"
            exclude = "0"
            anzahl = "2"
            shape = "noncubic:element_edge_"
            if size == "1" then
                exclude = "1"
                anzahl = "1"
                shape = "noncubic:element_edge_double_"
            end
            if inv:is_empty("ingot") then
                return
            end
        end

        if fields["stick"] then
            make_ok = "0"
            exclude = "1"
            anzahl = "8"
            shape = "noncubic:stick_"
            if inv:is_empty("ingot") then
                return
            end
        end

        -----------------------------


        local ingotstack = inv:get_stack("ingot", 1)
        local resstack = inv:get_stack("res", 1)


        -- Register Materials Milling Machine can make Shapes
        -----------------------------------------------------

        local wood_types = {
            { "wood" },
            { "junglewood" },
            { "pine_wood" },
            { "acacia_wood" },
            { "aspen_wood" },
            { "tree" },
            { "jungletree" },
            { "pine_tree" },
            { "acacia_tree" },
            { "aspen_tree" },
            { "leaves" },
            { "jungleleaves" },
            { "pine_needles" },
            { "acacia_leaves" },
            { "aspen_leaves" }
        }

        local stone_types = {
            { "stone" },
            { "cobble" },
            { "mossycobble" },
            { "stonebrick" },
            { "stone_block" },
            { "desert_stone" },
            { "desert_cobble" },
            { "desert_stonebrick" },
            { "desert_stone_block" },
            { "sandstone" },
            { "sandstonebrick" },
            { "sandstone_block" },
            { "desert_sandstone" },
            { "desert_sandstonebrick" },
            { "desert_sandstone_block" },
            { "silver_sandstone" },
            { "silver_sandstonebrick" },
            { "silver_sandstone_block" },
            { "obsidian" },
            { "obsidianbrick" },
            { "obsidian_block" },
            { "brick" }
        }

        local metal_types = {
            { "steelblock" },
            { "tinblock" },
            { "copperblock" },
            { "bronzeblock" },
            { "goldblock" }
        }

        for i = 1, #wood_types do
            local name = unpack(wood_types[i])
            if ingotstack:get_name() == "default:" .. name then
                material = name
                make_ok = "1"
            end

        end

        for i = 1, #stone_types do
            local name = unpack(stone_types[i])
            if ingotstack:get_name() == "default:" .. name then
                material = name
                make_ok = "1"
            end

        end

        for i = 1, #metal_types do
            local name = unpack(metal_types[i])
            if ingotstack:get_name() == "default:" .. name then
                material = name
                make_ok = "1"
            end

        end

        if ingotstack:get_name() == "default:dirt" then
            material = "dirt"
            make_ok = "1"
            if exclude == "1" then
                make_ok = "0"
            end
        end
        -----------------------------------------------------


        -- Milling
        ----------
        if make_ok == "1" then
            local give = {}
            for i = 0, anzahl - 1 do
                give[i + 1] = inv:add_item("res", shape .. material)
            end
            ingotstack:take_item()
            inv:set_stack("ingot", 1, ingotstack)
        end
    end,
})
----------


-- Milling Machine Recipe
-------------------------
minetest.register_craft({
    output = 'noncubic:mill',
    recipe = {
        { 'default:cobble', 'default:stick', 'default:cobble' },
        { 'default:wood', 'default:wood', 'default:wood' },
        { 'default:stick', "", 'default:stick' },
    },
})
-------------------------
I also have ideas for some more nodes:

based on the pyramid and spike (good as rooftops or on top of garden-walls):
-edge top straight (looks like a common house-roof)
-edge top edge (looks like the roof of a L-shaped house)
-edge top T (looks like the roof of a T-shaped house)
-edge cross (looks like the roof of a cross-shaped house)
-tall edge top end (looks like one half of a hipped roof)
-tall edge top straight (looks like a common house-roof)
-tall edge top edge (looks like the roof of a L-shaped house)
-tall edge top T (looks like the roof of a T-shaped house)
-tall edge cross (looks like the roof of a cross-shaped house)
-tall edge top end (looks like one half of a hipped roof)
-and all (also the pyramids) as upside down

for the curved edge blocks:
-lying (the curved edge is vertical, the same direction like the upright cylinder)
-inner corner
-and all exept "lying" as upside down
= all types from the slopes as curved edge

also based on the curved edges (can make cool top for 1 node thick garden-walls):
-half circle top straight
-half circle top edge
-half circle top T
-half circle top cross
-half circle top end
-and all as upside down

for the horizontal cylinder (good for a pipeline-system):
-the existing horizontal cylinder = pipe straight
-pipe edge
-pipe T
-pipe cross
-pipe end (this one looks like the middle between the horizontal cylinder and the sphere)

For the narrow wall elements:
-square
-square double (both narrow from all four sides, can be used as a pillar)
-all narrow wall-elements (inclusive the square-pillars) as upside down

I think, if theese new nodes are added, in the mill-maschine, all nodes should by grouped (for sample, the narrow wall elements should be a group) by shape.
rightclick on the maschine should open a menu of group-buttons, wich open a set of buttons for the different shapes in the group.

And it maybe difficult to create so many different shape-recipes.
So because of the mill-maschine, all common recipes for the shapes maybe deleted.

Another idea (reducing number of node-types):
number of registered nodes maybe reduced, if you use the xpanes-connection-system for the narrow-walls and maybe some additional similar connected nodes from my lists here.
so you need only one of them at each set for the player to craft with the mill.
the other variants appear directly by building such nodes next to each other.
for the other system (slaps and curved edges) you may use the way from the stairs-mod to turn them upside down without the need of having extra upside down nodes.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests