From 73ce10527444907183ba71fd9c898f68a7d147fb Mon Sep 17 00:00:00 2001
From: Alexander Ralph Michael Minges <alexander.minges@athemis.de>
Date: Sun, 26 Apr 2020 12:13:22 +0200
Subject: [PATCH] adjust crafting to be compatible with MC2

---
 border.lua |  8 ++++----
 init.lua   | 13 ++++++++++++-
 label.lua  |  8 ++++----
 mod.conf   |  2 +-
 poi.lua    |  8 ++++----
 train.lua  |  8 ++++----
 6 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/border.lua b/border.lua
index 62fcce9..8131a13 100644
--- a/border.lua
+++ b/border.lua
@@ -69,13 +69,13 @@ minetest.register_node("mapserver:border", {
 	end
 })
 
-if mapserver.enable_crafting and minetest.get_modpath("default") then
+if mapserver.enable_crafting then
 	minetest.register_craft({
 	    output = 'mapserver:border',
 	    recipe = {
-				{"", "default:steelblock", ""},
-				{"default:paper", "default:goldblock", "default:paper"},
-				{"", "default:glass", ""}
+				{"", moditems:steelblock, ""},
+				{moditems.paper, moditems.goldblock, moditems.paper},
+				{"", moditems.glass, ""}
 			}
 	})
 end
diff --git a/init.lua b/init.lua
index 160e035..f536581 100644
--- a/init.lua
+++ b/init.lua
@@ -1,4 +1,3 @@
-
 local default_path = core.get_modpath("default") and default
 local mineclone_path = core.get_modpath("mcl_core") and mcl_core
 
@@ -6,8 +5,20 @@ moditems = {}
 
 if mineclone_path then
 	moditems.sound_glass = mcl_sounds.node_sound_glass_defaults
+	moditems.goldblock = "mcl_core:goldblock"
+	moditems.steelblock = "mcl_core:ironblock"
+	moditems.steel_ingot = "mcl_core:iron_ingot"
+	moditems.paper = "mcl_core:paper"
+	moditems.glass = "mcl_core:glass"
+	moditems.dye = "mcl_dye:"
 else
 	moditems.sound_glass = default.node_sound_glass_defaults
+	moditems.goldblock = "default:goldblock"
+	moditems.steelblock = "default:steelblock"
+	moditems.steel_ingot = "default:steel_ingot"
+	moditems.paper = "default:paper"
+	moditems.glass = "default:glass"
+	moditems.dye = "dye:"
 end
 
 mapserver = {
diff --git a/label.lua b/label.lua
index d96b82d..c204b82 100644
--- a/label.lua
+++ b/label.lua
@@ -66,13 +66,13 @@ minetest.register_node("mapserver:label", {
 	end
 })
 
-if mapserver.enable_crafting and minetest.get_modpath("default") then
+if mapserver.enable_crafting then
 	minetest.register_craft({
 	    output = 'mapserver:label',
 	    recipe = {
-				{"", "default:paper", ""},
-				{"default:paper", "default:goldblock", "default:paper"},
-				{"", "default:glass", ""}
+				{"", moditems.paper, ""},
+				{moditems.paper, moditems.goldblock, moditems.paper},
+				{"", moditems.glass, ""}
 			}
 	})
 end
diff --git a/mod.conf b/mod.conf
index daf3a36..586bbba 100644
--- a/mod.conf
+++ b/mod.conf
@@ -1,3 +1,3 @@
 name = mapserver
 description = Mod for the mapserver.
-optional_depends = default, dye, advtrains, minecart, monitoring, bones, mcl_core, mcl_sounds
+optional_depends = default, dye, advtrains, minecart, monitoring, bones, mcl_core, mcl_sounds, mcl_dye
diff --git a/poi.lua b/poi.lua
index 253d221..f55178c 100644
--- a/poi.lua
+++ b/poi.lua
@@ -65,13 +65,13 @@ local register_poi = function(color, dye)
 	})
 
 
-	if mapserver.enable_crafting and minetest.get_modpath("dye") then
+	if mapserver.enable_crafting and (minetest.get_modpath("dye") or core.get_modpath("mcl_core")) then
 		minetest.register_craft({
 		    output = 'mapserver:poi_' .. color,
 		    recipe = {
-					{"", "dye:" .. dye, ""},
-					{"default:paper", "default:goldblock", "default:paper"},
-					{"", "default:glass", ""}
+					{"", moditems.dye .. dye, ""},
+					{moditems.paper, moditems.goldblock, moditems.paper},
+					{"", moditems.glass, ""}
 				}
 		})
 	end
diff --git a/train.lua b/train.lua
index 33a3c72..84edb2a 100644
--- a/train.lua
+++ b/train.lua
@@ -74,13 +74,13 @@ minetest.register_node("mapserver:train", {
 	end
 })
 
-if mapserver.enable_crafting and minetest.get_modpath("default") then
+if mapserver.enable_crafting then
 	minetest.register_craft({
 	    output = 'mapserver:train',
 	    recipe = {
-				{"", "default:steel_ingot", ""},
-				{"default:paper", "default:goldblock", "default:paper"},
-				{"", "default:glass", ""}
+				{"", moditems.steel_ingot, ""},
+				{moditems.paper, moditems.goldblock, moditems.paper},
+				{"", moditems.glass, ""}
 			}
 	})
 end
-- 
GitLab