From 1ddd08b39f8788da74426f7d86d6c3c14a34267a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Dec 2020 17:19:05 +0100 Subject: [PATCH] update --- mods/claycrafter/README.md | 22 +++++++++----- mods/claycrafter/claycrafter.lua | 12 ++++++-- mods/claycrafter/init.lua | 1 - mods/claycrafter/items.lua | 50 ++++++++++++++++++++++++++++++-- mods/claycrafter/mod.conf | 3 +- mods/claycrafter/recipes.lua | 34 ---------------------- 6 files changed, 74 insertions(+), 48 deletions(-) delete mode 100644 mods/claycrafter/recipes.lua diff --git a/mods/claycrafter/README.md b/mods/claycrafter/README.md index 9eb3eb05..2b85d759 100644 --- a/mods/claycrafter/README.md +++ b/mods/claycrafter/README.md @@ -1,19 +1,27 @@ # claycrafter -Minetest clay crafter mod. Adds a way to craft clay out of compressed dirt. +Minetest clay crafter mod. +Adds a way for players to obtain clay other than mining, out of a common material: dirt. It adds three new nodes: -Dependencies: + Claycrafter: Used to convert compressed dirt into clay. + + Compressed dirt: Just 9 dirt, compressed, useful for saving storage space, too! (Not present if moreblocks is installed, use moreblocks:dirt_compressed instead) + + Glass of water: Used as fuel for the Claycrafter. Placeable. + +##### Dependencies: Default Vessels -Bucket -claycrafter.lua is derivated from furnace.lua (minetest_game) by PilzAdam and Amaz1. -Edited by everamzah to work for this mod. +##### Optional dependencies: +moreblocks -#####License for Code +Special thanks to everamzah + +##### License for Code Dragonop (LGPLv3) -#####License for Media +##### License for Media Textures created or modified by Dragonop (CC-BY-SA 4.0) diff --git a/mods/claycrafter/claycrafter.lua b/mods/claycrafter/claycrafter.lua index 25ec2057..d8a4cd1d 100644 --- a/mods/claycrafter/claycrafter.lua +++ b/mods/claycrafter/claycrafter.lua @@ -203,8 +203,16 @@ minetest.register_abm({ local cooktime = minetest.get_item_group(inv:get_stack("fuel", 1):get_name(), "h2o") local cookable = true - if inv:get_stack("src", 1):get_name() ~= "claycrafter:compressed_dirt" then - cookable = false + + + if minetest.get_modpath("moreblocks") ~= nil then + if inv:get_stack("src", 1):get_name() ~= "moreblocks:dirt_compressed" then + cookable = false + end + else + if inv:get_stack("src", 1):get_name() ~= "claycrafter:compressed_dirt" then + cookable = false + end end -- Check if we have enough fuel to burn diff --git a/mods/claycrafter/init.lua b/mods/claycrafter/init.lua index 8491a8c9..aca4a612 100644 --- a/mods/claycrafter/init.lua +++ b/mods/claycrafter/init.lua @@ -3,5 +3,4 @@ local modpath = minetest.get_modpath("claycrafter") -- TODO: Investigate function to automatically get mod name. dofile(modpath .. "/items.lua") -dofile(modpath .. "/recipes.lua") dofile(modpath .. "/claycrafter.lua") diff --git a/mods/claycrafter/items.lua b/mods/claycrafter/items.lua index 16d1435f..823858d4 100644 --- a/mods/claycrafter/items.lua +++ b/mods/claycrafter/items.lua @@ -1,9 +1,31 @@ -minetest.register_node("claycrafter:compressed_dirt", { +--compressed dirt +local moreblocks = minetest.get_modpath("moreblocks") + +if moreblocks ~= nil then + minetest.register_alias("claycrafter:compressed_dirt","moreblocks:dirt_compressed") +else + minetest.register_craft({ + output = "claycrafter:compressed_dirt", + recipe = { + {"default:dirt", "default:dirt", "default:dirt"}, + {"default:dirt", "default:dirt", "default:dirt"}, + {"default:dirt", "default:dirt", "default:dirt"} + } + }) + minetest.register_node("claycrafter:compressed_dirt", { description = "Compressed Dirt", tiles = {"claycrafter_compressed_dirt.png"}, - groups = {crumbly = 1, oddly_breakable_by_hand = 1, soil = 1, cracky =1} -}) + groups = {crumbly = 1, oddly_breakable_by_hand = 1, soil = 1, cracky =1}, + sounds = default.node_sound_dirt_defaults(), + }) + minetest.register_craft({ + output = "default:dirt 9", + recipe = {{"claycrafter:compressed_dirt"}} + }) + minetest.register_alias("moreblocks:dirt_compressed","claycrafter:compressed_dirt") +end +--nodes minetest.register_node("claycrafter:glass_of_water", { description = ("Glass of Water"), drawtype = "plantlike", @@ -19,3 +41,25 @@ minetest.register_node("claycrafter:glass_of_water", { on_use = minetest.item_eat(0,"vessels:drinking_glass"), sounds = default.node_sound_glass_defaults(), }) + +--recipes +minetest.register_craft({ + output = "claycrafter:glass_of_water 8", + recipe = { + {"vessels:drinking_glass", "vessels:drinking_glass", "vessels:drinking_glass"}, + {"vessels:drinking_glass", "bucket:bucket_water", "vessels:drinking_glass"}, + {"vessels:drinking_glass", "vessels:drinking_glass", "vessels:drinking_glass"} + }, + replacements = { + {"bucket:bucket_water", "bucket:bucket_empty"}, + } +}) + +minetest.register_craft({ + output = "claycrafter:claycrafter", + recipe = { + {"group:wood", "default:steel_ingot", "group:wood"}, + {"group:wood", "default:glass", "group:wood"}, + {"default:stick", "bucket:bucket_water", "default:stick"} + } +}) diff --git a/mods/claycrafter/mod.conf b/mods/claycrafter/mod.conf index 408b3f4f..22169f01 100644 --- a/mods/claycrafter/mod.conf +++ b/mods/claycrafter/mod.conf @@ -1,4 +1,5 @@ name = claycrafter description = This mod introduces the Claycrafter, which converts Compressed Dirt to Clay using Glasses of Water. -depends = vessels, default, bucket +depends = vessels, default +optional_depends = moreblocks author = Dragonop diff --git a/mods/claycrafter/recipes.lua b/mods/claycrafter/recipes.lua deleted file mode 100644 index 10715417..00000000 --- a/mods/claycrafter/recipes.lua +++ /dev/null @@ -1,34 +0,0 @@ -minetest.register_craft({ - output = "claycrafter:compressed_dirt", - recipe = { - {"default:dirt", "default:dirt", "default:dirt"}, - {"default:dirt", "default:dirt", "default:dirt"}, - {"default:dirt", "default:dirt", "default:dirt"} - } -}) - -minetest.register_craft({ - output = "default:dirt 9", - recipe = {{"claycrafter:compressed_dirt"}} -}) - -minetest.register_craft({ - output = "claycrafter:glass_of_water 8", - recipe = { - {"vessels:drinking_glass", "vessels:drinking_glass", "vessels:drinking_glass"}, - {"vessels:drinking_glass", "bucket:bucket_water", "vessels:drinking_glass"}, - {"vessels:drinking_glass", "vessels:drinking_glass", "vessels:drinking_glass"} - }, - replacements = { - {"bucket:bucket_water", "bucket:bucket_empty"}, - } -}) - -minetest.register_craft({ - output = "claycrafter:claycrafter", - recipe = { - {"group:wood", "default:steel_ingot", "group:wood"}, - {"group:wood", "default:glass", "group:wood"}, - {"default:stick", "bucket:bucket_water", "default:stick"} - } -})