From 09b06ea72a55fb571c03d99724367ca1c7e2e3ef Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Mon, 12 Aug 2024 08:02:50 +0100 Subject: [PATCH] better mineclone support --- init.lua | 8 ++-- items_food.lua => item_food.lua | 34 ++++++++++------- items_list.lua => item_list.lua | 0 items_non_food.lua => item_non_food.lua | 0 item_recipes.lua | 49 +++++++++++++++---------- 5 files changed, 54 insertions(+), 37 deletions(-) rename items_food.lua => item_food.lua (98%) rename items_list.lua => item_list.lua (100%) rename items_non_food.lua => item_non_food.lua (100%) diff --git a/init.lua b/init.lua index 53fce1a..3e78823 100644 --- a/init.lua +++ b/init.lua @@ -12,7 +12,7 @@ local S = minetest.get_translator("farming") farming = { mod = "redo", - version = "20240811", + version = "20240812", path = minetest.get_modpath("farming"), select = { type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} @@ -735,7 +735,7 @@ end -- recipe item list and alternatives -dofile(farming.path .. "/items_list.lua") +dofile(farming.path .. "/item_list.lua") -- important items @@ -816,8 +816,8 @@ ddoo("ginger.lua", farming.ginger) -- register food items, non-food items, recipes and stairs -dofile(farming.path .. "/items_non_food.lua") -dofile(farming.path .. "/items_food.lua") +dofile(farming.path .. "/item_non_food.lua") +dofile(farming.path .. "/item_food.lua") dofile(farming.path .. "/item_recipes.lua") dofile(farming.path .. "/item_stairs.lua") diff --git a/items_food.lua b/item_food.lua similarity index 98% rename from items_food.lua rename to item_food.lua index 869557b..a30800f 100644 --- a/items_food.lua +++ b/item_food.lua @@ -3,6 +3,7 @@ local S = minetest.get_translator("farming") local a = farming.recipe_items -- Flour + minetest.register_craftitem("farming:flour", { description = S("Flour"), inventory_image = "farming_flour.png", @@ -10,14 +11,18 @@ minetest.register_craftitem("farming:flour", { }) -- Bread -minetest.register_craftitem("farming:bread", { - description = S("Bread"), - inventory_image = "farming_bread.png", - on_use = minetest.item_eat(5), - groups = {food_bread = 1} -}) -farming.add_eatable("farming:bread", 5) +if not farming.mcl then + + minetest.register_craftitem("farming:bread", { + description = S("Bread"), + inventory_image = "farming_bread.png", + on_use = minetest.item_eat(5), + groups = {food_bread = 1} + }) + + farming.add_eatable("farming:bread", 5) +end -- Garlic bulb @@ -124,13 +129,16 @@ end -- Chocolate cookie -minetest.register_craftitem("farming:cookie", { - description = S("Cookie"), - inventory_image = "farming_cookie.png", - on_use = minetest.item_eat(2) -}) +if not farming.mcl then -farming.add_eatable("farming:cookie", 2) + minetest.register_craftitem("farming:cookie", { + description = S("Cookie"), + inventory_image = "farming_cookie.png", + on_use = minetest.item_eat(2) + }) + + farming.add_eatable("farming:cookie", 2) +end -- Bar of of dark chocolate (thx to Ice Pandora for her deviantart.com chocolate tutorial) minetest.register_craftitem("farming:chocolate_dark", { diff --git a/items_list.lua b/item_list.lua similarity index 100% rename from items_list.lua rename to item_list.lua diff --git a/items_non_food.lua b/item_non_food.lua similarity index 100% rename from items_non_food.lua rename to item_non_food.lua diff --git a/item_recipes.lua b/item_recipes.lua index 4b10895..fbcb352 100644 --- a/item_recipes.lua +++ b/item_recipes.lua @@ -3,14 +3,17 @@ local a = farming.recipe_items -- flour recipes -minetest.register_craft({ - output = "farming:flour", - recipe = { - {"farming:wheat", "farming:wheat", "farming:wheat"}, - {"farming:wheat", a.mortar_pestle, ""} - }, - replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}} -}) +if not farming.mcl then + + minetest.register_craft({ + output = "farming:flour", + recipe = { + {"farming:wheat", "farming:wheat", "farming:wheat"}, + {"farming:wheat", a.mortar_pestle, ""} + }, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}} + }) +end minetest.register_craft({ output = "farming:flour", @@ -62,12 +65,15 @@ minetest.register_craft({ -- bread -minetest.register_craft({ - type = "cooking", - cooktime = 15, - output = "farming:bread", - recipe = "farming:flour" -}) +if not farming.mcl then + + minetest.register_craft({ + type = "cooking", + cooktime = 15, + output = "farming:bread", + recipe = "farming:flour" + }) +end -- sliced bread @@ -213,12 +219,15 @@ minetest.register_craft( { -- chocolate cookie -minetest.register_craft( { - output = "farming:cookie 8", - recipe = { - {"group:food_wheat", "group:food_cocoa", "group:food_wheat" } - } -}) +if not farming.mcl then + + minetest.register_craft( { + output = "farming:cookie 8", + recipe = { + {"group:food_wheat", "group:food_cocoa", "group:food_wheat" } + } + }) +end -- chocolate block