@@ -34,6 +34,16 @@ import com.lambda.client.event.events.PacketEvent
3434import com.lambda.client.event.events.RenderWorldEvent
3535import com.lambda.client.manager.managers.PlayerPacketManager.sendPlayerPacket
3636import com.lambda.client.module.Category
37+ import com.lambda.client.module.modules.client.Hud.primaryColor
38+ import com.lambda.client.module.modules.client.Hud.secondaryColor
39+ import com.lambda.client.module.modules.combat.AutoLog
40+ import com.lambda.client.module.modules.misc.AntiAFK
41+ import com.lambda.client.module.modules.misc.AutoObsidian
42+ import com.lambda.client.module.modules.movement.AntiHunger
43+ import com.lambda.client.module.modules.movement.Velocity
44+ import com.lambda.client.module.modules.player.AutoEat
45+ import com.lambda.client.module.modules.player.InventoryManager
46+ import com.lambda.client.module.modules.player.LagNotifier
3747import com.lambda.client.plugin.api.PluginModule
3848import com.lambda.client.process.PauseProcess
3949import com.lambda.client.setting.settings.impl.collection.CollectionSetting
@@ -230,10 +240,6 @@ internal object HighwayTools : PluginModule(
230240 private val packetLimiterMutex = Mutex ()
231241 private val packetLimiter = ArrayDeque <Long >()
232242
233- // Test
234- private val primaryColor = ColorHolder (255 , 255 , 255 )
235- private val secondaryColor = ColorHolder (255 , 255 , 255 )
236-
237243 // Stats
238244 private val simpleMovingAveragePlaces = ArrayDeque <Long >()
239245 private val simpleMovingAverageBreaks = ArrayDeque <Long >()
@@ -267,6 +273,16 @@ internal object HighwayTools : PluginModule(
267273
268274 onEnable {
269275 runSafeR {
276+ /* Turn on inventory manager if the users wants us to control it */
277+ if (toggleInventoryManager && InventoryManager .isDisabled && mode != Mode .TUNNEL ) {
278+ InventoryManager .enable()
279+ }
280+
281+ /* Turn on Auto Obsidian if the user wants us to control it. */
282+ if (toggleAutoObsidian && AutoObsidian .isDisabled && mode != Mode .TUNNEL ) {
283+ AutoObsidian .enable()
284+ }
285+
270286 startingBlockPos = player.flooredPosition
271287 currentBlockPos = startingBlockPos
272288 startingDirection = Direction .fromEntity(player)
@@ -290,6 +306,14 @@ internal object HighwayTools : PluginModule(
290306
291307 onDisable {
292308 runSafe {
309+ if (toggleInventoryManager && InventoryManager .isEnabled) {
310+ InventoryManager .disable()
311+ }
312+
313+ if (toggleAutoObsidian && AutoObsidian .isEnabled) {
314+ AutoObsidian .disable()
315+ }
316+
293317 BaritoneUtils .settings?.allowPlace?.value = baritoneSettingAllowPlace
294318 BaritoneUtils .settings?.allowBreak?.value = baritoneSettingAllowBreak
295319 BaritoneUtils .settings?.renderGoal?.value = baritoneSettingRenderGoal
@@ -334,6 +358,26 @@ internal object HighwayTools : PluginModule(
334358 MessageSendHelper .sendRawChatMessage(" §9> §cCheck altitude and make sure to build at Y: 120 for the correct height" )
335359 }
336360
361+ if (AntiHunger .isEnabled) {
362+ MessageSendHelper .sendRawChatMessage(" §9> §cAntiHunger does slow down block interactions." )
363+ }
364+
365+ if (LagNotifier .isDisabled) {
366+ MessageSendHelper .sendRawChatMessage(" §9> §cYou should activate LagNotifier to make the bot stop on server lag." )
367+ }
368+
369+ if (AutoEat .isDisabled) {
370+ MessageSendHelper .sendRawChatMessage(" §9> §cYou should activate AutoEat to not die on starvation." )
371+ }
372+
373+ if (AutoLog .isDisabled) {
374+ MessageSendHelper .sendRawChatMessage(" §9> §cYou should activate AutoLog to prevent most deaths when afk." )
375+ }
376+
377+ if (multiBuilding && Velocity .isDisabled) {
378+ MessageSendHelper .sendRawChatMessage(" §9> §cMake sure to enable Velocity to not get pushed from your mates." )
379+ }
380+
337381 if (material == fillerMat) {
338382 MessageSendHelper .sendRawChatMessage(" §9> §cMake sure to use §aTunnel Mode§c instead of having same material for both main and filler!" )
339383 }
@@ -357,11 +401,12 @@ internal object HighwayTools : PluginModule(
357401 safeListener<PacketEvent .Receive > { event ->
358402 when (event.packet) {
359403 is SPacketBlockChange -> {
360- val pos = (event.packet as SPacketBlockChange ).blockPosition
404+ val packet = event.packet as SPacketBlockChange
405+ val pos = packet.blockPosition
361406 if (! isInsideBlueprint(pos)) return @safeListener
362407
363408 val prev = world.getBlockState(pos).block
364- val new = (event. packet as SPacketBlockChange ) .getBlockState().block
409+ val new = packet.getBlockState().block
365410
366411 if (prev != new) {
367412 val task = if (pos == containerTask.blockPos) {
@@ -399,22 +444,25 @@ internal object HighwayTools : PluginModule(
399444 rubberbandTimer.reset()
400445 }
401446 is SPacketOpenWindow -> {
402- if ((event.packet as SPacketOpenWindow ).guiId == " minecraft:shulker_box" ||
403- (event.packet as SPacketOpenWindow ).guiId == " minecraft:container" ) {
447+ val packet = event.packet as SPacketOpenWindow
448+ if (packet.guiId == " minecraft:shulker_box" ||
449+ packet.guiId == " minecraft:container" ) {
404450 containerTask.isOpen = true
405451 event.cancel()
406452 }
407453 }
408454 is SPacketWindowItems -> {
455+ val packet = event.packet as SPacketWindowItems
409456 if (containerTask.isOpen) {
410- containerTask.inventory = (event. packet as SPacketWindowItems ) .itemStacks
411- containerTask.windowID = (event. packet as SPacketWindowItems ) .windowId
457+ containerTask.inventory = packet.itemStacks
458+ containerTask.windowID = packet.windowId
412459 event.cancel()
413460 }
414461 }
415462 is SPacketConfirmTransaction -> {
463+ val packet = event.packet as SPacketConfirmTransaction
416464 if (containerTask.isOpen && inventoryTasks.isNotEmpty()) {
417- if ((event. packet as SPacketConfirmTransaction ) .wasAccepted()) {
465+ if (packet.wasAccepted()) {
418466 inventoryTasks.peek()?.let {
419467 it.inventoryState = InventoryState .DONE
420468 }
@@ -445,6 +493,7 @@ internal object HighwayTools : PluginModule(
445493
446494 if (! rubberbandTimer.tick(rubberbandTimeout.toLong(), false ) ||
447495 PauseProcess .isActive ||
496+ AutoObsidian .isActive() ||
448497 (world.difficulty == EnumDifficulty .PEACEFUL &&
449498 player.dimension == 1 &&
450499 @Suppress(" UNNECESSARY_SAFE_CALL" )
@@ -1098,7 +1147,7 @@ internal object HighwayTools : PluginModule(
10981147 connection.sendPacket(CPacketCloseWindow (blockTask.windowID))
10991148
11001149 if (leaveEmptyShulkers &&
1101- blockTask.inventory.take(27 ).filter { it.item != Items .AIR }.size < 2 ) {
1150+ blockTask.inventory.take(27 ).filter { it.item != Items .AIR && ! InventoryManager .ejectList.contains(it.item.registryName.toString()) }.size < 2 ) {
11021151 if (debugMessages != DebugMessages .OFF ) {
11031152 if (! anonymizeStats) {
11041153 MessageSendHelper .sendChatMessage(" $chatName Left empty ${blockTask.block.localizedName} @(${blockTask.blockPos.asString()} )" )
@@ -1154,7 +1203,7 @@ internal object HighwayTools : PluginModule(
11541203 when (disableMode) {
11551204 DisableMode .ANTI_AFK -> {
11561205 MessageSendHelper .sendChatMessage(" $chatName Going into AFK mode." )
1157- // AntiAFK.enable()
1206+ AntiAFK .enable()
11581207 }
11591208 DisableMode .LOGOUT -> {
11601209 MessageSendHelper .sendChatMessage(" $chatName CAUTION: Logging of in X Minutes." )
@@ -1892,13 +1941,15 @@ internal object HighwayTools : PluginModule(
18921941
18931942 private fun SafeClientEvent.getEjectSlot (): Slot ? {
18941943 return player.inventorySlots.firstByStack {
1895- ! it.isEmpty
1944+ ! it.isEmpty &&
1945+ InventoryManager .ejectList.contains(it.item.registryName.toString())
18961946 }
18971947 }
18981948
18991949 private fun getFreeSlot (inventory : List <ItemStack >): Int {
19001950 return inventory.indexOfFirst {
1901- it.isEmpty
1951+ it.isEmpty ||
1952+ InventoryManager .ejectList.contains(it.item.registryName.toString())
19021953 }
19031954 }
19041955
0 commit comments