Skip to content

Commit

Permalink
Do not crash with tenplus1's hopper mod
Browse files Browse the repository at this point in the history
There are multiple hopper mods and not all of them support the set_extra_container_info function,
so the mod crashes now if it is used together with an incompatible hopper mod.

To prevent the crash, execute the code for hopper compatibility if hopper and hopper.set_extra_container_info exist and not if a mod named hopper is installed.
  • Loading branch information
HybridDog committed Aug 25, 2024
1 parent 71a8a57 commit 044a91f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ minetest.register_alias("connected_chests:chest_locked_left",
minetest.register_alias("connected_chests:chest_locked_right",
"default:chest_locked_connected_right")

if minetest.get_modpath("hopper") then
if minetest.global_exists("hopper") and hopper.set_extra_container_info then
local function get_inventory(chest_right_pos)
local node_right = minetest.get_node(chest_right_pos)
if node_right.param2 > 3 then
Expand Down

0 comments on commit 044a91f

Please sign in to comment.