vl_pickblock: fix rightclick broken in survival

This commit is contained in:
Mikita Wiśniewski 2024-08-03 13:57:34 +07:00
parent 281c531533
commit 128676d098

View file

@ -20,6 +20,8 @@ local function pickblock(itemstack, placer, pointed_thing)
rnode = node.name rnode = node.name
end end
-- check if the picked node is already on the hotbar
-- if so, notify the player
local inv = placer:get_inventory() local inv = placer:get_inventory()
for i=1,placer:hud_get_hotbar_itemcount() do for i=1,placer:hud_get_hotbar_itemcount() do
local stack = inv:get_stack("main", i) local stack = inv:get_stack("main", i)
@ -35,12 +37,10 @@ end
minetest.override_item("", { minetest.override_item("", {
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
if minetest.is_creative_enabled(placer:get_player_name()) then if mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) then
if mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) then return
return elseif minetest.is_creative_enabled(placer:get_player_name()) then
else return pickblock(itemstack, placer, pointed_thing)
return pickblock(itemstack, placer, pointed_thing)
end
end end
end end
}) })