From f57220f78496f65c58f0e3d2816417d3350cbe50 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 20 Sep 2023 05:57:49 +0000 Subject: [PATCH 1/5] Fix Server crash (Issue ##3939) Fixes the error of pointed_thing being nil (null) by first checking to see if it exists, and if not, exit the on_place call back. --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 4ccb9bb1b..2cc8b23c8 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -86,7 +86,7 @@ local bamboo_def = { on_rotate = on_rotate, on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then + if pointed_thing and pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node. return itemstack end local node = minetest.get_node(pointed_thing.under) @@ -277,6 +277,10 @@ local bamboo_block_def = { _mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. on_place = function(itemstack, placer, pointed_thing) + if not pointed_thing then -- make sure that pointed_thing is not null + return itemstack + end + local pos = pointed_thing.under if mcl_bamboo.is_protected(pos, placer) then From b2ebcf5d4fbc10635cde690a6a82be0fe0d8c6b6 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 20 Sep 2023 06:07:13 +0000 Subject: [PATCH 2/5] Readme Change Putting my name back into the credits in the mod. --- mods/ITEMS/mcl_bamboo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_bamboo/README.md b/mods/ITEMS/mcl_bamboo/README.md index b1f91e641..469914294 100644 --- a/mods/ITEMS/mcl_bamboo/README.md +++ b/mods/ITEMS/mcl_bamboo/README.md @@ -3,7 +3,7 @@ mcl_bamboo This mod adds working, familiar bamboo nodes to your Mineclone 2 world. -Code: MineClone2 dev team. Original (basic) bamboo code by: Small Joker. +Code: Michieal. Original (basic, used as inspiration) bamboo code by: Small Joker. Updates to the code: Mineclone Dev Team, Michieal. License for code: GPLv3. License for images / textures: CC-BY-SA except where noted. From eafe6627d825a20b9f3e38602d45f2240cd3bb49 Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 26 Sep 2023 18:35:12 +0000 Subject: [PATCH 3/5] Extra checks placed in. --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 2cc8b23c8..1c7e99a61 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -86,7 +86,12 @@ local bamboo_def = { on_rotate = on_rotate, on_place = function(itemstack, placer, pointed_thing) - if pointed_thing and pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node. + + if not pointed_thing then + return itemstack + end + + if pointed_thing.type ~= "node" then return itemstack end local node = minetest.get_node(pointed_thing.under) @@ -201,7 +206,7 @@ local bamboo_def = { local node_above_name = minetest.get_node(pointed_thing.above).name mcl_bamboo.mcl_log("\n\n\nnode_above name: " .. node_above_name) if node_above_name ~= "mcl_core:water_source" and node_above_name ~= "mcl_core:lava_source" - and node_above_name ~= "mcl_nether:nether_lava_source" then + and node_above_name ~= "mcl_nether:nether_lava_source" then local _, position = minetest.item_place(place_item, placer, pointed_thing, fdir) if position then if not minetest.is_creative_enabled(placer:get_player_name()) then @@ -276,8 +281,11 @@ local bamboo_block_def = { _mcl_hardness = 2, _mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. on_place = function(itemstack, placer, pointed_thing) + if not pointed_thing then + return itemstack + end - if not pointed_thing then -- make sure that pointed_thing is not null + if pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node. return itemstack end From e9d994b74d43715b4bda8339714e70a09c85b6c2 Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 26 Sep 2023 18:57:17 +0000 Subject: [PATCH 4/5] Fix Campifires API to not crash the server. Fixed the error in Campfires' On_RightClick() to not error out when called with a non-existent pointed_thing. --- mods/ITEMS/mcl_campfires/api.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index 212beefbe..cd23a964b 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -332,6 +332,9 @@ function mcl_campfires.register_campfire(name, def) elseif minetest.get_item_group(itemstack:get_name(), "campfire_cookable") ~= 0 then mcl_campfires.take_item(pos, node, player, itemstack) else + if not pointed_thing then + return itemstack + end minetest.item_place_node(itemstack, player, pointed_thing) end end, From e8c658658df675fcad71bc2f7231e910276bde96 Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 26 Sep 2023 18:59:51 +0000 Subject: [PATCH 5/5] Update Credits. --- mods/ITEMS/mcl_campfires/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_campfires/README.md b/mods/ITEMS/mcl_campfires/README.md index 188134233..5390e982f 100644 --- a/mods/ITEMS/mcl_campfires/README.md +++ b/mods/ITEMS/mcl_campfires/README.md @@ -9,9 +9,10 @@ Authors: Gerold55 - Code Start + Models? PrairieWind - Improved and Cleaned Up Code, and added the soul campfire and crafting recipes. cora - Added burning damage. -DinoNuggies4665 - Cooking logic implemented -thunder1035 - Redesigned model and texture tweaks -AncientMariner - Changed smoke to particle spawner and tweaked particle configuration. +DinoNuggies4665 - Cooking logic implemented. +thunder1035 - Redesigned model and texture tweaks. +AncientMariner - Changed smoke to particle spawner and tweaked particle configuration. +Michieal - Fixed misc. errors. License of media ----------------