Skip to content

Commit e0acb2f

Browse files
committed
whens and requests
1 parent 0d513e1 commit e0acb2f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import com.lambda.event.events.MouseEvent
2727
import com.lambda.event.events.TickEvent
2828
import com.lambda.event.listener.SafeListener.Companion.listen
2929
import com.lambda.interaction.material.StackSelection.Companion.selectStack
30-
import com.lambda.interaction.request.hotbar.HotbarManager
3130
import com.lambda.interaction.request.hotbar.HotbarRequest
3231
import com.lambda.interaction.request.inventory.InventoryRequest.Companion.inventoryRequest
3332
import com.lambda.module.Module
@@ -163,10 +162,10 @@ object BetterFirework : Module(
163162
fun onInteract() =
164163
runSafe {
165164
when {
166-
!fireworkInteract -> false
167-
player.inventory.selectedStack?.item != Items.FIREWORK_ROCKET -> false
168-
player.isGliding -> false // No need to do special magic if we are already holding fireworks and flying
169-
mc.crosshairTarget != null && mc.crosshairTarget!!.type != HitResult.Type.MISS && !fireworkInteractCancel -> false
165+
!fireworkInteract ||
166+
player.inventory.selectedStack?.item != Items.FIREWORK_ROCKET ||
167+
player.isGliding || // No need to do special magic if we are already holding fireworks and flying
168+
(mc.crosshairTarget != null && mc.crosshairTarget!!.type != HitResult.Type.MISS && !fireworkInteractCancel) -> false
170169
else -> {
171170
mc.itemUseCooldown += 4
172171
val cancelInteract = player.canTakeoff || fireworkInteractCancel
@@ -187,8 +186,8 @@ object BetterFirework : Module(
187186
fun onPick() =
188187
runSafe {
189188
when {
190-
mc.crosshairTarget?.type == HitResult.Type.BLOCK && !middleClickCancel -> false
191-
!activateButton.isMouseBind || activateButton.mouse != mc.options.pickItemKey.boundKey.code -> false
189+
(mc.crosshairTarget?.type == HitResult.Type.BLOCK && !middleClickCancel) ||
190+
(!activateButton.isMouseBind || activateButton.mouse != mc.options.pickItemKey.boundKey.code) ||
192191
takeoffState != TakeoffState.None -> false // Prevent using multiple times
193192
else -> {
194193
if (player.canOpenElytra || player.isGliding) {
@@ -219,7 +218,7 @@ object BetterFirework : Module(
219218

220219
stack.bestItemMatch(player.hotbar)
221220
?.let {
222-
val request = HotbarManager.request(HotbarRequest(player.hotbar.indexOf(it), this@BetterFirework, keepTicks = 0))
221+
val request = HotbarRequest(player.hotbar.indexOf(it), this@BetterFirework, keepTicks = 0)
223222
.submit(queueIfClosed = false)
224223
if (request.done) {
225224
interaction.interactItem(player, Hand.MAIN_HAND)
@@ -238,7 +237,7 @@ object BetterFirework : Module(
238237
inventoryRequest {
239238
swap(swapSlotId, hotbarSlotToSwapWith)
240239
action {
241-
val request = HotbarManager.request(HotbarRequest(hotbarSlotToSwapWith, this@BetterFirework, keepTicks = 0, nowOrNothing = true))
240+
val request = HotbarRequest(hotbarSlotToSwapWith, this@BetterFirework, keepTicks = 0, nowOrNothing = true)
242241
.submit(queueIfClosed = false)
243242
if (request.done) {
244243
interaction.interactItem(player, Hand.MAIN_HAND)

0 commit comments

Comments
 (0)