1
0
Fork 0

Add compatibility for other forks which do not have mcl_hunger.is_eating API

This commit is contained in:
Eliy21 2024-01-28 14:54:41 +00:00
parent ff049eb321
commit c790cd049d
1 changed files with 10 additions and 2 deletions

View File

@ -293,7 +293,11 @@ local function handle_blocking(player)
if not_blocking then
minetest.after(0.25, function()
rmb = player:get_player_control().RMB
if (not_blocking or not shield_in_offhand) and shield_in_hand and rmb and not mcl_hunger.is_eating(player) and mcl_shields.players[player].cooldown == 0 then
local is_eating = false
if mcl_hunger.is_eating then
is_eating = mcl_hunger.is_eating(player)
end
if (not_blocking or not shield_in_offhand) and shield_in_hand and rmb and not is_eating and mcl_shields.players[player].cooldown == 0 then
player_shield.blocking = 2
set_shield(player, true, 2)
else
@ -325,7 +329,11 @@ local function handle_blocking(player)
if not_blocking then
minetest.after(0.25, function()
rmb = player:get_player_control().RMB
if (not_blocking or not shield_in_hand) and shield_in_offhand and rmb and offhand_can_block and not mcl_hunger.is_eating(player) and mcl_shields.players[player].cooldown == 0 then
local is_eating = false
if mcl_hunger.is_eating then
is_eating = mcl_hunger.is_eating(player)
end
if (not_blocking or not shield_in_hand) and shield_in_offhand and rmb and offhand_can_block and not is_eating and mcl_shields.players[player].cooldown == 0 then
player_shield.blocking = 1
set_shield(player, true, 1)
else