1
0
Fork 0

Fix access to ender inventory without an ender chest

This commit is contained in:
Lizzy Fleckenstein 2021-12-02 16:19:59 +01:00
parent d3015edeb9
commit e6b200aaf3
Signed by untrusted user: LizzyFleckenstein03
GPG Key ID: 06927A5199D6C9B2
1 changed files with 14 additions and 0 deletions

View File

@ -1055,6 +1055,20 @@ minetest.register_on_joinplayer(function(player)
inv:set_size("enderchest", 9*3) inv:set_size("enderchest", 9*3)
end) 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({ minetest.register_craft({
output = "mcl_chests:ender_chest", output = "mcl_chests:ender_chest",
recipe = { recipe = {