localize wielditem in crossbow.lua (Fix #1901)

This commit is contained in:
NO11 2021-11-13 15:19:34 +00:00
parent bd14918543
commit 642b9db035

View file

@ -92,7 +92,7 @@ local function get_arrow(player)
return arrow_stack, arrow_stack_id return arrow_stack, arrow_stack_id
end end
local function player_shoot_arrow(itemstack, player, power, damage, is_critical) local function player_shoot_arrow(wielditem, player, power, damage, is_critical)
local has_multishot_enchantment = mcl_enchanting.has_enchantment(player:get_wielded_item(), "multishot") local has_multishot_enchantment = mcl_enchanting.has_enchantment(player:get_wielded_item(), "multishot")
local arrow_itemstring = wielditem:get_meta():get("arrow") local arrow_itemstring = wielditem:get_meta():get("arrow")
@ -286,7 +286,7 @@ end)
controls.register_on_press(function(player, key, time) controls.register_on_press(function(player, key, time)
if key~="LMB" then return end if key~="LMB" then return end
wielditem = player:get_wielded_item() local wielditem = player:get_wielded_item()
if wielditem:get_name()=="mcl_bows:crossbow_loaded" or wielditem:get_name()=="mcl_bows:crossbow_loaded_enchanted" then if wielditem:get_name()=="mcl_bows:crossbow_loaded" or wielditem:get_name()=="mcl_bows:crossbow_loaded_enchanted" then
local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name()) local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
local speed, damage local speed, damage