diff --git a/patches/server/0010-Add-fakeplayer-support.patch b/patches/server/0010-Add-fakeplayer-support.patch index 89dd51d6..e2d51226 100644 --- a/patches/server/0010-Add-fakeplayer-support.patch +++ b/patches/server/0010-Add-fakeplayer-support.patch @@ -1486,7 +1486,7 @@ index 0000000000000000000000000000000000000000..7f02970f3e9422ef65f879f8c155993f +} diff --git a/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemAction.java b/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemAction.java new file mode 100644 -index 0000000000000000000000000000000000000000..269ec002acd01f4840d4462970253eee5b1ffe16 +index 0000000000000000000000000000000000000000..ea41f640c6c9a4b4ef50235bdac1ca0db9411099 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemAction.java @@ -0,0 +1,25 @@ @@ -1512,12 +1512,12 @@ index 0000000000000000000000000000000000000000..269ec002acd01f4840d4462970253eee + public boolean tick(ServerBot bot) { + bot.punch(); + bot.updateItemInMainHand(); -+ return bot.getInventory().getSelected().use(bot.getLevel(), bot, InteractionHand.MAIN_HAND).getResult() == InteractionResult.SUCCESS; ++ return bot.getInventory().getSelected().use(bot.getLevel(), bot, InteractionHand.MAIN_HAND).getResult().consumesAction(); + } +} diff --git a/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemOnAction.java b/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemOnAction.java new file mode 100644 -index 0000000000000000000000000000000000000000..227c69d00ec63829e1b264cde00ad1222027243e +index 0000000000000000000000000000000000000000..4fd0e2b121037f5a29a92bf9c567f33c9d7dd756 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemOnAction.java @@ -0,0 +1,31 @@ @@ -1547,7 +1547,7 @@ index 0000000000000000000000000000000000000000..227c69d00ec63829e1b264cde00ad122 + if (result != null && result.getType() == HitResult.Type.BLOCK) { + bot.punch(); + bot.updateItemInMainHand(); -+ return bot.gameMode.useItemOn(bot, bot.getLevel(), bot.getItemInHand(InteractionHand.MAIN_HAND), InteractionHand.MAIN_HAND, (BlockHitResult) result) == InteractionResult.SUCCESS; ++ return bot.gameMode.useItemOn(bot, bot.getLevel(), bot.getItemInHand(InteractionHand.MAIN_HAND), InteractionHand.MAIN_HAND, (BlockHitResult) result).consumesAction(); + } + return false; + }