From d467b80491e0e76382f1cf222a5b9473ed6fcf43 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Fri, 12 May 2023 14:46:33 -0600 Subject: [PATCH] Fix waterlogged mangrove roots leaving water in the nether --- mods/ITEMS/mcl_buckets/register.lua | 26 +++++++++++--------------- mods/ITEMS/mcl_mangrove/init.lua | 21 ++++++++++++++++++++- mods/ITEMS/mcl_mangrove/mod.conf | 2 +- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/register.lua b/mods/ITEMS/mcl_buckets/register.lua index 109941ab0..1d247e827 100644 --- a/mods/ITEMS/mcl_buckets/register.lua +++ b/mods/ITEMS/mcl_buckets/register.lua @@ -57,6 +57,7 @@ if mod_mcl_core then tt_help = S("Places a water source"), extra_check = function(pos, placer) local nn = minetest.get_node(pos).name + local dim = mcl_worlds.pos_to_dimension(pos) -- Pour water into cauldron if minetest.get_item_group(nn, "cauldron") ~= 0 then -- Put water into cauldron @@ -66,17 +67,14 @@ if mod_mcl_core then sound_place("mcl_core:water_source", pos) return false, true -- Put water into mangrove roots - elseif minetest.get_node(pos).name == "mcl_mangrove:mangrove_roots" then + elseif minetest.get_node(pos).name == "mcl_mangrove:mangrove_roots" and dim ~= "nether" then minetest.set_node(pos, {name="mcl_mangrove:water_logged_roots"}) sound_place("mcl_core:water_source", pos) return false, true -- Evaporate water if used in Nether (except on cauldron) - else - local dim = mcl_worlds.pos_to_dimension(pos) - if dim == "nether" then - minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) - return false, true - end + elseif dim == "nether" then + minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) + return false, true end end, groups = { water_bucket = 1 }, @@ -96,6 +94,7 @@ if mod_mclx_core then tt_help = S("Places a river water source"), extra_check = function(pos, placer) local nn = minetest.get_node(pos).name + local dim = mcl_worlds.pos_to_dimension(pos) -- Pour into cauldron if minetest.get_item_group(nn, "cauldron") ~= 0 then -- Put water into cauldron @@ -105,17 +104,14 @@ if mod_mclx_core then sound_place("mcl_core:water_source", pos) return false, true -- Put river water into mangrove roots - elseif minetest.get_node(pos).name == "mcl_mangrove:mangrove_roots" then + elseif minetest.get_node(pos).name == "mcl_mangrove:mangrove_roots" and dim ~= "nether" then minetest.set_node(pos, {name="mcl_mangrove:river_water_logged_roots"}) sound_place("mcl_core:water_source", pos) return false, true - else - -- Evaporate water if used in Nether (except on cauldron) - local dim = mcl_worlds.pos_to_dimension(pos) - if dim == "nether" then - minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) - return false, true - end + -- Evaporate water if used in Nether (except on cauldron) + elseif dim == "nether" then + minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) + return false, true end end, groups = { water_bucket = 1 }, diff --git a/mods/ITEMS/mcl_mangrove/init.lua b/mods/ITEMS/mcl_mangrove/init.lua index 3e1cecba9..dd2b653c4 100644 --- a/mods/ITEMS/mcl_mangrove/init.lua +++ b/mods/ITEMS/mcl_mangrove/init.lua @@ -352,10 +352,20 @@ local wlroots = { handy = 1, hoey = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 }, _mcl_blast_resistance = 100, _mcl_hardness = -1, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode + on_construct = function(pos) + local dim = mcl_worlds.pos_to_dimension(pos) + if dim == "nether" then + minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) + minetest.set_node(pos, {name="mcl_mangrove:mangrove_roots"}) + end + end, after_dig_node = function(pos) local node = minetest.get_node(pos) - if minetest.get_item_group(node.name, "water") == 0 then + local dim = mcl_worlds.pos_to_dimension(pos) + if minetest.get_item_group(node.name, "water") == 0 and dim ~= "nether" then minetest.set_node(pos, {name="mcl_core:water_source"}) + else + minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) end end, } @@ -369,6 +379,15 @@ rwlroots.tiles = { "("..water_tex..")^mcl_mangrove_roots_side.png", "("..water_tex..")^mcl_mangrove_roots_side.png", } +rwlroots.after_dig_node = function(pos) + local node = minetest.get_node(pos) + local dim = mcl_worlds.pos_to_dimension(pos) + if minetest.get_item_group(node.name, "water") == 0 and dim ~= "nether" then + minetest.set_node(pos, {name="mclx_core:river_water_source"}) + else + minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) + end +end minetest.register_node("mcl_mangrove:water_logged_roots", wlroots) minetest.register_node("mcl_mangrove:river_water_logged_roots",rwlroots) diff --git a/mods/ITEMS/mcl_mangrove/mod.conf b/mods/ITEMS/mcl_mangrove/mod.conf index fb71efbf8..cdc9a6a1c 100644 --- a/mods/ITEMS/mcl_mangrove/mod.conf +++ b/mods/ITEMS/mcl_mangrove/mod.conf @@ -1,3 +1,3 @@ name = mcl_mangrove author = thunder1035 -depends = mcl_core, mcl_doors, mcl_stairs, mcl_walls, mclx_fences, mcl_boats, mcl_flowerpots, mcl_mud, mcl_util +depends = mcl_core, mcl_doors, mcl_stairs, mcl_walls, mclx_fences, mcl_boats, mcl_flowerpots, mcl_mud, mcl_util, mcl_worlds