1
0
Fork 0

Fix crash in mcl_maps

This commit is contained in:
Wuzzy 2020-03-12 06:45:23 +01:00
parent 28b2085492
commit f0ba364120
1 changed files with 12 additions and 12 deletions

View File

@ -28,6 +28,18 @@ minetest.register_craftitem("mcl_maps:empty_map", {
stack_max = 64, stack_max = 64,
}) })
local function has_item_in_hotbar(player, item)
-- Requirement: player carries the tool in the hotbar
local inv = player:get_inventory()
local hotbar = player:hud_get_hotbar_itemcount()
for i=1, hotbar do
if inv:get_stack("main", i):get_name() == item then
return true
end
end
return false
end
-- Checks if player is still allowed to display the minimap -- Checks if player is still allowed to display the minimap
local function update_minimap(player) local function update_minimap(player)
local creative = minetest.settings:get_bool("creative_mode") local creative = minetest.settings:get_bool("creative_mode")
@ -77,18 +89,6 @@ minetest.register_craft({
} }
}) })
local function has_item_in_hotbar(player, item)
-- Requirement: player carries the tool in the hotbar
local inv = player:get_inventory()
local hotbar = player:hud_get_hotbar_itemcount()
for i=1, hotbar do
if inv:get_stack("main", i):get_name() == item then
return true
end
end
return false
end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
update_minimap(player) update_minimap(player)
end) end)