From e6b200aaf3b0a56860272a57012f24ccfa7182ff Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 2 Dec 2021 16:19:59 +0100 Subject: [PATCH] Fix access to ender inventory without an ender chest --- mods/ITEMS/mcl_chests/init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index d87ae2a1db..ad5c781f74 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -1055,6 +1055,20 @@ minetest.register_on_joinplayer(function(player) inv:set_size("enderchest", 9*3) end) +minetest.register_allow_player_inventory_action(function(player, action, inv, info) + if inv:get_location().type == "player" and ( + action == "move" and (info.from_list == "enderchest" or info.to_list == "enderchest") + or action == "put" and info.listname == "enderchest" + or action == "take" and info.listname == "enderchest" + ) then + local def = player:get_wielded_item():get_definition() + + if not minetest.find_node_near(player:get_pos(), def and def.range or ItemStack():get_definition().range, "mcl_chests:ender_chest_small", true) then + return 0 + end + end +end) + minetest.register_craft({ output = "mcl_chests:ender_chest", recipe = {