From 30d36ccecd81c28c9cdd84e56de31c4bea324430 Mon Sep 17 00:00:00 2001 From: TimelessUsername Date: Fri, 19 May 2023 08:24:07 +0300 Subject: [PATCH 1/8] Vanish command additions. --- .../client/command/commands/VanishCommand.kt | 6 ++-- .../command/commands/VanishNoKillCommand.kt | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/main/kotlin/com/lambda/client/command/commands/VanishNoKillCommand.kt diff --git a/src/main/kotlin/com/lambda/client/command/commands/VanishCommand.kt b/src/main/kotlin/com/lambda/client/command/commands/VanishCommand.kt index 270ab6302..dca832814 100644 --- a/src/main/kotlin/com/lambda/client/command/commands/VanishCommand.kt +++ b/src/main/kotlin/com/lambda/client/command/commands/VanishCommand.kt @@ -17,16 +17,16 @@ object VanishCommand : ClientCommand( vehicle = player.ridingEntity?.also { player.dismountRidingEntity() world.removeEntityFromWorld(it.entityId) - sendChatMessage("Vehicle " + formatValue(it.name) + " removed") + sendChatMessage("Vehicle " + formatValue(it.name) + " ID: " + formatValue(it.entityId) + " dismounted and removed.") } } else { vehicle?.let { it.isDead = false world.addEntityToWorld(it.entityId, it) player.startRiding(it, true) - sendChatMessage("Vehicle " + formatValue(it.name) + " created") vehicle = null - } ?: sendChatMessage("Not riding any vehicles") + sendChatMessage("Vehicle " + formatValue(it.name) + " ID: " + formatValue(it.entityId) + " created and mounted.") + } ?: sendChatMessage("Not riding any vehicles.") } } } diff --git a/src/main/kotlin/com/lambda/client/command/commands/VanishNoKillCommand.kt b/src/main/kotlin/com/lambda/client/command/commands/VanishNoKillCommand.kt new file mode 100644 index 000000000..de9a8339f --- /dev/null +++ b/src/main/kotlin/com/lambda/client/command/commands/VanishNoKillCommand.kt @@ -0,0 +1,31 @@ +package com.lambda.client.command.commands + +import com.lambda.client.command.ClientCommand +import com.lambda.client.util.text.MessageSendHelper.sendChatMessage +import com.lambda.client.util.text.formatValue +import net.minecraft.entity.Entity + +object VanishNoKillCommand : ClientCommand( + name = "vanishNoKill", + description = "Allows you to vanish using an entity, without killing the entity off." +) { + private var vehicle: Entity? = null + + init { + executeSafe { + if (player.ridingEntity != null && vehicle == null) { + vehicle = player.ridingEntity?.also { + player.dismountRidingEntity() + sendChatMessage("Vehicle " + formatValue(it.name) + " ID: " + formatValue(it.entityId) + " dismounted.") + } + } else { + vehicle?.let { + it.isDead = false + player.startRiding(it, true) + sendChatMessage("Vehicle " + formatValue(it.name) + " ID: " + formatValue(it.entityId) + " mounted.") + vehicle = null + } ?: sendChatMessage("Not riding any vehicles.") + } + } + } +} \ No newline at end of file From abbebb4934c49b6412edf7f7f906cddd8b8e7230 Mon Sep 17 00:00:00 2001 From: TimelessUsername Date: Fri, 19 May 2023 08:52:47 +0300 Subject: [PATCH 2/8] NewChunks modification --- .../com/lambda/client/module/modules/render/NewChunks.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt index 1ea57074d..310734d10 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt @@ -47,6 +47,7 @@ object NewChunks : Module( private val distantChunkColor by setting("Distant Chunk Color", ColorHolder(100, 100, 100, 100), true, { renderMode != RenderMode.WORLD }, "Chunks that are not in render distance and not in baritone cache") private val newChunkColor by setting("New Chunk Color", ColorHolder(255, 0, 0, 100), true, { renderMode != RenderMode.WORLD }) private val saveNewChunks by setting("Save New Chunks", false) + private val renderOld by setting("Inverse Render Mode.", false, description = "Inverse the old chunk rendering logic. Do not draw grid lines. (Performance Mode)") private val saveOption by setting("Save Option", SaveOption.EXTRA_FOLDER, { saveNewChunks }) private val saveInRegionFolder by setting("In Region", false, { saveNewChunks }) private val alsoSaveNormalCoords by setting("Save Normal Coords", false, { saveNewChunks }) @@ -136,7 +137,10 @@ object NewChunks : Module( (player.chunkCoordX + chunkX) shl 4, (player.chunkCoordZ + chunkZ) shl 4 ) ?: false - if (!chunk.isLoaded && !isCachedChunk) { + if (!renderOld && !chunk.isLoaded && !isCachedChunk) { + distantChunkRects.add(Pair(pos0, pos1)) + } + else if (renderOld && (chunk.isLoaded || isCachedChunk)){ distantChunkRects.add(Pair(pos0, pos1)) } chunkGridRects.add(Pair(pos0, pos1)) @@ -144,7 +148,7 @@ object NewChunks : Module( } } if (distantChunkRects.isNotEmpty()) RenderUtils2D.drawRectFilledList(it.vertexHelper, distantChunkRects, distantChunkColor) - if (it.chunkLines && chunkGridRects.isNotEmpty()) RenderUtils2D.drawRectOutlineList(it.vertexHelper, chunkGridRects, 0.3f, chunkGridColor) + if (!renderOld && it.chunkLines && chunkGridRects.isNotEmpty()) RenderUtils2D.drawRectOutlineList(it.vertexHelper, chunkGridRects, 0.3f, chunkGridColor) val newChunkRects: MutableList> = mutableListOf() chunks.keys.forEach { chunk -> From 7a449c04439bdaed922e16ac76f9d95397372cfc Mon Sep 17 00:00:00 2001 From: TimelessUsername Date: Fri, 19 May 2023 11:20:14 +0300 Subject: [PATCH 3/8] NewChunks modification --- .../client/gui/hudgui/elements/world/Radar.kt | 6 +- .../client/module/modules/render/NewChunks.kt | 123 ++++++++++-------- 2 files changed, 75 insertions(+), 54 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/gui/hudgui/elements/world/Radar.kt b/src/main/kotlin/com/lambda/client/gui/hudgui/elements/world/Radar.kt index 08bb4f8b6..17721783e 100644 --- a/src/main/kotlin/com/lambda/client/gui/hudgui/elements/world/Radar.kt +++ b/src/main/kotlin/com/lambda/client/gui/hudgui/elements/world/Radar.kt @@ -5,7 +5,6 @@ import com.lambda.client.event.SafeClientEvent import com.lambda.client.event.events.RenderRadarEvent import com.lambda.client.gui.hudgui.HudElement import com.lambda.client.manager.managers.FriendManager -import com.lambda.client.module.modules.client.GuiColors import com.lambda.client.util.EntityUtils import com.lambda.client.util.EntityUtils.isNeutral import com.lambda.client.util.EntityUtils.isPassive @@ -28,7 +27,8 @@ internal object Radar : HudElement( description = "Shows entities and new chunks" ) { private val zoom by setting("Zoom", 3f, 1f..10f, 0.1f) - private val chunkLines by setting("Chunk Lines", true) + private val chunkLines by setting("Chunk Lines", true, description = "Causes performance loss on high zoom.") + private val radarBackground by setting("Radar Background Color", ColorHolder(31, 10, 18, 235)) private val players = setting("Players", true) private val passive = setting("Passive Mobs", false) @@ -54,7 +54,7 @@ internal object Radar : HudElement( private fun SafeClientEvent.drawBorder(vertexHelper: VertexHelper) { glTranslated(radius.toDouble(), radius.toDouble(), 0.0) - drawCircleFilled(vertexHelper, radius = radius.toDouble(), color = GuiColors.backGround) + drawCircleFilled(vertexHelper, radius = radius.toDouble(), color = radarBackground) drawCircleOutline(vertexHelper, radius = radius.toDouble(), lineWidth = 1.8f, color = primaryColor) glRotatef(player.rotationYaw + 180, 0f, 0f, -1f) } diff --git a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt index 310734d10..58b2a1267 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt @@ -44,38 +44,43 @@ object NewChunks : Module( private val relative by setting("Relative", false, description = "Renders the chunks at relative Y level to player") private val renderMode by setting("Render Mode", RenderMode.BOTH) private val chunkGridColor by setting("Grid Color", ColorHolder(255, 0, 0, 100), true, { renderMode != RenderMode.WORLD }) - private val distantChunkColor by setting("Distant Chunk Color", ColorHolder(100, 100, 100, 100), true, { renderMode != RenderMode.WORLD }, "Chunks that are not in render distance and not in baritone cache") + private val oldChunkColor by setting("Old Chunk Color", ColorHolder(100, 100, 100, 100), true, { renderMode != RenderMode.WORLD }, "Chunks that are not in render distance and not in baritone cache") private val newChunkColor by setting("New Chunk Color", ColorHolder(255, 0, 0, 100), true, { renderMode != RenderMode.WORLD }) - private val saveNewChunks by setting("Save New Chunks", false) - private val renderOld by setting("Inverse Render Mode.", false, description = "Inverse the old chunk rendering logic. Do not draw grid lines. (Performance Mode)") - private val saveOption by setting("Save Option", SaveOption.EXTRA_FOLDER, { saveNewChunks }) - private val saveInRegionFolder by setting("In Region", false, { saveNewChunks }) - private val alsoSaveNormalCoords by setting("Save Normal Coords", false, { saveNewChunks }) - private val closeFile by setting("Close file", false, { saveNewChunks }, consumer = { _, _ -> + private val saveChunks by setting("Save Chunks", false) + private val saveOption by setting("Save Option", SaveOption.EXTRA_FOLDER, { saveChunks }) + private val alsoSaveNormalCoords by setting("Save Normal Coords", false, { saveChunks }) + private val saveMode by setting("Save Mode", SaveMode.OLD, { saveChunks }, description = "Save old / new chunks") + + private val closeFile by setting("Close file", false, { saveChunks }, consumer = { _, _ -> logWriterClose() MessageSendHelper.sendChatMessage("$chatName Saved file to $path!") false }) - private val openNewChunksFolder by setting("Open NewChunks Folder...", false, { saveNewChunks }, consumer = { _, _ -> + private val openNewChunksFolder by setting("Open NewChunks Folder...", false, { saveChunks }, consumer = { _, _ -> FolderUtils.openFolder(FolderUtils.newChunksFolder) false }) private val yOffset by setting("Y Offset", 0, -256..256, 4, fineStep = 1, description = "Render offset in Y axis") - private val color by setting("Color", ColorHolder(255, 64, 64, 200), description = "Highlighting color") + private val color by setting("Color", ColorHolder(255, 64, 64, 200), description = "World highlighting color.") private val thickness by setting("Thickness", 1.5f, 0.1f..4.0f, 0.1f, description = "Thickness of the highlighting square") - private val range by setting("Render Range", 512, 64..2048, 32, description = "Maximum range for chunks to be highlighted") - private val removeMode by setting("Remove Mode", RemoveMode.AGE, description = "Mode to use for removing chunks") + private val range by setting("Render Range", 512, 64..2048, 32,{ renderMode != RenderMode.RADAR }, description = "Maximum range for chunks to be highlighted in the world.") + private val removeMode by setting("Remove Mode", RemoveMode.AGE, description = "Mode to use for removing chunks. Unload might generate bad data on saving feature and never will cause performance issues eventually.") private val maxAge by setting("Max age", 10, 1..600, 1, { removeMode == RemoveMode.AGE }, description = "Maximum age of chunks since recording", unit = "m") + private val maxDist by setting("Max Distance", 10000, 1000..100000, 1000, { removeMode == RemoveMode.DIST }, description = "Maximum distance to chunks until unload.", unit = "Meter / Blocks") private var lastSetting = LastSetting() private var logWriter: PrintWriter? = null - private val chunks = ConcurrentHashMap() + private val newChunks = ConcurrentHashMap() + private val oldChunks = ConcurrentHashMap() + private val savedChunks = ConcurrentHashMap() private val timer = TickTimer(TimeUnit.SECONDS) init { onDisable { logWriterClose() - chunks.clear() + oldChunks.clear() + newChunks.clear() + savedChunks.clear() MessageSendHelper.sendChatMessage("$chatName Saved and cleared chunks!") } @@ -91,7 +96,17 @@ object NewChunks : Module( && timer.tick(5) ) { val currentTime = System.currentTimeMillis() - chunks.values.removeIf { chunkAge -> currentTime - chunkAge > maxAge * 60 * 1000 } + newChunks.values.removeIf { chunkAge -> currentTime - chunkAge > maxAge * 60 * 1000 } + oldChunks.values.removeIf { chunkAge -> currentTime - chunkAge > maxAge * 60 * 1000 } + savedChunks.values.removeIf { chunkAge -> currentTime - chunkAge > maxAge * 60 * 1000 } + } + else if (it.phase == TickEvent.Phase.END + && removeMode == RemoveMode.DIST + && timer.tick(5) + ){ + newChunks.keys.removeIf { chunkKey -> player.distanceTo(chunkKey) > maxDist } + oldChunks.keys.removeIf { chunkKey -> player.distanceTo(chunkKey) > maxDist } + savedChunks.keys.removeIf { chunkKey -> player.distanceTo(chunkKey) > maxDist } } } @@ -105,7 +120,7 @@ object NewChunks : Module( val buffer = LambdaTessellator.buffer - chunks.filter { player.distanceTo(it.key) < range }.keys.forEach { chunkPos -> + newChunks.filter { player.distanceTo(it.key) < range }.keys.forEach { chunkPos -> buffer.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR) buffer.pos(chunkPos.xStart.toDouble(), y, chunkPos.zStart.toDouble()).color(color.r, color.g, color.b, color.a).endVertex() buffer.pos(chunkPos.xEnd + 1.toDouble(), y, chunkPos.zStart.toDouble()).color(color.r, color.g, color.b, color.a).endVertex() @@ -121,66 +136,76 @@ object NewChunks : Module( safeListener { val playerOffset = Vec2d((player.posX - (player.chunkCoordX shl 4)), (player.posZ - (player.chunkCoordZ shl 4))) val chunkDist = (it.radius * it.scale).toInt() shr 4 + val newChunkRects: MutableList> = mutableListOf() // at high zooms (further zoomed out) there will be thousands of rects being rendered // buffering rects here to reduce GL calls and improve FPS - val distantChunkRects: MutableList> = mutableListOf() + val oldChunkRects: MutableList> = mutableListOf() val chunkGridRects: MutableList> = mutableListOf() for (chunkX in -chunkDist..chunkDist) { for (chunkZ in -chunkDist..chunkDist) { val pos0 = getChunkPos(chunkX, chunkZ, playerOffset, it.scale) val pos1 = getChunkPos(chunkX + 1, chunkZ + 1, playerOffset, it.scale) - if (isSquareInRadius(pos0, pos1, it.radius)) { val chunk = world.getChunk(player.chunkCoordX + chunkX, player.chunkCoordZ + chunkZ) + val chunkPos = ChunkPos((player.chunkCoordX + chunkX), (player.chunkCoordZ + chunkZ)) val isCachedChunk = BaritoneUtils.primary?.worldProvider?.currentWorld?.cachedWorld?.isCached( (player.chunkCoordX + chunkX) shl 4, (player.chunkCoordZ + chunkZ) shl 4 ) ?: false - if (!renderOld && !chunk.isLoaded && !isCachedChunk) { - distantChunkRects.add(Pair(pos0, pos1)) + if (!chunk.isLoaded && isCachedChunk){ + oldChunkRects.add(Pair(pos0, pos1)) + } + else if (newChunks.containsKey(chunkPos)){ + newChunkRects.add(Pair(pos0, pos1)) } - else if (renderOld && (chunk.isLoaded || isCachedChunk)){ - distantChunkRects.add(Pair(pos0, pos1)) + else if (chunk.isLoaded) { + oldChunkRects.add(Pair(pos0, pos1)) } - chunkGridRects.add(Pair(pos0, pos1)) + if (it.chunkLines) chunkGridRects.add(Pair(pos0, pos1)) } } } - if (distantChunkRects.isNotEmpty()) RenderUtils2D.drawRectFilledList(it.vertexHelper, distantChunkRects, distantChunkColor) - if (!renderOld && it.chunkLines && chunkGridRects.isNotEmpty()) RenderUtils2D.drawRectOutlineList(it.vertexHelper, chunkGridRects, 0.3f, chunkGridColor) - - val newChunkRects: MutableList> = mutableListOf() - chunks.keys.forEach { chunk -> - val pos0 = getChunkPos(chunk.x - player.chunkCoordX, chunk.z - player.chunkCoordZ, playerOffset, it.scale) - val pos1 = getChunkPos(chunk.x - player.chunkCoordX + 1, chunk.z - player.chunkCoordZ + 1, playerOffset, it.scale) - - if (isSquareInRadius(pos0, pos1, it.radius)) { - newChunkRects.add(Pair(pos0, pos1)) - } - } + if (oldChunkRects.isNotEmpty()) RenderUtils2D.drawRectFilledList(it.vertexHelper, oldChunkRects, oldChunkColor) + if (it.chunkLines && chunkGridRects.isNotEmpty()) RenderUtils2D.drawRectOutlineList(it.vertexHelper, chunkGridRects, 0.3f, chunkGridColor) if (newChunkRects.isNotEmpty()) RenderUtils2D.drawRectFilledList(it.vertexHelper, newChunkRects, newChunkColor) } safeListener { event -> if (event.packet is SPacketChunkData - && !event.packet.isFullChunk ) { val chunkPos = ChunkPos(event.packet.chunkX, event.packet.chunkZ) - chunks[chunkPos] = System.currentTimeMillis() - if (saveNewChunks) saveNewChunk(chunkPos) + if (!event.packet.isFullChunk) { + oldChunks.remove(chunkPos) + newChunks.putIfAbsent(chunkPos, System.currentTimeMillis()) + } + else if (!newChunks.containsKey(chunkPos)){ + oldChunks.putIfAbsent(chunkPos, System.currentTimeMillis()) + } } } safeListener { if (removeMode == RemoveMode.UNLOAD) - chunks.remove(it.chunk.pos) + newChunks.remove(it.chunk.pos) + oldChunks.remove(it.chunk.pos) + savedChunks.remove(it.chunk.pos) + if (saveChunks && !savedChunks.containsKey(it.chunk.pos)) { + if (saveMode == SaveMode.OLD && oldChunks.containsKey(it.chunk.pos)) { + saveChunk(it.chunk.pos) + savedChunks[it.chunk.pos] = System.currentTimeMillis() + } + else if (saveMode == SaveMode.NEW && newChunks.containsKey(it.chunk.pos)) { + saveChunk(it.chunk.pos) + savedChunks[it.chunk.pos] = System.currentTimeMillis() + } + } } } // needs to be synchronized so no data gets lost - private fun SafeClientEvent.saveNewChunk(chunk: ChunkPos) { - saveNewChunk(testAndGetLogWriter(), getNewChunkInfo(chunk)) + private fun SafeClientEvent.saveChunk(chunk: ChunkPos) { + saveChunk(testAndGetLogWriter(), getNewChunkInfo(chunk)) } private fun getNewChunkInfo(chunk: ChunkPos): String { @@ -262,11 +287,6 @@ object NewChunks : Module( file = File(file, "DIM$dimension") } - // maybe we want to save it in region folder - if (saveInRegionFolder) { - file = File(file, "region") - } - file = File(file, "logs") val date = SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(Date()) file = File(file, mc.session.username + "_" + date + ".csv") // maybe don't safe the name, actually. But I also don't want to make another option... @@ -317,7 +337,7 @@ object NewChunks : Module( return Vec2d((x shl 4).toDouble(), (z shl 4).toDouble()).minus(playerOffset).div(scale.toDouble()) } - private fun saveNewChunk(log: PrintWriter?, data: String) { + private fun saveChunk(log: PrintWriter?, data: String) { log!!.println(data) } @@ -327,16 +347,19 @@ object NewChunks : Module( @Suppress("unused") private enum class RemoveMode { - UNLOAD, AGE, NEVER + UNLOAD, AGE, DIST, NEVER } enum class RenderMode { WORLD, RADAR, BOTH } + enum class SaveMode { + NEW, OLD + } + private class LastSetting { var lastSaveOption: SaveOption? = null - var lastInRegion = false var lastSaveNormal = false var dimension = 0 var ip: String? = null @@ -352,15 +375,13 @@ object NewChunks : Module( fun testChange(event: SafeClientEvent): Boolean { // these somehow include the test whether its null return saveOption != lastSaveOption - || saveInRegionFolder != lastInRegion - || alsoSaveNormalCoords != lastSaveNormal + || (alsoSaveNormalCoords && alsoSaveNormalCoords != lastSaveNormal) || dimension != event.player.dimension || mc.currentServerData?.serverIP != ip } private fun update(event: SafeClientEvent) { lastSaveOption = saveOption - lastInRegion = saveInRegionFolder lastSaveNormal = alsoSaveNormalCoords dimension = event.player.dimension ip = mc.currentServerData?.serverIP From 9b94bf361de91597b311ba7ea62d8878d4328208 Mon Sep 17 00:00:00 2001 From: TimelessUsername Date: Fri, 19 May 2023 11:32:36 +0300 Subject: [PATCH 4/8] NewChunks modification --- .../com/lambda/client/module/modules/render/NewChunks.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt index 58b2a1267..94b81aafa 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt @@ -134,6 +134,7 @@ object NewChunks : Module( } safeListener { + if (renderMode == RenderMode.WORLD) return@safeListener val playerOffset = Vec2d((player.posX - (player.chunkCoordX shl 4)), (player.posZ - (player.chunkCoordZ shl 4))) val chunkDist = (it.radius * it.scale).toInt() shr 4 val newChunkRects: MutableList> = mutableListOf() @@ -186,10 +187,11 @@ object NewChunks : Module( } safeListener { - if (removeMode == RemoveMode.UNLOAD) + if (removeMode == RemoveMode.UNLOAD) { newChunks.remove(it.chunk.pos) oldChunks.remove(it.chunk.pos) savedChunks.remove(it.chunk.pos) + } if (saveChunks && !savedChunks.containsKey(it.chunk.pos)) { if (saveMode == SaveMode.OLD && oldChunks.containsKey(it.chunk.pos)) { saveChunk(it.chunk.pos) From da8aad668de5e995a17343890c685bc0b3b1fbae Mon Sep 17 00:00:00 2001 From: TimelessUsername Date: Fri, 19 May 2023 11:37:28 +0300 Subject: [PATCH 5/8] NewChunks modification --- .../com/lambda/client/module/modules/render/NewChunks.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt index 94b81aafa..6be4644d6 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt @@ -112,7 +112,6 @@ object NewChunks : Module( safeListener { if (renderMode == RenderMode.RADAR) return@safeListener - val y = yOffset.toDouble() + if (relative) getInterpolatedPos(player, LambdaTessellator.pTicks()).y else 0.0 glLineWidth(thickness) @@ -154,12 +153,12 @@ object NewChunks : Module( (player.chunkCoordX + chunkX) shl 4, (player.chunkCoordZ + chunkZ) shl 4 ) ?: false - if (!chunk.isLoaded && isCachedChunk){ - oldChunkRects.add(Pair(pos0, pos1)) - } - else if (newChunks.containsKey(chunkPos)){ + if (newChunks.containsKey(chunkPos)){ newChunkRects.add(Pair(pos0, pos1)) } + else if (!chunk.isLoaded && isCachedChunk){ + oldChunkRects.add(Pair(pos0, pos1)) + } else if (chunk.isLoaded) { oldChunkRects.add(Pair(pos0, pos1)) } From b6795bc2c5fd9f90b03fc5eb02ca50d6d34c982b Mon Sep 17 00:00:00 2001 From: TimelessUsername Date: Fri, 19 May 2023 11:53:47 +0300 Subject: [PATCH 6/8] NewChunks modification --- .../com/lambda/client/module/modules/render/NewChunks.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt index 6be4644d6..ca6ee9843 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/render/NewChunks.kt @@ -43,8 +43,8 @@ object NewChunks : Module( ) { private val relative by setting("Relative", false, description = "Renders the chunks at relative Y level to player") private val renderMode by setting("Render Mode", RenderMode.BOTH) - private val chunkGridColor by setting("Grid Color", ColorHolder(255, 0, 0, 100), true, { renderMode != RenderMode.WORLD }) - private val oldChunkColor by setting("Old Chunk Color", ColorHolder(100, 100, 100, 100), true, { renderMode != RenderMode.WORLD }, "Chunks that are not in render distance and not in baritone cache") + private val chunkGridColor by setting("Grid Color", ColorHolder(255, 0, 0, 100), true, { renderMode != RenderMode.WORLD }, description = "Might cause performance issues on high zoom. Disable @ Client>HudEditor>Radar>Chunk Lines") + private val oldChunkColor by setting("Old Chunk Color", ColorHolder(100, 100, 100, 100), true, { renderMode != RenderMode.WORLD }, description = "Old chunks. (Baritone cache + Fullchunk() = True). Some distant Chunks might be false positives.") private val newChunkColor by setting("New Chunk Color", ColorHolder(255, 0, 0, 100), true, { renderMode != RenderMode.WORLD }) private val saveChunks by setting("Save Chunks", false) private val saveOption by setting("Save Option", SaveOption.EXTRA_FOLDER, { saveChunks }) From f6a06404f94e0cb8c10a19944edcd1c43978a66d Mon Sep 17 00:00:00 2001 From: TimelessUsername Date: Sat, 20 May 2023 09:57:24 +0300 Subject: [PATCH 7/8] Chest Stealer module additions --- .../command/commands/BlackListCommand.kt | 65 +++++++++++++++++++ .../command/commands/WhiteListCommand.kt | 65 +++++++++++++++++++ .../module/modules/player/ChestStealer.kt | 43 +++++++++--- 3 files changed, 164 insertions(+), 9 deletions(-) create mode 100644 src/main/kotlin/com/lambda/client/command/commands/BlackListCommand.kt create mode 100644 src/main/kotlin/com/lambda/client/command/commands/WhiteListCommand.kt diff --git a/src/main/kotlin/com/lambda/client/command/commands/BlackListCommand.kt b/src/main/kotlin/com/lambda/client/command/commands/BlackListCommand.kt new file mode 100644 index 000000000..f6d2fdb65 --- /dev/null +++ b/src/main/kotlin/com/lambda/client/command/commands/BlackListCommand.kt @@ -0,0 +1,65 @@ +package com.lambda.client.command.commands + +import com.lambda.client.command.ClientCommand +import com.lambda.client.module.modules.player.ChestStealer +import com.lambda.client.util.text.MessageSendHelper + +// TODO: Remove once GUI has List +object BlackListCommand : ClientCommand( + name = "blackList", + description = "Modify blackList items for ChestStealer module" +) { + init { + literal("add", "+") { + item("item") { itemArg -> + execute("Add an item to the BlackList") { + val itemName = itemArg.value.registryName!!.toString() + + if (ChestStealer.blackList.contains(itemName)) { + MessageSendHelper.sendErrorMessage("&c$itemName is already added to the BlackList") + } else { + ChestStealer.blackList.add(itemName) + MessageSendHelper.sendChatMessage("$itemName has been added to the BlackList") + } + } + } + } + + literal("del", "remove", "-") { + item("item") { itemArg -> + execute("Remove an item from the BlackList") { + val itemName = itemArg.value.registryName!!.toString() + + if (!ChestStealer.blackList.contains(itemName)) { + MessageSendHelper.sendErrorMessage("&c$itemName is not in the BlackList") + } else { + ChestStealer.blackList.remove(itemName) + MessageSendHelper.sendChatMessage("$itemName has been removed from the BlackList") + } + } + } + } + + literal("list") { + execute("List items in the BlackList") { + var list = ChestStealer.blackList.joinToString() + if (list.isEmpty()) list = "&cNo items!" + MessageSendHelper.sendChatMessage("BlackList:\n$list") + } + } + + literal("reset", "default") { + execute("Reset the BlackList to defaults") { + ChestStealer.blackList.resetValue() + MessageSendHelper.sendChatMessage("BlackList to defaults") + } + } + + literal("clear") { + execute("Set the BlackList to nothing") { + ChestStealer.blackList.clear() + MessageSendHelper.sendChatMessage("BlackList was cleared") + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/command/commands/WhiteListCommand.kt b/src/main/kotlin/com/lambda/client/command/commands/WhiteListCommand.kt new file mode 100644 index 000000000..94e4d9152 --- /dev/null +++ b/src/main/kotlin/com/lambda/client/command/commands/WhiteListCommand.kt @@ -0,0 +1,65 @@ +package com.lambda.client.command.commands + +import com.lambda.client.command.ClientCommand +import com.lambda.client.module.modules.player.ChestStealer +import com.lambda.client.util.text.MessageSendHelper + +// TODO: Remove once GUI has List +object WhiteListCommand : ClientCommand( + name = "whiteList", + description = "Modify whiteList items for ChestStealer module" +) { + init { + literal("add", "+") { + item("item") { itemArg -> + execute("Add an item to the WhiteList") { + val itemName = itemArg.value.registryName!!.toString() + + if (ChestStealer.whiteList.contains(itemName)) { + MessageSendHelper.sendErrorMessage("&c$itemName is already added to the WhiteList") + } else { + ChestStealer.whiteList.add(itemName) + MessageSendHelper.sendChatMessage("$itemName has been added to the WhiteList") + } + } + } + } + + literal("del", "remove", "-") { + item("item") { itemArg -> + execute("Remove an item from the WhiteList") { + val itemName = itemArg.value.registryName!!.toString() + + if (!ChestStealer.whiteList.contains(itemName)) { + MessageSendHelper.sendErrorMessage("&c$itemName is not in the WhiteList") + } else { + ChestStealer.whiteList.remove(itemName) + MessageSendHelper.sendChatMessage("$itemName has been removed from the WhiteList") + } + } + } + } + + literal("list") { + execute("List items in the WhiteList") { + var list = ChestStealer.whiteList.joinToString() + if (list.isEmpty()) list = "&cNo items!" + MessageSendHelper.sendChatMessage("WhiteList:\n$list") + } + } + + literal("reset", "default") { + execute("Reset the WhiteList to defaults") { + ChestStealer.whiteList.resetValue() + MessageSendHelper.sendChatMessage("WhiteList to defaults") + } + } + + literal("clear") { + execute("Set the WhiteList to nothing") { + ChestStealer.whiteList.clear() + MessageSendHelper.sendChatMessage("WhiteList was cleared") + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/module/modules/player/ChestStealer.kt b/src/main/kotlin/com/lambda/client/module/modules/player/ChestStealer.kt index 404e62dba..4683ca2d3 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/player/ChestStealer.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/player/ChestStealer.kt @@ -3,6 +3,7 @@ package com.lambda.client.module.modules.player import com.lambda.client.event.SafeClientEvent import com.lambda.client.module.Category import com.lambda.client.module.Module +import com.lambda.client.setting.settings.impl.collection.CollectionSetting import com.lambda.client.util.TickTimer import com.lambda.client.util.TimeUnit import com.lambda.client.util.items.* @@ -23,11 +24,26 @@ object ChestStealer : Module( description = "Automatically steal or store items from containers", category = Category.PLAYER ) { + + private val defaultWhiteList = linkedSetOf( + "minecraft:netherrack", + "minecraft:cobblestone" + ) + private val defaultBlackList = linkedSetOf( + "minecraft:netherrack", + "minecraft:cobblestone" + ) + val mode by setting("Mode", Mode.TOGGLE) private val movingMode by setting("Moving Mode", MovingMode.QUICK_MOVE) - private val ignoreEjectItem by setting("Ignores Eject Item", false, description = "Ignore AutoEject items in InventoryManager") private val delay by setting("Delay", 5, 0..20, 1, description = "Move stack delay", unit = " ticks") - private val onlyShulkers by setting("Only Shulkers", false, description = "Only move shulker boxes") + private val selectionMode by setting("Item Selection Mode", SelectionMode.ANY, description = "Items to move.") + val whiteList = setting(CollectionSetting("WhiteList", defaultWhiteList)) + val blackList = setting(CollectionSetting("BlackList", defaultBlackList)) + + //private val onlyShulkers by setting("Only Shulkers", false, description = "Only move shulker boxes") + //private val ignoreEjectItem by setting("Ignores Eject Item", false, description = "Ignore AutoEject items in InventoryManager") + enum class Mode { ALWAYS, TOGGLE, MANUAL @@ -37,6 +53,10 @@ object ChestStealer : Module( QUICK_MOVE, PICKUP, THROW } + private enum class SelectionMode { + ANY, SHULKERS, WHITELIST, BLACKLIST, EJECT_IGNORE + } + private enum class ContainerMode(val offset: Int) { STEAL(36), STORE(0) } @@ -137,12 +157,14 @@ object ChestStealer : Module( for (slot in 0 until getContainerSlotSize()) { val item = container[slot].item if (item == Items.AIR) continue - if (ignoreEjectItem && InventoryManager.ejectList.contains(item.registryName.toString())) continue - if (!onlyShulkers || item is ItemShulkerBox) { - return slot + when (selectionMode){ + SelectionMode.ANY -> return slot + SelectionMode.SHULKERS -> if (item is ItemShulkerBox) return slot + SelectionMode.WHITELIST -> if (whiteList.contains(item.registryName.toString())) return slot + SelectionMode.BLACKLIST -> if (blackList.contains(item.registryName.toString())) return slot + SelectionMode.EJECT_IGNORE -> if (!InventoryManager.ejectList.contains(item.registryName.toString())) return slot } } - return null } @@ -154,11 +176,14 @@ object ChestStealer : Module( val item = container[slot].item if (item == Items.AIR) continue if (player.openContainer is ContainerShulkerBox && item is ItemShulkerBox) continue - if (!onlyShulkers || item is ItemShulkerBox) { - return slot + when (selectionMode){ + SelectionMode.ANY -> return slot + SelectionMode.SHULKERS -> if (item is ItemShulkerBox) return slot + SelectionMode.WHITELIST -> if (whiteList.contains(item.registryName.toString())) return slot + SelectionMode.BLACKLIST -> if (blackList.contains(item.registryName.toString())) return slot + SelectionMode.EJECT_IGNORE -> if (!InventoryManager.ejectList.contains(item.registryName.toString())) return slot } } - return null } From 32263ad103e5211ca1a2b7ab2fe924c0ba45b4b2 Mon Sep 17 00:00:00 2001 From: TimelessUsername Date: Sat, 20 May 2023 10:10:29 +0300 Subject: [PATCH 8/8] Chest Stealer module additions --- .../com/lambda/client/module/modules/player/ChestStealer.kt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/player/ChestStealer.kt b/src/main/kotlin/com/lambda/client/module/modules/player/ChestStealer.kt index 4683ca2d3..b47bd0f0e 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/player/ChestStealer.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/player/ChestStealer.kt @@ -26,11 +26,9 @@ object ChestStealer : Module( ) { private val defaultWhiteList = linkedSetOf( - "minecraft:netherrack", "minecraft:cobblestone" ) private val defaultBlackList = linkedSetOf( - "minecraft:netherrack", "minecraft:cobblestone" ) @@ -41,10 +39,6 @@ object ChestStealer : Module( val whiteList = setting(CollectionSetting("WhiteList", defaultWhiteList)) val blackList = setting(CollectionSetting("BlackList", defaultBlackList)) - //private val onlyShulkers by setting("Only Shulkers", false, description = "Only move shulker boxes") - //private val ignoreEjectItem by setting("Ignores Eject Item", false, description = "Ignore AutoEject items in InventoryManager") - - enum class Mode { ALWAYS, TOGGLE, MANUAL }