1
0
Fork 0

Remaining stairs/slabs inherit properties instead of hardcoding

- Fix smooth quartz attributes
- Alternative recipes for (red) sandstone, quartz, purpur slabs/stairs have been added explicitly
This commit is contained in:
seventeenthShulker 2023-09-27 16:15:43 +02:00
parent e7457b9ea8
commit 4613f1ca85
3 changed files with 108 additions and 39 deletions

View File

@ -259,8 +259,8 @@ minetest.register_node("mcl_nether:quartz_smooth", {
tiles = {"mcl_nether_quartz_block_bottom.png"}, tiles = {"mcl_nether_quartz_block_bottom.png"},
groups = {pickaxey=1, quartz_block=1,building_block=1, material_stone=1}, groups = {pickaxey=1, quartz_block=1,building_block=1, material_stone=1},
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 0.8, _mcl_blast_resistance = 6,
_mcl_hardness = 0.8, _mcl_hardness = 2,
}) })
minetest.register_craftitem("mcl_nether:glowstone_dust", { minetest.register_craftitem("mcl_nether:glowstone_dust", {

View File

@ -11,7 +11,8 @@ mcl_stairs.register_stair_and_slab_simple("platinum", "example:platinum", "Plati
``` ```
## `mcl_stairs.register_stair_and_slab_simple(subname, sourcenode, desc_stair, desc_slab, double_description, corner_stair_texture_override)` ## `mcl_stairs.register_stair_and_slab_simple(subname, sourcenode, desc_stair, desc_slab, double_description, corner_stair_texture_override)`
Register a simple stair and a slab. The stair and slab will inherit all attributes from `sourcenode`. The `sourcenode` is also used as the item for crafting recipes. Register a simple stair and a slab. The stair and slab will inherit all attributes from `sourcenode`. The `sourcenode` is also used as the item for crafting recipes. If multiple nodes should craft into the same stairs/slab, see
`mcl_stairs.register_craft_stairs` or `mcl_stairs.register_craft_slab`
This function is meant for simple nodes; if you need more flexibility, use one of the other functions instead. This function is meant for simple nodes; if you need more flexibility, use one of the other functions instead.
@ -44,7 +45,7 @@ The itemstrings for the registered nodes will be of the form:
### Parameters ### Parameters
* `subname`: Name fragment for node itemstrings (see above) * `subname`: Name fragment for node itemstrings (see above)
* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead * `recipeitem`: Item for crafting recipe and attribute inheritance. Do not use `group:` prefix here, alternative recipes can be registered using `mcl_stairs.register_craft_stairs(subname, recipeitem_or_group)`.
* `groups`: Groups used for stair * `groups`: Groups used for stair
* `images`: Textures * `images`: Textures
* `description`: Stair description/tooltip * `description`: Stair description/tooltip
@ -81,3 +82,35 @@ The itemstrings for the registered nodes will be of the form:
* `double_description`: Node description/tooltip for double slab * `double_description`: Node description/tooltip for double slab
* Other parameters: Same as for `register_stair` * Other parameters: Same as for `register_stair`
## `mcl_stairs.register_craft_stairs(subname, recipeitem)`
Just registers a recipe for `mcl_stairs:stair_<subname>`.
Useful if a node variant should craft the same stairs as the base node, since the above functions use the same
parameter for crafting material and attribute inheritance.
e.g. 6 Purpur Pillar -> 4 Purpur Stairs is an alternate recipe.
Creates staircase recipes with 6 input items, both left-facing and right-facing. Outputs 4 stairs.
The itemstring for the output node will be of the form:
* `mcl_stairs:stair_<subname>`: Normal stair
### Parameters
* `subname`: Name fragment for node itemstring (see above)
* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead
## `mcl_stairs.register_craft_slab(subname, recipeitem)`
Just registers a recipe for `mcl_stairs:slab_<subname>`.
Useful if a node variant should craft the same stairs as the base node, since the above functions use the same
parameter for crafting material and attribute inheritance.
e.g. 3 Quartz Pillar -> 6 Quartz Slab is an alternate recipe.
Creates slab recipe with 3 input items in any horizontal line. Outputs 6 slabs.
The itemstring for the output node will be of the form:
* `mcl_stairs:slab_<subname>`: Slab
### Parameters
* `subname`: Name fragment for node itemstring (see above)
* `recipeitem`: Item for crafting recipe. Use `group:` prefix to use a group instead

View File

@ -1,10 +1,39 @@
-- Register all Minecraft stairs and slabs -- Register all Minecraft stairs and slabs
-- Note about hardness: For some reason, the hardness of slabs and stairs don't always match nicely, so that some
-- slabs actually take slightly longer to be dug than their stair counterparts.
-- Note sure if it is a good idea to preserve this oddity.
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
-- Cut Sandstone Stairs do not exist, and register_stair_and_slab does not allow multiple recipes
-- (e.g. using group:node) if we try to copy the properties of the node at the same parameter.
-- The missing recipes can be added separately via these:
function mcl_stairs.register_craft_stairs(subname, recipeitem)
minetest.register_craft({
output = "mcl_stairs:stair_" .. subname .. " 4",
recipe = {
{recipeitem, "", ""},
{recipeitem, recipeitem, ""},
{recipeitem, recipeitem, recipeitem},
},
})
-- Flipped recipe
minetest.register_craft({
output = "mcl_stairs:stair_" .. subname .. " 4",
recipe = {
{"", "", recipeitem},
{"", recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
end
function mcl_stairs.register_craft_slab(subname, recipeitem)
minetest.register_craft({
output = "mcl_stairs:slab_" .. subname .. " 6",
recipe = {
{recipeitem, recipeitem, recipeitem},
},
})
end
local woods = { local woods = {
{ "wood", "default_wood.png", S("Oak Wood Stairs"), S("Oak Wood Slab"), S("Double Oak Wood Slab") }, { "wood", "default_wood.png", S("Oak Wood Stairs"), S("Oak Wood Slab"), S("Double Oak Wood Slab") },
{ "junglewood", "default_junglewood.png", S("Jungle Wood Stairs"), S("Jungle Wood Slab"), S("Double Jungle Wood Slab") }, { "junglewood", "default_junglewood.png", S("Jungle Wood Stairs"), S("Jungle Wood Slab"), S("Double Jungle Wood Slab") },
@ -48,33 +77,44 @@ mcl_stairs.register_stair_and_slab_simple("mossycobble", "mcl_core:mossycobble",
mcl_stairs.register_stair_and_slab_simple("brick_block", "mcl_core:brick_block", S("Brick Stairs"), S("Brick Slab"), S("Double Brick Slab")) mcl_stairs.register_stair_and_slab_simple("brick_block", "mcl_core:brick_block", S("Brick Stairs"), S("Brick Slab"), S("Double Brick Slab"))
mcl_stairs.register_stair_and_slab("sandstone", "mcl_core:sandstone",
mcl_stairs.register_stair("sandstone", "group:normal_sandstone",
{pickaxey=1, material_stone=1}, {pickaxey=1, material_stone=1},
{"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"}, {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"},
S("Sandstone Stairs"), S("Sandstone Stairs"),
mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8,
nil, "mcl_core:sandstone") --fixme: extra parameter from previous release
mcl_stairs.register_slab("sandstone", "group:normal_sandstone",
{pickaxey=1, material_stone=1},
{"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"},
S("Sandstone Slab"), S("Sandstone Slab"),
mcl_sounds.node_sound_stone_defaults(), 6, 2, mcl_sounds.node_sound_stone_defaults(), nil, nil,
S("Double Sandstone Slab"), "mcl_core:sandstone") --fixme: extra parameter from previous release S("Double Sandstone Slab"))
mcl_stairs.register_craft_stairs("sandstone", "mcl_core:sandstonesmooth") -- Comment this line out if Cut Sandstone Stairs are implemented
mcl_stairs.register_craft_stairs("sandstone", "mcl_core:sandstonecarved")
mcl_stairs.register_craft_slab("sandstone", "mcl_core:sandstonecarved")
-- mcl_stairs.register_stair_and_slab("sandstonesmooth", "mcl_core:sandstonesmooth",
-- {pickaxey=1, material_stone=1},
-- {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_smooth.png"},
-- S("Cut Sandstone Stairs"), S("Cut Sandstone Slab"),
-- mcl_sounds.node_sound_stone_defaults(), nil, nil,
-- S("Double Cut Sandstone Slab"))
mcl_stairs.register_stair_and_slab_simple("sandstonesmooth2", "mcl_core:sandstonesmooth2", S("Smooth Sandstone Stairs"), S("Smooth Sandstone Slab"), S("Double Smooth Sandstone Slab")) mcl_stairs.register_stair_and_slab_simple("sandstonesmooth2", "mcl_core:sandstonesmooth2", S("Smooth Sandstone Stairs"), S("Smooth Sandstone Slab"), S("Double Smooth Sandstone Slab"))
mcl_stairs.register_stair("redsandstone", "group:red_sandstone", mcl_stairs.register_stair_and_slab("redsandstone", "mcl_core:redsandstone",
{pickaxey=1, material_stone=1}, {pickaxey=1, material_stone=1},
{"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_normal.png"}, {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_normal.png"},
S("Red Sandstone Stairs"), S("Red Sandstone Stairs"),
mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8,
nil, "mcl_core:redsandstone") --fixme: extra parameter from previous release
mcl_stairs.register_slab("redsandstone", "group:red_sandstone",
{pickaxey=1, material_stone=1},
{"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_normal.png"},
S("Red Sandstone Slab"), S("Red Sandstone Slab"),
mcl_sounds.node_sound_stone_defaults(), 6, 2, mcl_sounds.node_sound_stone_defaults(), nil, nil,
S("Double Red Sandstone Slab"), "mcl_core:redsandstone") --fixme: extra parameter from previous release S("Double Red Sandstone Slab"))
mcl_stairs.register_craft_stairs("redsandstone", "mcl_core:redsandstonesmooth") -- Comment this line out if Cut Red Sandstone Stairs are implemented
mcl_stairs.register_craft_stairs("redsandstone", "mcl_core:redsandstonecarved")
mcl_stairs.register_craft_slab("redsandstone", "mcl_core:redsandstonecarved")
-- mcl_stairs.register_stair_and_slab("redsandstonesmooth", "mcl_core:redsandstonesmooth",
-- {pickaxey=1, material_stone=1},
-- {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_smooth.png"},
-- S("Cut Red Sandstone Stairs"), S("Cut Red Sandstone Slab"),
-- mcl_sounds.node_sound_stone_defaults(), nil, nil,
-- S("Double Cut Red Sandstone Slab"))
mcl_stairs.register_stair_and_slab_simple("redsandstonesmooth2", "mcl_core:redsandstonesmooth2", S("Smooth Red Sandstone Stairs"), S("Smooth Red Sandstone Slab"), S("Double Smooth Red Sandstone Slab")) mcl_stairs.register_stair_and_slab_simple("redsandstonesmooth2", "mcl_core:redsandstonesmooth2", S("Smooth Red Sandstone Stairs"), S("Smooth Red Sandstone Slab"), S("Double Smooth Red Sandstone Slab"))
-- Intentionally not group:stonebrick because of mclx_stairs -- Intentionally not group:stonebrick because of mclx_stairs
@ -91,18 +131,17 @@ mcl_stairs.register_slab("stonebrick", "mcl_core:stonebrick",
mcl_sounds.node_sound_stone_defaults(), nil, nil, mcl_sounds.node_sound_stone_defaults(), nil, nil,
S("Double Stone Bricks Slab")) S("Double Stone Bricks Slab"))
mcl_stairs.register_stair("quartzblock", "group:quartz_block", mcl_stairs.register_stair_and_slab("quartzblock", "mcl_nether:quartz_block",
{pickaxey=1, material_stone=1}, {pickaxey=1, material_stone=1},
{"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"}, {"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"},
S("Quartz Stairs"), S("Quartz Stairs"),
mcl_sounds.node_sound_stone_defaults(), 0.8, 0.8,
nil, "mcl_nether:quartz_block") --fixme: extra parameter from previous release
mcl_stairs.register_slab("quartzblock", "group:quartz_block",
{pickaxey=1, material_stone=1},
{"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"},
S("Quartz Slab"), S("Quartz Slab"),
mcl_sounds.node_sound_stone_defaults(), 6, 2, mcl_sounds.node_sound_stone_defaults(), nil, nil,
S("Double Quartz Slab"), "mcl_nether:quartz_block") --fixme: extra parameter from previous release S("Double Quartz Slab"))
mcl_stairs.register_craft_stairs("quartzblock", "mcl_nether:quartz_pillar")
mcl_stairs.register_craft_stairs("quartzblock", "mcl_nether:quartz_chiseled")
mcl_stairs.register_craft_slab("quartzblock", "mcl_nether:quartz_pillar")
mcl_stairs.register_craft_slab("quartzblock", "mcl_nether:quartz_chiseled")
mcl_stairs.register_stair_and_slab_simple("quartz_smooth", "mcl_nether:quartz_smooth", S("Smooth Quartz Stairs"), S("Smooth Quartz Slab"), S("Double Smooth Quartz Slab")) mcl_stairs.register_stair_and_slab_simple("quartz_smooth", "mcl_nether:quartz_smooth", S("Smooth Quartz Stairs"), S("Smooth Quartz Slab"), S("Double Smooth Quartz Slab"))
@ -123,18 +162,15 @@ mcl_stairs.register_stair_and_slab("red_nether_brick", "mcl_nether:red_nether_br
mcl_stairs.register_stair_and_slab_simple("end_bricks", "mcl_end:end_bricks", S("End Stone Brick Stairs"), S("End Stone Brick Slab"), S("Double End Stone Brick Slab")) mcl_stairs.register_stair_and_slab_simple("end_bricks", "mcl_end:end_bricks", S("End Stone Brick Stairs"), S("End Stone Brick Slab"), S("Double End Stone Brick Slab"))
mcl_stairs.register_stair("purpur_block", "group:purpur_block", mcl_stairs.register_stair_and_slab("purpur_block", "mcl_end:purpur_block",
{pickaxey=1, material_stone=1}, {pickaxey=1, material_stone=1},
{"mcl_end_purpur_block.png"}, {"mcl_end_purpur_block.png"},
S("Purpur Stairs"), S("Purpur Stairs"),
mcl_sounds.node_sound_stone_defaults(), 6, 1.5,
nil)
mcl_stairs.register_slab("purpur_block", "group:purpur_block",
{pickaxey=1, material_stone=1},
{"mcl_end_purpur_block.png"},
S("Purpur Slab"), S("Purpur Slab"),
mcl_sounds.node_sound_stone_defaults(), 6, 2, mcl_sounds.node_sound_stone_defaults(), nil, nil,
S("Double Purpur Slab")) S("Double Purpur Slab"))
mcl_stairs.register_craft_stairs("purpur_block", "mcl_end:purpur_pillar")
mcl_stairs.register_craft_slab("purpur_block", "mcl_end:purpur_pillar")
mcl_stairs.register_stair_and_slab_simple("prismarine", "mcl_ocean:prismarine", S("Prismarine Stairs"), S("Prismarine Slab"), S("Double Prismarine Slab")) mcl_stairs.register_stair_and_slab_simple("prismarine", "mcl_ocean:prismarine", S("Prismarine Stairs"), S("Prismarine Slab"), S("Double Prismarine Slab"))