From a153e5bc335157476209d8637a77bcef04945dff Mon Sep 17 00:00:00 2001 From: PrairieAstronomer Date: Sat, 30 Jul 2022 12:21:16 -0600 Subject: [PATCH 1/2] Fixed Place Water in the Nether with Fish Buckets. --- mods/ENTITIES/mobs_mc/cod.lua | 2 +- mods/ENTITIES/mobs_mc/salmon.lua | 2 +- mods/ENTITIES/mobs_mc/tropical_fish.lua | 2 +- mods/ITEMS/mcl_buckets/locale/template.txt | 7 +++++ mods/ITEMS/mcl_buckets/register.lua | 36 ++++++++++++++++++++++ mods/ITEMS/mcl_fishing/init.lua | 27 ---------------- mods/ITEMS/mcl_fishing/locale/template.txt | 7 ----- 7 files changed, 46 insertions(+), 37 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/cod.lua b/mods/ENTITIES/mobs_mc/cod.lua index fe72c2f84..98020cca8 100644 --- a/mods/ENTITIES/mobs_mc/cod.lua +++ b/mods/ENTITIES/mobs_mc/cod.lua @@ -104,7 +104,7 @@ local cod = { on_rightclick = function(self, clicker) if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then self.object:remove() - clicker:set_wielded_item("mcl_fishing:bucket_cod") + clicker:set_wielded_item("mcl_buckets:bucket_cod") awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing") end end diff --git a/mods/ENTITIES/mobs_mc/salmon.lua b/mods/ENTITIES/mobs_mc/salmon.lua index 3c38f6860..e337aef19 100644 --- a/mods/ENTITIES/mobs_mc/salmon.lua +++ b/mods/ENTITIES/mobs_mc/salmon.lua @@ -60,7 +60,7 @@ local salmon = { on_rightclick = function(self, clicker) if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then self.object:remove() - clicker:set_wielded_item("mcl_fishing:bucket_salmon") + clicker:set_wielded_item("mcl_buckets:bucket_salmon") awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing") end end diff --git a/mods/ENTITIES/mobs_mc/tropical_fish.lua b/mods/ENTITIES/mobs_mc/tropical_fish.lua index 7dcc2d5cd..d963665b2 100644 --- a/mods/ENTITIES/mobs_mc/tropical_fish.lua +++ b/mods/ENTITIES/mobs_mc/tropical_fish.lua @@ -105,7 +105,7 @@ local tropical_fish = { on_rightclick = function(self, clicker) if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then self.object:remove() - clicker:set_wielded_item("mcl_fishing:bucket_tropical_fish") + clicker:set_wielded_item("mcl_buckets:bucket_tropical_fish") awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing") end end, diff --git a/mods/ITEMS/mcl_buckets/locale/template.txt b/mods/ITEMS/mcl_buckets/locale/template.txt index 174d1b76b..86b7b10b5 100644 --- a/mods/ITEMS/mcl_buckets/locale/template.txt +++ b/mods/ITEMS/mcl_buckets/locale/template.txt @@ -15,3 +15,10 @@ Collects liquids= Places a lava source= Places a water source= Places a river water source= +Cod= +Salmon= +Tropical Fish= +Bucket of @1= +This bucket is filled with water and @1.= +Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.= +Places a water source and a @1 fish.= diff --git a/mods/ITEMS/mcl_buckets/register.lua b/mods/ITEMS/mcl_buckets/register.lua index 365966724..4a6425116 100644 --- a/mods/ITEMS/mcl_buckets/register.lua +++ b/mods/ITEMS/mcl_buckets/register.lua @@ -1,6 +1,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) local mod_mcl_core = minetest.get_modpath("mcl_core") local mod_mclx_core = minetest.get_modpath("mclx_core") +local mod_mobs_mc = minetest.get_modpath("mobs_mc") local has_awards = minetest.get_modpath("awards") local function sound_place(itemname, pos) @@ -118,3 +119,38 @@ minetest.register_craft({ burntime = 1000, replacements = {{"mcl_buckets:bucket_lava", "mcl_buckets:bucket_empty"}}, }) + +-- Fish Buckets +if mod_mobs_mc then + fish_names = { + { techname = "cod", name = "Cod" }, + { techname = "salmon", name = "Salmon" }, + --{ techname = "pufferfish", name = "Pufferfish" } FIXME: Uncomment when pufferfish mobs are added. + { techname = "tropical_fish", name = "Tropical Fish" } + } + + for _, fish in pairs(fish_names) do + mcl_buckets.register_liquid({ + bucketname = "mcl_buckets:bucket_" .. fish.techname, + source_place = function(pos) + minetest.add_entity(pos, "mobs_mc:" .. fish.techname) + return "mcl_core:water_source" + end, + source_take = {"mobs_mc:" .. fish.techname}, + inventory_image = fish.techname .. "_bucket.png", + name = S("Bucket of @1", S(fish.name)), + longdesc = S("This bucket is filled with water and @1.", S(fish.name)), + usagehelp = S("Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.", S(fish.name), S(fish.name)), + tt_help = S("Places a water source and a @1 fish.", S(fish.name)), + extra_check = function(pos, placer) + local nn = minetest.get_node(pos).name + 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 + end, + }) + minetest.register_alias("mcl_fishing:bucket_" .. fish.techname, "mcl_buckets:bucket_" .. fish.techname) + end +end diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 6182b0471..20f4e6f26 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -516,30 +516,3 @@ minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, end end ) - --- Fish Buckets -fish_names = { - { techname = "cod", name = "Cod" }, - { techname = "salmon", name = "Salmon" }, - --{ techname = "pufferfish", name = "Pufferfish" } FIXME: Uncomment when pufferfish mobs are added. - { techname = "tropical_fish", name = "Tropical Fish" } -} - -for _, fish in pairs(fish_names) do - mcl_buckets.register_liquid({ - bucketname = "mcl_fishing:bucket_" .. fish.techname, - source_place = function(pos) - minetest.add_entity(pos, "mobs_mc:" .. fish.techname) - return "mcl_core:water_source" - end, - source_take = {"mobs_mc:" .. fish.techname}, - inventory_image = fish.techname .. "_bucket.png", - name = S("Bucket of @1", S(fish.name)), - longdesc = S("This bucket is filled with water and @1.", S(fish.name)), - usagehelp = S("Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.", S(fish.name), S(fish.name)), - tt_help = S("Places a water source and a @1 fish.", S(fish.name)), - extra_check = function(pos, placer) - return true, true - end, - }) -end diff --git a/mods/ITEMS/mcl_fishing/locale/template.txt b/mods/ITEMS/mcl_fishing/locale/template.txt index a0d3c9d21..a1544666b 100644 --- a/mods/ITEMS/mcl_fishing/locale/template.txt +++ b/mods/ITEMS/mcl_fishing/locale/template.txt @@ -16,10 +16,3 @@ Pufferfish= Pufferfish are a common species of fish and can be obtained by fishing. They can technically be eaten, but they are very bad for humans. Eating a pufferfish only restores 1 hunger point and will poison you very badly (which drains your health non-fatally) and causes serious food poisoning (which increases your hunger).= Catches fish in water= Very poisonous= -Cod= -Salmon= -Tropical Fish= -Bucket of @1= -This bucket is filled with water and @1.= -Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.= -Places a water source and a @1 fish.= From 64f810ac7631fb6e36d29ab64881444931a2287d Mon Sep 17 00:00:00 2001 From: PrairieAstronomer Date: Sat, 30 Jul 2022 12:40:04 -0600 Subject: [PATCH 2/2] Removed some unnessary code --- mods/ITEMS/mcl_buckets/register.lua | 65 ++++++++++++++--------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/register.lua b/mods/ITEMS/mcl_buckets/register.lua index 4a6425116..b54d0d2bf 100644 --- a/mods/ITEMS/mcl_buckets/register.lua +++ b/mods/ITEMS/mcl_buckets/register.lua @@ -1,7 +1,6 @@ local S = minetest.get_translator(minetest.get_current_modname()) local mod_mcl_core = minetest.get_modpath("mcl_core") local mod_mclx_core = minetest.get_modpath("mclx_core") -local mod_mobs_mc = minetest.get_modpath("mobs_mc") local has_awards = minetest.get_modpath("awards") local function sound_place(itemname, pos) @@ -121,36 +120,36 @@ minetest.register_craft({ }) -- Fish Buckets -if mod_mobs_mc then - fish_names = { - { techname = "cod", name = "Cod" }, - { techname = "salmon", name = "Salmon" }, - --{ techname = "pufferfish", name = "Pufferfish" } FIXME: Uncomment when pufferfish mobs are added. - { techname = "tropical_fish", name = "Tropical Fish" } - } - - for _, fish in pairs(fish_names) do - mcl_buckets.register_liquid({ - bucketname = "mcl_buckets:bucket_" .. fish.techname, - source_place = function(pos) - minetest.add_entity(pos, "mobs_mc:" .. fish.techname) - return "mcl_core:water_source" - end, - source_take = {"mobs_mc:" .. fish.techname}, - inventory_image = fish.techname .. "_bucket.png", - name = S("Bucket of @1", S(fish.name)), - longdesc = S("This bucket is filled with water and @1.", S(fish.name)), - usagehelp = S("Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.", S(fish.name), S(fish.name)), - tt_help = S("Places a water source and a @1 fish.", S(fish.name)), - extra_check = function(pos, placer) - local nn = minetest.get_node(pos).name - 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 - end, - }) - minetest.register_alias("mcl_fishing:bucket_" .. fish.techname, "mcl_buckets:bucket_" .. fish.techname) - end +fish_names = { + { techname = "cod", name = "Cod" }, + { techname = "salmon", name = "Salmon" }, + --{ techname = "pufferfish", name = "Pufferfish" } FIXME: Uncomment when pufferfish mobs are added. + { techname = "tropical_fish", name = "Tropical Fish" } +} + +for _, fish in pairs(fish_names) do + mcl_buckets.register_liquid({ + bucketname = "mcl_buckets:bucket_" .. fish.techname, + source_place = function(pos) + minetest.add_entity(pos, "mobs_mc:" .. fish.techname) + return "mcl_core:water_source" + end, + source_take = {"mobs_mc:" .. fish.techname}, + inventory_image = fish.techname .. "_bucket.png", + name = S("Bucket of @1", S(fish.name)), + longdesc = S("This bucket is filled with water and @1.", S(fish.name)), + usagehelp = S("Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.", S(fish.name), S(fish.name)), + tt_help = S("Places a water source and a @1 fish.", S(fish.name)), + extra_check = function(pos, placer) + 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 + else + return true, true + end + end, + }) + minetest.register_alias("mcl_fishing:bucket_" .. fish.techname, "mcl_buckets:bucket_" .. fish.techname) end +