From c5da2c9c8f2e3a42ab5a592d01a6346549e718b6 Mon Sep 17 00:00:00 2001 From: Oliver Simmons Date: Wed, 21 Sep 2022 19:37:07 +0100 Subject: [PATCH] Reshuflin' --- README.md | 2 +- mods/mapgen/init.lua | 37 ++++++++++++++++++++++++------------- mods/nodes/init.lua | 17 ++++++++++------- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9e1e69e..5bd5ae6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A recreation of Cave Game, the earliest version of Minecraft. Whilst looking like cobble, stone is infact `minecraft:stone`. -Technical names `minecraft:nnn` and `nnn` are aliases to the "modern" Minecraft names. +Block's ID are aliased to their "modern" Minecraft name. Select mapgen `singlenode` for a truly flat world. Mapgen v6 unsupported. diff --git a/mods/mapgen/init.lua b/mods/mapgen/init.lua index cdbf4ad..4992c89 100644 --- a/mods/mapgen/init.lua +++ b/mods/mapgen/init.lua @@ -1,5 +1,28 @@ -if minetest.get_mapgen_params().mgname == "singlenode" then +local mgparams = minetest.get_mapgen_params() +if mgparams.mgname == "v6" then + error("Mapgen 'v6' is not supported by Cave Game.", 0) +end + +minetest.register_alias("mapgen_stone", "minecraft:stone") +minetest.register_alias("mapgen_water_source", "air") +minetest.register_alias("mapgen_river_water_source", "air") + + +-- FIXME: Why dosen't node_top work properly? +minetest.register_biome({ + name = "cavegame", + node_dust = "minecraft:grass", +-- node_top = "minecraft:grass", +-- depth_top = 1, + node_stone = "minecraft:stone", + heat_point = 50, + humidity_point = 50, + y_min = -3100, y_max = 3100, +}) + + +if mgparams.mgname == "singlenode" then local ground_level = tonumber(minetest.settings:get("water_level") or 1) local air = minetest.get_content_id("air") local stone = minetest.get_content_id("minecraft:stone") @@ -39,16 +62,4 @@ if minetest.get_mapgen_params().mgname == "singlenode" then return true end) end -else - -- FIXME: Why dosen't node_top work properly? - minetest.register_biome({ - name = "cavegame", - node_dust = "minecraft:grass", - -- node_top = "minecraft:grass", - -- depth_top = 1, - node_stone = "minecraft:stone", - heat_point = 50, - humidity_point = 50, - y_min = -3100, y_max = 3100, - }) end diff --git a/mods/nodes/init.lua b/mods/nodes/init.lua index d2f8d0b..a3c7133 100644 --- a/mods/nodes/init.lua +++ b/mods/nodes/init.lua @@ -1,11 +1,16 @@ -minetest.register_alias("mapgen_stone", "minecraft:stone") -minetest.register_alias("mapgen_water_source", "air") -minetest.register_alias("mapgen_river_water_source", "air") +minetest.register_on_mods_loaded(function() + for name,def in pairs(minetest.registered_nodes) do + if def.order then + minetest.register_alias(tostring(def.order), name) + end + end +end) -minetest.register_alias("1", "minecraft:stone") -minetest.register_alias("minecraft:1", "minecraft:stone") + + -- nodes -- + minetest.register_node(":minecraft:stone", { order = 1, description = "Stone", @@ -14,8 +19,6 @@ minetest.register_node(":minecraft:stone", { is_ground_content = true, }) -minetest.register_alias("2", "minecraft:grass") -minetest.register_alias("minecraft:2", "minecraft:grass") minetest.register_node(":minecraft:grass", { order = 2, description = "Grass",