diff --git a/src/main/java/net/ccbluex/liquidbounce/cape/CapeAPI.kt b/src/main/java/net/ccbluex/liquidbounce/cape/CapeAPI.kt index ec05f46acad..222674bebee 100644 --- a/src/main/java/net/ccbluex/liquidbounce/cape/CapeAPI.kt +++ b/src/main/java/net/ccbluex/liquidbounce/cape/CapeAPI.kt @@ -15,7 +15,7 @@ import java.io.File import java.util.* import net.ccbluex.liquidbounce.utils.client.ClientUtils.LOGGER -object CapeAPI : MinecraftInstance() { +object CapeAPI : MinecraftInstance { private val capesCache = File(dir, "capes").apply { mkdir() diff --git a/src/main/java/net/ccbluex/liquidbounce/cape/CapeService.kt b/src/main/java/net/ccbluex/liquidbounce/cape/CapeService.kt index ab39d2e5198..9e791350adc 100644 --- a/src/main/java/net/ccbluex/liquidbounce/cape/CapeService.kt +++ b/src/main/java/net/ccbluex/liquidbounce/cape/CapeService.kt @@ -38,7 +38,7 @@ import java.util.concurrent.atomic.AtomicLong * We know this might cause sometimes users to not have their capes shown immediately when account switches, but we can reduce the stress * on the API and the connection of the user. */ -object CapeService : Listenable, MinecraftInstance() { +object CapeService : Listenable, MinecraftInstance { /** * The client cape user diff --git a/src/main/java/net/ccbluex/liquidbounce/chat/Client.kt b/src/main/java/net/ccbluex/liquidbounce/chat/Client.kt index 27bead9cea1..2f758f752a3 100644 --- a/src/main/java/net/ccbluex/liquidbounce/chat/Client.kt +++ b/src/main/java/net/ccbluex/liquidbounce/chat/Client.kt @@ -28,7 +28,7 @@ import net.ccbluex.liquidbounce.utils.login.UserUtils import java.net.URI import java.util.* -abstract class Client : ClientListener, MinecraftInstance() { +abstract class Client : ClientListener, MinecraftInstance { internal var channel: Channel? = null var username = "" diff --git a/src/main/java/net/ccbluex/liquidbounce/features/command/Command.kt b/src/main/java/net/ccbluex/liquidbounce/features/command/Command.kt index 49b1bb82570..421697e2039 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/command/Command.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/command/Command.kt @@ -10,7 +10,7 @@ import net.ccbluex.liquidbounce.utils.client.MinecraftInstance import net.ccbluex.liquidbounce.utils.client.asResourceLocation import net.ccbluex.liquidbounce.utils.client.playSound -abstract class Command(val command: String, vararg val alias: String) : MinecraftInstance() { +abstract class Command(val command: String, vararg val alias: String) : MinecraftInstance { /** * Execute commands with provided [args] */ diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/Module.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/Module.kt index 4a9a2bdc3a0..7da333a5947 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/Module.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/Module.kt @@ -26,6 +26,8 @@ import net.ccbluex.liquidbounce.utils.timing.TickedActions.TickScheduler import org.lwjgl.input.Keyboard import java.util.concurrent.CopyOnWriteArraySet +private val SPLIT_REGEX = "(?<=[a-z])(?=[A-Z])".toRegex() + open class Module( val name: String, val category: Category, @@ -35,12 +37,12 @@ open class Module( private val forcedDescription: String? = null, // Adds spaces between lowercase and uppercase letters (KillAura -> Kill Aura) - val spacedName: String = name.split("(?<=[a-z])(?=[A-Z])".toRegex()).joinToString(separator = " "), + val spacedName: String = name.splitToSequence(SPLIT_REGEX).joinToString(separator = " "), val subjective: Boolean = category == Category.RENDER, val gameDetecting: Boolean = canBeEnabled, val hideModule: Boolean = false, - ) : MinecraftInstance(), Listenable { +) : MinecraftInstance, Listenable { // Value that determines whether the module should depend on GameDetector private val onlyInGameValue = boolean("OnlyInGame", true, subjective = true) { GameDetector.state } diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/flymodes/FlyMode.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/flymodes/FlyMode.kt index 1b52198558b..0f502699d27 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/flymodes/FlyMode.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/flymodes/FlyMode.kt @@ -3,7 +3,7 @@ package net.ccbluex.liquidbounce.features.module.modules.movement.flymodes import net.ccbluex.liquidbounce.event.* import net.ccbluex.liquidbounce.utils.client.MinecraftInstance -open class FlyMode(val modeName: String) : MinecraftInstance() { +open class FlyMode(val modeName: String) : MinecraftInstance { open fun onMove(event: MoveEvent) {} open fun onPacket(event: PacketEvent) {} open fun onRender3D(event: Render3DEvent) {} diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/longjumpmodes/LongJumpMode.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/longjumpmodes/LongJumpMode.kt index 91946142138..f790ed91763 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/longjumpmodes/LongJumpMode.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/longjumpmodes/LongJumpMode.kt @@ -9,7 +9,7 @@ import net.ccbluex.liquidbounce.event.JumpEvent import net.ccbluex.liquidbounce.event.MoveEvent import net.ccbluex.liquidbounce.utils.client.MinecraftInstance -open class LongJumpMode(val modeName: String) : MinecraftInstance() { +open class LongJumpMode(val modeName: String) : MinecraftInstance { open fun onUpdate() {} open fun onMove(event: MoveEvent) {} open fun onJump(event: JumpEvent) {} diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/nowebmodes/NoWebMode.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/nowebmodes/NoWebMode.kt index 975f950cce3..62e58275968 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/nowebmodes/NoWebMode.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/nowebmodes/NoWebMode.kt @@ -2,6 +2,6 @@ package net.ccbluex.liquidbounce.features.module.modules.movement.nowebmodes import net.ccbluex.liquidbounce.utils.client.MinecraftInstance -open class NoWebMode(val modeName: String) : MinecraftInstance() { +open class NoWebMode(val modeName: String) : MinecraftInstance { open fun onUpdate() {} } diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/speedmodes/SpeedMode.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/speedmodes/SpeedMode.kt index 0379d405573..08e37ba41cc 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/speedmodes/SpeedMode.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/speedmodes/SpeedMode.kt @@ -10,7 +10,7 @@ import net.ccbluex.liquidbounce.event.MoveEvent import net.ccbluex.liquidbounce.event.PacketEvent import net.ccbluex.liquidbounce.utils.client.MinecraftInstance -open class SpeedMode(val modeName: String) : MinecraftInstance() { +open class SpeedMode(val modeName: String) : MinecraftInstance { open fun onMotion() {} open fun onUpdate() {} open fun onMove(event: MoveEvent) {} diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/nofallmodes/NoFallMode.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/nofallmodes/NoFallMode.kt index c4a28af8890..05fcefedf01 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/nofallmodes/NoFallMode.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/nofallmodes/NoFallMode.kt @@ -8,7 +8,7 @@ package net.ccbluex.liquidbounce.features.module.modules.player.nofallmodes import net.ccbluex.liquidbounce.event.* import net.ccbluex.liquidbounce.utils.client.MinecraftInstance -open class NoFallMode(val modeName: String) : MinecraftInstance() { +open class NoFallMode(val modeName: String) : MinecraftInstance { open fun onMove(event: MoveEvent) {} open fun onPacket(event: PacketEvent) {} open fun onRender3D(event: Render3DEvent) {} diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/Animations.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/Animations.kt index 88f983ac2dd..b7155444c19 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/Animations.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/Animations.kt @@ -77,7 +77,7 @@ object Animations : Module("Animations", Category.RENDER, gameDetecting = false, * * @author CCBlueX */ -abstract class Animation(val name: String) : MinecraftInstance() { +abstract class Animation(val name: String) : MinecraftInstance { abstract fun transform(f1: Float, f: Float, clientPlayer: AbstractClientPlayer) /** diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/ChestStealer.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/ChestStealer.kt index f903aed71bb..0fdb03ee297 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/ChestStealer.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/ChestStealer.kt @@ -286,7 +286,7 @@ object ChestStealer : Module("ChestStealer", Category.WORLD, hideModule = false) val sortableToSlot: Int? ) - private fun getItemsToSteal(): MutableList { + private fun getItemsToSteal(): List { val sortBlacklist = BooleanArray(9) var spaceInInventory = countSpaceInInventory() diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Tower.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Tower.kt index 0458b9b45cb..1a70d535d50 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Tower.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Tower.kt @@ -27,7 +27,7 @@ import net.minecraft.stats.StatList import net.minecraft.util.BlockPos import kotlin.math.truncate -object Tower : MinecraftInstance(), Listenable { +object Tower : MinecraftInstance, Listenable { val towerModeValues = choices( "TowerMode", diff --git a/src/main/java/net/ccbluex/liquidbounce/features/special/BungeeCordSpoof.kt b/src/main/java/net/ccbluex/liquidbounce/features/special/BungeeCordSpoof.kt index 69e022d1849..16e6ee70530 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/special/BungeeCordSpoof.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/special/BungeeCordSpoof.kt @@ -13,7 +13,7 @@ import net.ccbluex.liquidbounce.utils.kotlin.RandomUtils.nextInt import net.minecraft.network.EnumConnectionState import net.minecraft.network.handshake.client.C00Handshake -object BungeeCordSpoof : MinecraftInstance(), Listenable { +object BungeeCordSpoof : MinecraftInstance, Listenable { var enabled = false val onPacket = handler { event -> diff --git a/src/main/java/net/ccbluex/liquidbounce/features/special/ClientFixes.kt b/src/main/java/net/ccbluex/liquidbounce/features/special/ClientFixes.kt index d6ade6c119a..965ba094e3f 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/special/ClientFixes.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/special/ClientFixes.kt @@ -14,7 +14,7 @@ import net.ccbluex.liquidbounce.utils.client.MinecraftInstance import net.minecraft.network.PacketBuffer import net.minecraft.network.play.client.C17PacketCustomPayload -object ClientFixes : MinecraftInstance(), Listenable { +object ClientFixes : MinecraftInstance, Listenable { var fmlFixesEnabled = true diff --git a/src/main/java/net/ccbluex/liquidbounce/features/special/ClientRichPresence.kt b/src/main/java/net/ccbluex/liquidbounce/features/special/ClientRichPresence.kt index 6f2c8178c68..0eb9a79303f 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/special/ClientRichPresence.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/special/ClientRichPresence.kt @@ -28,7 +28,7 @@ import org.json.JSONObject import java.io.IOException import java.time.OffsetDateTime -object ClientRichPresence : MinecraftInstance() { +object ClientRichPresence : MinecraftInstance { var showRPCValue = true var showRPCServerIP = true diff --git a/src/main/java/net/ccbluex/liquidbounce/file/FileManager.kt b/src/main/java/net/ccbluex/liquidbounce/file/FileManager.kt index 2a1d55b589d..3fb3e2d4ee8 100644 --- a/src/main/java/net/ccbluex/liquidbounce/file/FileManager.kt +++ b/src/main/java/net/ccbluex/liquidbounce/file/FileManager.kt @@ -22,7 +22,7 @@ import java.io.File private val FILE_CONFIGS = ArrayList() @SideOnly(Side.CLIENT) -object FileManager : MinecraftInstance(), Iterable by FILE_CONFIGS { +object FileManager : MinecraftInstance, Iterable by FILE_CONFIGS { val dir = File(mc.mcDataDir, "$CLIENT_NAME-$MINECRAFT_VERSION") val fontsDir = File(dir, "fonts") diff --git a/src/main/java/net/ccbluex/liquidbounce/lang/Language.kt b/src/main/java/net/ccbluex/liquidbounce/lang/Language.kt index a5bf2083bc9..1d4dfcc5441 100644 --- a/src/main/java/net/ccbluex/liquidbounce/lang/Language.kt +++ b/src/main/java/net/ccbluex/liquidbounce/lang/Language.kt @@ -12,7 +12,7 @@ import net.ccbluex.liquidbounce.utils.client.MinecraftInstance fun translationMenu(key: String, vararg args: Any) = LanguageManager.getTranslation("menu.$key", *args) fun translation(key: String, vararg args: Any) = LanguageManager.getTranslation(key, *args) -object LanguageManager : MinecraftInstance() { +object LanguageManager : MinecraftInstance { // Current language private val language: String diff --git a/src/main/java/net/ccbluex/liquidbounce/script/Script.kt b/src/main/java/net/ccbluex/liquidbounce/script/Script.kt index b12bfb05d5b..04254f7199a 100644 --- a/src/main/java/net/ccbluex/liquidbounce/script/Script.kt +++ b/src/main/java/net/ccbluex/liquidbounce/script/Script.kt @@ -28,7 +28,7 @@ import java.io.File import java.util.function.Function import javax.script.ScriptEngine -class Script(val scriptFile: File) : MinecraftInstance() { +class Script(val scriptFile: File) : MinecraftInstance { private val scriptEngine: ScriptEngine private val scriptText = scriptFile.readText() diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/altmanager/GuiAltManager.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/altmanager/GuiAltManager.kt index 7408d472993..021253d3588 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/altmanager/GuiAltManager.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/altmanager/GuiAltManager.kt @@ -195,8 +195,8 @@ class GuiAltManager(private val prevGui: GuiScreen) : AbstractScreen() { 7 -> { // Import button val file = MiscUtils.openFileChooser() ?: return - file.readLines().forEach { - val accountData = it.split(":".toRegex(), limit = 2) + file.forEachLine { + val accountData = it.split(":", limit = 2) if (accountData.size > 1) { // Most likely a mojang account accountsConfig.addMojangAccount(accountData[0], accountData[1]) diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/Panel.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/Panel.kt index 5f1d80f6dbe..b39c80ec76f 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/Panel.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/Panel.kt @@ -22,7 +22,7 @@ import kotlin.math.min import kotlin.math.roundToInt @SideOnly(Side.CLIENT) -abstract class Panel(val name: String, var x: Int, var y: Int, val width: Int, val height: Int, var open: Boolean) : MinecraftInstance() { +abstract class Panel(val name: String, var x: Int, var y: Int, val width: Int, val height: Int, var open: Boolean) : MinecraftInstance { abstract val elements: List var x2 = 0 diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/elements/Element.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/elements/Element.kt index 6fe1c4a55dd..e918de884cb 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/elements/Element.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/elements/Element.kt @@ -7,7 +7,7 @@ package net.ccbluex.liquidbounce.ui.client.clickgui.elements import net.ccbluex.liquidbounce.utils.client.MinecraftInstance -abstract class Element : MinecraftInstance() { +abstract class Element : MinecraftInstance { var x = 0 var y = 0 diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/Style.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/Style.kt index 131a1d6699e..0ff654fad4b 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/Style.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/Style.kt @@ -17,7 +17,7 @@ import java.awt.Color import java.math.BigDecimal import kotlin.math.max -abstract class Style : MinecraftInstance() { +abstract class Style : MinecraftInstance { protected var sliderValueHeld: Value<*>? = null get() { if (!Mouse.isButtonDown(0)) field = null diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/HUD.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/HUD.kt index 6a6fe539013..ad13b6d51eb 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/HUD.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/HUD.kt @@ -18,7 +18,7 @@ import org.lwjgl.opengl.GL11.* import kotlin.math.max import kotlin.math.min -object HUD : MinecraftInstance() { +object HUD : MinecraftInstance { val elements = mutableListOf() val notifications = mutableListOf() diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/designer/EditorPanel.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/designer/EditorPanel.kt index 6b5507b7681..877f7fb040f 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/designer/EditorPanel.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/designer/EditorPanel.kt @@ -23,7 +23,7 @@ import org.lwjgl.input.Mouse import org.lwjgl.opengl.GL11.* import java.awt.Color -class EditorPanel(private val hudDesigner: GuiHudDesigner, var x: Int, var y: Int) : MinecraftInstance() { +class EditorPanel(private val hudDesigner: GuiHudDesigner, var x: Int, var y: Int) : MinecraftInstance { var width = 80 private set diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/Element.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/Element.kt index d2131bc7ebc..9e6659fce7c 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/Element.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/Element.kt @@ -20,7 +20,7 @@ import kotlin.math.min */ abstract class Element( var x: Double = 2.0, var y: Double = 2.0, scale: Float = 1F, var side: Side = Side.default(), -) : MinecraftInstance() { +) : MinecraftInstance { val info = javaClass.getAnnotation(ElementInfo::class.java) ?: throw IllegalArgumentException("Passed element with missing element info") diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/AWTFontRenderer.kt b/src/main/java/net/ccbluex/liquidbounce/ui/font/AWTFontRenderer.kt index fae3636eccb..1242a9b25ce 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/AWTFontRenderer.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/AWTFontRenderer.kt @@ -23,7 +23,7 @@ import kotlin.math.roundToInt * Generate new bitmap based font renderer */ @SideOnly(Side.CLIENT) -class AWTFontRenderer(val font: Font, startChar: Int = 0, stopChar: Int = 255, private var loadingScreen: Boolean = false) : MinecraftInstance() { +class AWTFontRenderer(val font: Font, startChar: Int = 0, stopChar: Int = 255, private var loadingScreen: Boolean = false) : MinecraftInstance { companion object { var assumeNonVolatile = false val activeFontRenderers = mutableListOf() diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.kt b/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.kt index fe9b87addfc..9109847049b 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.kt @@ -29,7 +29,7 @@ data class FontInfo(val name: String, val size: Int = -1, val isCustom: Boolean private val FONT_REGISTRY = LinkedHashMap() -object Fonts : MinecraftInstance() { +object Fonts : MinecraftInstance { val minecraftFont: FontRenderer = mc.fontRendererObj diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/attack/EntityUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/attack/EntityUtils.kt index 95ae6bc85b6..7ecb982f9e9 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/attack/EntityUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/attack/EntityUtils.kt @@ -22,7 +22,7 @@ import net.minecraft.util.Vec3 import kotlin.math.cos import kotlin.math.sin -object EntityUtils : MinecraftInstance() { +object EntityUtils : MinecraftInstance { var targetInvisible = false diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt index c19b8a5245e..dd111721c3d 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt @@ -18,7 +18,7 @@ import net.minecraft.util.ResourceLocation typealias Collidable = (Block?) -> Boolean -object BlockUtils : MinecraftInstance() { +object BlockUtils : MinecraftInstance { /** * Get block name by [id] diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/client/BlinkUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/client/BlinkUtils.kt index 65a8ef20215..604ad93df2a 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/client/BlinkUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/client/BlinkUtils.kt @@ -15,7 +15,7 @@ import net.minecraft.network.status.client.C00PacketServerQuery import net.minecraft.network.status.client.C01PacketPing import net.minecraft.util.Vec3 -object BlinkUtils : MinecraftInstance(), Listenable { +object BlinkUtils : MinecraftInstance, Listenable { val publicPacket: Packet<*>? = null val packets = mutableListOf>() diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/client/ClientUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/client/ClientUtils.kt index 34c5280184e..e9b94cd83c4 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/client/ClientUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/client/ClientUtils.kt @@ -21,7 +21,7 @@ import java.security.PublicKey import javax.crypto.SecretKey @SideOnly(Side.CLIENT) -object ClientUtils : MinecraftInstance() { +object ClientUtils : MinecraftInstance { private var fastRenderField: Field? = runCatching { GameSettings::class.java.getDeclaredField("ofFastRender") }.getOrNull() diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/client/MinecraftInstance.kt b/src/main/java/net/ccbluex/liquidbounce/utils/client/MinecraftInstance.kt index f3f94dfa1bd..57958b2e464 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/client/MinecraftInstance.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/client/MinecraftInstance.kt @@ -9,7 +9,10 @@ import net.minecraft.client.Minecraft import net.minecraft.client.audio.PositionedSoundRecord import net.minecraft.util.ResourceLocation -open class MinecraftInstance { +interface MinecraftInstance { + val mc: Minecraft + get() = Companion.mc + companion object { @JvmField val mc: Minecraft = Minecraft.getMinecraft() diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/client/PacketUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/client/PacketUtils.kt index 58fbcbea40e..d39fbb70341 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/client/PacketUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/client/PacketUtils.kt @@ -28,7 +28,7 @@ import kotlin.concurrent.read import kotlin.concurrent.write import kotlin.math.roundToInt -object PacketUtils : MinecraftInstance(), Listenable { +object PacketUtils : MinecraftInstance, Listenable { private val queuedPackets = ArrayDeque>() private val queueLock = ReentrantReadWriteLock() diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/client/ServerUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/client/ServerUtils.kt index 4ecf65885fb..1e7d7ce2e85 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/client/ServerUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/client/ServerUtils.kt @@ -22,7 +22,7 @@ import net.minecraftforge.fml.relauncher.SideOnly import java.net.InetAddress @SideOnly(Side.CLIENT) -object ServerUtils : MinecraftInstance() { +object ServerUtils : MinecraftInstance { var serverData: ServerData? = null @JvmOverloads diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/ArmorComparator.kt b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/ArmorComparator.kt index 85199745e1e..44ed95788da 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/ArmorComparator.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/ArmorComparator.kt @@ -11,7 +11,7 @@ import net.minecraft.entity.item.EntityItem import net.minecraft.item.ItemArmor import net.minecraft.item.ItemStack -object ArmorComparator: MinecraftInstance() { +object ArmorComparator: MinecraftInstance { fun getBestArmorSet(stacks: List, entityStacksMap: Map? = null): ArmorSet? { val thePlayer = mc.thePlayer ?: return null diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/InventoryManager.kt b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/InventoryManager.kt index 8b47439c61e..7945b861ce7 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/InventoryManager.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/InventoryManager.kt @@ -20,7 +20,7 @@ import net.ccbluex.liquidbounce.event.Listenable import net.ccbluex.liquidbounce.event.loopHandler import net.minecraft.client.gui.inventory.GuiInventory -object InventoryManager : MinecraftInstance(), Listenable { +object InventoryManager : MinecraftInstance, Listenable { // Shared no move click values val noMoveValue = boolean("NoMoveClicks", false) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/InventoryUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/InventoryUtils.kt index 61754323d13..12880106add 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/InventoryUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/InventoryUtils.kt @@ -28,7 +28,7 @@ import net.minecraft.network.play.server.S09PacketHeldItemChange import net.minecraft.network.play.server.S2DPacketOpenWindow import net.minecraft.network.play.server.S2EPacketCloseWindow -object InventoryUtils : MinecraftInstance(), Listenable { +object InventoryUtils : MinecraftInstance, Listenable { // Is inventory open on server-side? var serverOpenInventory get() = _serverOpenInventory diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/ItemUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/ItemUtils.kt index 3c16636ce8a..03b01ad7712 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/ItemUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/ItemUtils.kt @@ -16,7 +16,7 @@ import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract import kotlin.math.roundToInt -object ItemUtils : MinecraftInstance() { +object ItemUtils : MinecraftInstance { /** * Allows you to create an item using the item json * diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/SilentHotbar.kt b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/SilentHotbar.kt index 0162d763d48..5ac33acade8 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/inventory/SilentHotbar.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/inventory/SilentHotbar.kt @@ -14,7 +14,7 @@ import net.ccbluex.liquidbounce.event.handler import net.ccbluex.liquidbounce.utils.client.MinecraftInstance import net.minecraft.network.play.client.C09PacketHeldItemChange -object SilentHotbar : Listenable, MinecraftInstance() { +object SilentHotbar : Listenable, MinecraftInstance { var hotbarState: SilentHotbarState? = null diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/io/MiscUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/io/MiscUtils.kt index e39920ab431..3b9231bba13 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/io/MiscUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/io/MiscUtils.kt @@ -16,7 +16,7 @@ import java.time.LocalDateTime import javax.swing.* import javax.swing.filechooser.FileFilter -object MiscUtils : MinecraftInstance() { +object MiscUtils : MinecraftInstance { private fun JTextArea.adjustTextAreaSize() { val fontMetrics = getFontMetrics(font) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/login/LoginUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/login/LoginUtils.kt index b97d3e9dbdc..136378e5d92 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/login/LoginUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/login/LoginUtils.kt @@ -14,7 +14,7 @@ import java.util.* fun me.liuli.elixir.compat.Session.intoMinecraftSession() = Session(username, uuid, token, type) -object LoginUtils : MinecraftInstance() { +object LoginUtils : MinecraftInstance { fun loginSessionId(sessionToken: String): LoginResult { val payload = try { diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/movement/BPSUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/movement/BPSUtils.kt index f84b21a45e8..20c2a727c0d 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/movement/BPSUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/movement/BPSUtils.kt @@ -9,7 +9,7 @@ import net.ccbluex.liquidbounce.event.Listenable import net.ccbluex.liquidbounce.utils.client.MinecraftInstance import kotlin.math.sqrt -object BPSUtils : MinecraftInstance(), Listenable { +object BPSUtils : MinecraftInstance, Listenable { private var lastPosX: Double = 0.0 private var lastPosZ: Double = 0.0 diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/movement/FallingPlayer.kt b/src/main/java/net/ccbluex/liquidbounce/utils/movement/FallingPlayer.kt index 67595546900..7775cee1721 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/movement/FallingPlayer.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/movement/FallingPlayer.kt @@ -6,6 +6,7 @@ package net.ccbluex.liquidbounce.utils.movement import net.ccbluex.liquidbounce.utils.client.MinecraftInstance +import net.ccbluex.liquidbounce.utils.client.MinecraftInstance.Companion.mc import net.ccbluex.liquidbounce.utils.extensions.plus import net.ccbluex.liquidbounce.utils.extensions.toRadians import net.minecraft.client.entity.EntityPlayerSP @@ -27,7 +28,7 @@ class FallingPlayer( private val yaw: Float = mc.thePlayer.rotationYaw, private var strafe: Float = mc.thePlayer.moveStrafing, private var forward: Float = mc.thePlayer.moveForward -) : MinecraftInstance() { +) : MinecraftInstance { constructor(player: EntityPlayerSP, predict: Boolean = false) : this( if (predict) player.posX + player.motionX else player.posX, if (predict) player.posY + player.motionY else player.posY, diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/movement/MovementUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/movement/MovementUtils.kt index e7e4f9ecfc5..cea98b01d27 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/movement/MovementUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/movement/MovementUtils.kt @@ -14,7 +14,7 @@ import kotlin.math.cos import kotlin.math.sin import kotlin.math.sqrt -object MovementUtils : MinecraftInstance(), Listenable { +object MovementUtils : MinecraftInstance, Listenable { var affectSprintOnAttack: Boolean? = null diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/movement/TimerBalanceUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/movement/TimerBalanceUtils.kt index 68c5ef9670a..7c0727b6f48 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/movement/TimerBalanceUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/movement/TimerBalanceUtils.kt @@ -9,7 +9,7 @@ import net.ccbluex.liquidbounce.event.* import net.ccbluex.liquidbounce.utils.client.MinecraftInstance import net.minecraft.network.play.client.C03PacketPlayer -object TimerBalanceUtils : MinecraftInstance(), Listenable { +object TimerBalanceUtils : MinecraftInstance, Listenable { var balance = 0L private set diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/pathfinding/PathUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/pathfinding/PathUtils.kt index 980227aeb39..8de06491cdf 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/pathfinding/PathUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/pathfinding/PathUtils.kt @@ -11,7 +11,7 @@ import kotlin.math.abs import kotlin.math.ceil import kotlin.math.sqrt -object PathUtils : MinecraftInstance() { +object PathUtils : MinecraftInstance { fun findBlinkPath(tpX: Double, tpY: Double, tpZ: Double): List { val positions = mutableListOf() diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/render/MiniMapRegister.kt b/src/main/java/net/ccbluex/liquidbounce/utils/render/MiniMapRegister.kt index 11d2b75e878..156e5d33b48 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/render/MiniMapRegister.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/render/MiniMapRegister.kt @@ -16,7 +16,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock import kotlin.concurrent.read import kotlin.concurrent.write -object MiniMapRegister : MinecraftInstance(), Listenable { +object MiniMapRegister : MinecraftInstance, Listenable { private val chunkTextureMap = HashMap(256) private val queuedChunkUpdates = HashSet(256) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/render/RenderUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/render/RenderUtils.kt index 9bc00c0a3d9..7a6b0ba4d83 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/render/RenderUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/render/RenderUtils.kt @@ -24,7 +24,12 @@ import org.lwjgl.opengl.GL14 import java.awt.Color import kotlin.math.* -object RenderUtils : MinecraftInstance() { +object RenderUtils : MinecraftInstance { + // ARGB 0xff006fff + const val CLIENT_COLOR = -16748545 + // ARGB 0x7f006fff + const val CLIENT_COLOR_HALF_ALPHA = 2130735103 + private val glCapMap = mutableMapOf() private val DISPLAY_LISTS_2D = IntArray(4) var deltaTime = 0 diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/render/WorldToScreen.kt b/src/main/java/net/ccbluex/liquidbounce/utils/render/WorldToScreen.kt index 9444985375d..e1a32420bb2 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/render/WorldToScreen.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/render/WorldToScreen.kt @@ -15,7 +15,7 @@ import org.lwjgl.util.vector.Vector3f import org.lwjgl.util.vector.Vector4f import kotlin.math.abs -object WorldToScreen : MinecraftInstance() { +object WorldToScreen : MinecraftInstance { fun getMatrix(matrix: Int): Matrix4f { val floatBuffer = BufferUtils.createFloatBuffer(16) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RaycastUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RaycastUtils.kt index d03b54b5b06..67b6676c878 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RaycastUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RaycastUtils.kt @@ -26,7 +26,7 @@ import net.minecraft.util.MovingObjectPosition import net.minecraft.util.Vec3 import java.util.* -object RaycastUtils : MinecraftInstance() { +object RaycastUtils : MinecraftInstance { @JvmOverloads fun raycastEntity( range: Double, diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/rotation/Rotation.kt b/src/main/java/net/ccbluex/liquidbounce/utils/rotation/Rotation.kt index 143b752b94c..3340ff6b8a3 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/rotation/Rotation.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/rotation/Rotation.kt @@ -22,7 +22,7 @@ import kotlin.math.* /** * Rotations */ -data class Rotation(var yaw: Float, var pitch: Float) : MinecraftInstance() { +data class Rotation(var yaw: Float, var pitch: Float) : MinecraftInstance { operator fun minus(other: Rotation): Rotation { return Rotation(yaw - other.yaw, pitch - other.pitch) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RotationUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RotationUtils.kt index 6c958b5afe1..e8d5c46ad1d 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RotationUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RotationUtils.kt @@ -25,7 +25,7 @@ import net.minecraft.util.* import javax.vecmath.Vector2f import kotlin.math.* -object RotationUtils : MinecraftInstance(), Listenable { +object RotationUtils : MinecraftInstance, Listenable { /** * Our final rotation point, which [currentRotation] follows. diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/simulation/SimulatedPlayer.kt b/src/main/java/net/ccbluex/liquidbounce/utils/simulation/SimulatedPlayer.kt index eb73dae0037..344e4a91697 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/simulation/SimulatedPlayer.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/simulation/SimulatedPlayer.kt @@ -9,6 +9,7 @@ import com.google.common.base.Predicate import com.google.common.collect.Lists import net.ccbluex.liquidbounce.features.module.modules.movement.NoJumpDelay import net.ccbluex.liquidbounce.utils.client.MinecraftInstance +import net.ccbluex.liquidbounce.utils.client.MinecraftInstance.Companion.mc import net.minecraft.block.* import net.minecraft.block.material.Material import net.minecraft.block.state.IBlockState @@ -85,7 +86,7 @@ class SimulatedPlayer( private var noClip: Boolean, private var isSprinting: Boolean, private val foodStats: FoodStats, -) : MinecraftInstance() { +) : MinecraftInstance { val pos: Vec3 get() = Vec3(posX, posY, posZ) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/timing/TickedActions.kt b/src/main/java/net/ccbluex/liquidbounce/utils/timing/TickedActions.kt index 7606ecdaab6..74ac1344bd6 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/timing/TickedActions.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/timing/TickedActions.kt @@ -56,7 +56,7 @@ object TickedActions : Listenable { actions.clear() } - class TickScheduler(val module: Module) : MinecraftInstance() { + class TickScheduler(val module: Module) : MinecraftInstance { fun schedule(id: Int, allowDuplicates: Boolean = false, action: () -> Unit) = schedule(id, module, allowDuplicates, action) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/timing/WaitMsUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/timing/WaitMsUtils.kt index 3efe61bfc4a..5df7e95d437 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/timing/WaitMsUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/timing/WaitMsUtils.kt @@ -10,7 +10,7 @@ import net.ccbluex.liquidbounce.event.Listenable import net.ccbluex.liquidbounce.event.handler import net.ccbluex.liquidbounce.utils.client.MinecraftInstance -object WaitMsUtils : MinecraftInstance(), Listenable { +object WaitMsUtils : MinecraftInstance, Listenable { private val scheduledActions = mutableListOf() diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/timing/WaitTickUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/timing/WaitTickUtils.kt index a47c45b9e34..4881ec59737 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/timing/WaitTickUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/timing/WaitTickUtils.kt @@ -12,7 +12,7 @@ import net.ccbluex.liquidbounce.utils.client.ClientUtils import net.ccbluex.liquidbounce.utils.client.MinecraftInstance import net.ccbluex.liquidbounce.utils.kotlin.removeEach -object WaitTickUtils : MinecraftInstance(), Listenable { +object WaitTickUtils : MinecraftInstance, Listenable { private val scheduledActions = ArrayDeque()