@@ -141,16 +141,18 @@ object CrystalAura : Module(
141141 }
142142 }
143143
144- init {
145- setDefaultAutomationConfig {
146- applyEdits {
147- hideAllGroupsExcept(buildConfig, rotationConfig, hotbarConfig, inventoryConfig)
148- buildConfig.apply {
149- hide(::pathing, ::stayInRange, ::collectDrops, ::spleefEntities,
150- ::maxPendingActions, ::actionTimeout, ::maxBuildDependencies, ::breakBlocks, ::interactBlocks)
151- }
152- }
153- }
144+ init {
145+ setDefaultAutomationConfig {
146+ applyEdits {
147+ hideAllGroupsExcept(buildConfig, rotationConfig, hotbarConfig, inventoryConfig)
148+ buildConfig.apply {
149+ hide(
150+ ::pathing, ::stayInRange, ::collectDrops, ::spleefEntities,
151+ ::maxPendingActions, ::actionTimeout, ::maxBuildDependencies, ::breakBlocks, ::interactBlocks
152+ )
153+ }
154+ }
155+ }
154156
155157 // Async ticking
156158 fixedRateTimer(
@@ -276,15 +278,16 @@ object CrystalAura : Module(
276278 blueprint[mutableBlockPos]
277279 }.filter { it.hasCrystal }.maxByOrNull { it.priority }?.explode()
278280
279- best.place()
280- }
281+ best.place()
282+ }
281283
282- private fun SafeContext.placeInternal (opportunity : Opportunity , hand : Hand ) {
283- connection.sendPacket {
284- PlayerInteractBlockC2SPacket (
285- hand, BlockHitResult (opportunity.crystalPosition, opportunity.side, opportunity.blockPos, false ), 0
286- )
287- }
284+ private fun SafeContext.placeInternal (opportunity : Opportunity , hand : Hand ) {
285+ interaction.syncSelectedSlot()
286+ connection.sendPacket {
287+ PlayerInteractBlockC2SPacket (
288+ hand, BlockHitResult (opportunity.crystalPosition, opportunity.side, opportunity.blockPos, false ), 0
289+ )
290+ }
288291
289292 player.swingHand(hand)
290293 }
@@ -476,19 +479,22 @@ object CrystalAura : Module(
476479 if (rotate && ! rotationRequest { rotation(placeRotation) }.submit().done)
477480 return @runSafe
478481
479- val selection = selectStack { isItem(Items .END_CRYSTAL ) }
480- if (swap &&
481- (swapHand == Hand .MAIN_HAND && player.mainHandStack.item != selection.item) ||
482- (swapHand == Hand .OFF_HAND && player.offHandStack.item != selection.item)
483- ) runSafeAutomated {
484- val crystalSlot = player.hotbarStacks.indexOfFirst { selection.filterStack(it) }
485- if (crystalSlot != - 1 ) {
486- if (! HotbarRequest (crystalSlot, this ).submit().done) return @runSafe
487- else return @runSafeAutomated
488- }
489- val swapTo = when (swapHand) { Hand .MAIN_HAND -> HotbarContainer ; Hand .OFF_HAND -> OffHandContainer }
490- if (! selection.transfer(swapTo)) return @runSafe
491- }
482+ val selection = selectStack { isItem(Items .END_CRYSTAL ) }
483+ if ((swapHand == Hand .MAIN_HAND && player.mainHandStack.item != selection.item) ||
484+ (swapHand == Hand .OFF_HAND && player.offHandStack.item != selection.item)
485+ ) runSafeAutomated {
486+ if (! swap) return @runSafe
487+ var crystalSlot = player.hotbarStacks.indexOfFirst { selection.filterStack(it) }
488+ if (crystalSlot < 0 ) {
489+ val swapTo = when (swapHand) {
490+ Hand .MAIN_HAND -> HotbarContainer
491+ Hand .OFF_HAND -> OffHandContainer
492+ }
493+ if (! selection.transfer(swapTo)) return @runSafe
494+ crystalSlot = player.hotbarStacks.indexOfFirst { selection.filterStack(it) }
495+ }
496+ if (! HotbarRequest (crystalSlot, this ).submit().done) return @runSafe
497+ }
492498
493499 placeTimer.runSafeIfPassed(placeDelay.milliseconds) {
494500 placeInternal(this @Opportunity, swapHand)
0 commit comments