@@ -3,7 +3,7 @@ package com.lambda.module.modules.player
33import com.lambda.Lambda.mc
44import com.lambda.context.SafeContext
55import com.lambda.event.events.*
6- import com.lambda.event.listener.SafeListener.Companion.listener
6+ import com.lambda.event.listener.SafeListener.Companion.listen
77import com.lambda.graphics.renderer.esp.DynamicAABB
88import com.lambda.graphics.renderer.esp.builders.buildFilled
99import com.lambda.graphics.renderer.esp.builders.buildOutline
@@ -15,7 +15,7 @@ import com.lambda.module.Module
1515import com.lambda.module.modules.client.TaskFlow
1616import com.lambda.module.tag.ModuleTag
1717import com.lambda.util.BlockUtils.blockState
18- import com.lambda.util.math.MathUtils. lerp
18+ import com.lambda.util.math.lerp
1919import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap
2020import net.minecraft.block.BlockState
2121import net.minecraft.enchantment.EnchantmentHelper
@@ -133,35 +133,35 @@ object PacketMine : Module(
133133 private var doubleBreakReturnSlot = 0
134134
135135 init {
136- listener< InteractionEvent . BreakingProgress . Pre > {
136+ listen< PlayerEvent . Breaking . Update > {
137137 swingingNextAttack = false
138138 }
139139
140- listener< InteractionEvent . BlockAttack . Pre > {
140+ listen< PlayerEvent . Attack . Block > {
141141 it.cancel()
142142 if (swingOnManual) swingMainHand()
143143
144144 if (swingingNextAttack) cancelNextSwing = true
145145 else swingingNextAttack = true
146146
147- if (checkAddBlockQueuePos(it.pos)) return @listener
147+ if (checkAddBlockQueuePos(it.pos)) return @listen
148148
149149 currentMiningBlock.forEach { ctx ->
150150 ctx?.apply {
151151 if (it.pos != pos) return @forEach
152152
153153 val primary = breakType == BreakType .Primary
154154
155- if (! primary || (breakState == BreakState .ReBreaking && reBreak != ReBreakMode .Standard )) return @listener
155+ if (! primary || (breakState == BreakState .ReBreaking && reBreak != ReBreakMode .Standard )) return @listen
156156
157- if (miningProgress < breakThreshold) return @listener
157+ if (miningProgress < breakThreshold) return @listen
158158
159159 runBetweenHandlers(ProgressStage .EndPre , ProgressStage .EndPost , pos, { lastValidBestTool }) {
160160 packetStopBreak(pos)
161161 onBlockBreak()
162162 }
163163
164- return @listener
164+ return @listen
165165 }
166166 }
167167
@@ -174,17 +174,17 @@ object PacketMine : Module(
174174 startBreaking(it.pos)
175175 }
176176
177- listener< EntityEvent .SwingHand > {
178- if (! cancelNextSwing) return @listener
177+ listen< PlayerEvent .SwingHand > {
178+ if (! cancelNextSwing) return @listen
179179
180180 cancelNextSwing = false
181181 it.cancel()
182182 }
183183
184- listener <TickEvent .Pre >(1 ) {
184+ listen <TickEvent .Pre >(1 ) {
185185 updateCounters()
186186
187- if (shouldWaitForQueuePause()) return @listener
187+ if (shouldWaitForQueuePause()) return @listen
188188
189189 currentMiningBlock.forEach { ctx ->
190190 ctx?.apply {
@@ -317,11 +317,11 @@ object PacketMine : Module(
317317 }
318318 }
319319
320- listener <TickEvent .Post > {
320+ listen <TickEvent .Post > {
321321 if (doubleBreakSwapped && doubleBreakSwappedCounter >= 1 ) returnToOriginalDoubleBreakSlot()
322322 }
323323
324- listener <WorldEvent .BlockUpdate > {
324+ listen <WorldEvent .BlockUpdate > {
325325 currentMiningBlock.forEach { ctx ->
326326 ctx?.apply {
327327 if (it.pos != pos || ! isStateBroken(pos.blockState(world), it.state)) return @forEach
@@ -334,8 +334,8 @@ object PacketMine : Module(
334334 }
335335 }
336336
337- listener <RotationEvent .Update > {
338- if (! rotate.isEnabled()) return @listener
337+ listen <RotationEvent .Update > {
338+ if (! rotate.isEnabled()) return @listen
339339
340340 rotationPosition?.let { pos ->
341341 lastNonEmptyState?.let { state ->
@@ -348,25 +348,25 @@ object PacketMine : Module(
348348 }
349349 } ? : run { expectedRotation = null }
350350
351- if (! rotated || ! waitingToReleaseRotation) return @listener
351+ if (! rotated || ! waitingToReleaseRotation) return @listen
352352
353353 releaseRotateDelayCounter--
354354
355- if (releaseRotateDelayCounter > 0 ) return @listener
355+ if (releaseRotateDelayCounter > 0 ) return @listen
356356
357357 waitingToReleaseRotation = false
358358 rotationPosition = null
359359 rotated = false
360360 }
361361
362- listener <RotationEvent .Post > {
363- if (! rotate.isEnabled()) return @listener
362+ listen <RotationEvent .Post > {
363+ if (! rotate.isEnabled()) return @listen
364364
365365 expectedRotation?.let { expectedRot ->
366366 rotationPosition?.let { pos ->
367367 if (it.context != expectedRot) {
368368 pausedForRotation = true
369- return @listener
369+ return @listen
370370 }
371371
372372 val boxList = lastNonEmptyState?.getOutlineShape(world, pos)?.boundingBoxes?.map { it.offset(pos) }
@@ -377,15 +377,15 @@ object PacketMine : Module(
377377 } else
378378 pausedForRotation = true
379379
380- return @listener
380+ return @listen
381381 }
382382 }
383383
384384 onRotationComplete = null
385385 pausedForRotation = false
386386 }
387387
388- listener <RenderEvent .World > {
388+ listen <RenderEvent .World > {
389389 renderer.clear()
390390
391391 currentMiningBlock.forEach { ctx -> ctx?.run { buildRenders() } }
@@ -398,17 +398,17 @@ object PacketMine : Module(
398398 listOf (Box (0.0 , 0.0 , 0.0 , 1.0 , 1.0 , 1.0 ))
399399
400400 boxes = boxes.map {
401- val reSized = lerp(Box (it.center, it.center), it, renderQueueSize.toDouble() )
401+ val reSized = lerp(renderQueueSize.toDouble(), Box (it.center, it.center), it)
402402 reSized.offset(pos)
403403 }
404404
405405 val indexFactor = blockQueue.indexOf(pos).toDouble() / blockQueue.size.toDouble()
406406
407407 val fillColour = if (queueFillColourMode == ColourMode .Static ) queueStaticFillColour
408- else lerp(queueStartFillColour, queueEndFillColour, indexFactor )
408+ else lerp(indexFactor, queueStartFillColour, queueEndFillColour )
409409
410410 val outlineColour = if (queueOutlineColourMode == ColourMode .Static ) queueStaticOutlineColour
411- else lerp(queueStartOutlineColour, queueEndOutlineColour, indexFactor )
411+ else lerp(indexFactor, queueStartOutlineColour, queueEndOutlineColour )
412412
413413 boxes.forEach { box ->
414414 val dynamicAABB = DynamicAABB ()
@@ -992,15 +992,15 @@ object PacketMine : Module(
992992 val paused = (pauseWhileUsingItems && player.isUsingItem) || pausedForRotation || awaitingQueueBreak
993993
994994 val fillColour = if (fillColourMode == ColourMode .Dynamic ) {
995- val lerpColour = lerp(startFillColour, endFillColour, currentFactor.toDouble())
995+ val lerpColour = lerp(currentFactor.toDouble(), startFillColour, endFillColour )
996996 if (! paused) {
997997 lastLerpFillColour = lerpColour
998998 lerpColour
999999 } else lastLerpFillColour ? : startFillColour
10001000 } else staticFillColour
10011001
10021002 val outlineColour = if (outlineColourMode == ColourMode .Dynamic ) {
1003- val lerpColour = lerp(startOutlineColour, endOutlineColour, currentFactor.toDouble())
1003+ val lerpColour = lerp(currentFactor.toDouble(), startOutlineColour, endOutlineColour )
10041004 if (! paused) {
10051005 lastLerpOutlineColour = lerpColour
10061006 lerpColour
@@ -1040,17 +1040,17 @@ object PacketMine : Module(
10401040 private fun getLerpBox (box : Box , factor : Float ): Box {
10411041 val boxCenter = Box (box.center, box.center)
10421042 return when (renderMode) {
1043- RenderMode .Out -> lerp(boxCenter, box, factor.toDouble())
1043+ RenderMode .Out -> lerp(factor.toDouble(), boxCenter, box )
10441044
1045- RenderMode .In -> lerp(box, boxCenter, factor.toDouble())
1045+ RenderMode .In -> lerp(factor.toDouble(), box, boxCenter )
10461046
10471047 RenderMode .InOut ->
1048- if (factor >= 0.5f ) lerp(boxCenter, box, (factor.toDouble() - 0.5 ) * 2 )
1049- else lerp(box, boxCenter, factor.toDouble() * 2 )
1048+ if (factor >= 0.5f ) lerp((factor.toDouble() - 0.5 ) * 2 , boxCenter, box )
1049+ else lerp(factor.toDouble() * 2 , box, boxCenter )
10501050
10511051 RenderMode .OutIn -> {
1052- if (factor >= 0.5f ) lerp(box, boxCenter, (factor.toDouble() - 0.5 ) * 2 )
1053- else lerp(boxCenter, box, factor.toDouble() * 2 )
1052+ if (factor >= 0.5f ) lerp((factor.toDouble() - 0.5 ) * 2 , box, boxCenter )
1053+ else lerp(factor.toDouble() * 2 , boxCenter, box )
10541054 }
10551055
10561056 else -> box
0 commit comments