FastUse bow bugfix and feature implementation. (#817)

This commit is contained in:
Sorzon 2020-05-15 20:22:43 +02:00 committed by GitHub
parent 73a365b990
commit cd85365b97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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()