From 76089250602ca464880632363b19de1509e77609 Mon Sep 17 00:00:00 2001 From: SmokeyDope Date: Tue, 30 Apr 2024 23:42:50 +0000 Subject: [PATCH] Upload files to "mods/ITEMS/mcl_transmutation" --- mods/ITEMS/mcl_transmutation/init.lua | 49 +++++++++++++++++++++++++++ mods/ITEMS/mcl_transmutation/mod.conf | 5 +++ 2 files changed, 54 insertions(+) create mode 100644 mods/ITEMS/mcl_transmutation/init.lua create mode 100644 mods/ITEMS/mcl_transmutation/mod.conf diff --git a/mods/ITEMS/mcl_transmutation/init.lua b/mods/ITEMS/mcl_transmutation/init.lua new file mode 100644 index 000000000..99bc8eb96 --- /dev/null +++ b/mods/ITEMS/mcl_transmutation/init.lua @@ -0,0 +1,49 @@ +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) + +local exchange_node + function exchange_node(itemstack, placer, pointed_thing) + -- Use pointed node's on_rightclick function first, if present + local node = minetest.get_node(pointed_thing.under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + end + end + + -- Node exchange recipes + if node.name == "mcl_core:cobble" then + minetest.sound_play({name="zap_on", pos=pos, gain=1}, true) + minetest.set_node(pointed_thing.under, {name="mcl_deepslate:deepslate_cobbled"}) + end + + if node.name == "mcl_deepslate:deepslate_cobbled" then + minetest.sound_play({name="zap_off", pos=pos, gain=1}, true) + minetest.set_node(pointed_thing.under, {name="mcl_core:cobble"}) + end + + + if node.name == "mcl_core:stone" then + minetest.set_node(pointed_thing.under, {name="mcl_deepslate:deepslate"}) + minetest.sound_play({name="zap_on", pos=pos, gain=1}, true) + end + + if node.name == "mcl_deepslate:deepslate" then + minetest.set_node(pointed_thing.under, {name="mcl_core:stone"}) + minetest.sound_play({name="zap_off", pos=pos, gain=1}, true) + end + + + return itemstack + end + +--register Orb of Exchange +minetest.register_tool("mcl_transmutation:orb_of_exchange", { + description = "Orb of Exchange", + inventory_image = "mcl_transmutation_orb_of_exchange.png", + wield_scale = wield_scale, + groups = { tool=1}, + on_place = exchange_node, + sound = { breaks = "default_tool_breaks" }, + _mcl_toollike_wield = true, + }) diff --git a/mods/ITEMS/mcl_transmutation/mod.conf b/mods/ITEMS/mcl_transmutation/mod.conf new file mode 100644 index 000000000..c75b41836 --- /dev/null +++ b/mods/ITEMS/mcl_transmutation/mod.conf @@ -0,0 +1,5 @@ +name = mcl_transmutation +depends = mcl_core, +description = adds orb of exchange +author = SmokeyDope +title = Orb Of Exchange