From cd85365b97384412ce86f965cc5146de5599fa7c Mon Sep 17 00:00:00 2001 From: Sorzon <64833512+Sorzon@users.noreply.github.com> Date: Fri, 15 May 2020 20:22:43 +0200 Subject: [PATCH] FastUse bow bugfix and feature implementation. (#817) --- .../me/zeroeightsix/kami/module/modules/player/Fastuse.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/player/Fastuse.kt b/src/main/java/me/zeroeightsix/kami/module/modules/player/Fastuse.kt index 166d3a305..b0eb23b5c 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/player/Fastuse.kt +++ b/src/main/java/me/zeroeightsix/kami/module/modules/player/Fastuse.kt @@ -24,6 +24,7 @@ class Fastuse : Module() { private val delay = register(Settings.integerBuilder("Delay").withMinimum(0).withMaximum(20).withValue(0).build()) private val all = register(Settings.b("All", false)) private val bow = register(Settings.booleanBuilder().withName("Bow").withValue(true).withVisibility { !all.value }.build()) + private val chargeState = register(Settings.integerBuilder("Bow Charge").withMinimum(0).withMaximum(20).withValue(3).withVisibility { all.value || bow.value }.build()) private val expBottles = register(Settings.booleanBuilder().withName("Exp Bottles").withValue(true).withVisibility { !all.value }.build()) private val endCrystals = register(Settings.booleanBuilder().withName("End Crystals").withValue(true).withVisibility { !all.value }.build()) private val fireworks = register(Settings.booleanBuilder().withName("Fireworks").withValue(false).withVisibility { !all.value }.build()) @@ -33,9 +34,9 @@ class Fastuse : Module() { } override fun onUpdate() { - if (mc.player == null) return + if (mc.player == null || mc.player.isSpectator) return - if (!mc.player.isSpectator && (all.value || bow.value && mc.player.heldItemMainhand.getItem() is ItemBow && mc.player.isHandActive && mc.player.itemInUseMaxCount >= 3)) { + if ((all.value || bow.value) && mc.player.heldItemMainhand.getItem() is ItemBow && mc.player.isHandActive && mc.player.itemInUseMaxCount >= chargeState.value) { mc.player.connection.sendPacket(CPacketPlayerDigging(CPacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, mc.player.horizontalFacing)) mc.player.connection.sendPacket(CPacketPlayerTryUseItem(mc.player.activeHand)) mc.player.stopActiveHand()