diff --git a/src/main/kotlin/org/polyfrost/crosshair/PolyCrosshair.kt b/src/main/kotlin/org/polyfrost/crosshair/PolyCrosshair.kt index 655e832..7f12c3d 100644 --- a/src/main/kotlin/org/polyfrost/crosshair/PolyCrosshair.kt +++ b/src/main/kotlin/org/polyfrost/crosshair/PolyCrosshair.kt @@ -3,18 +3,13 @@ package org.polyfrost.crosshair import cc.polyfrost.oneconfig.config.core.ConfigUtils import cc.polyfrost.oneconfig.events.EventManager import cc.polyfrost.oneconfig.events.event.ShutdownEvent -import cc.polyfrost.oneconfig.events.event.Stage -import cc.polyfrost.oneconfig.events.event.TickEvent import cc.polyfrost.oneconfig.libs.eventbus.Subscribe -import cc.polyfrost.oneconfig.libs.universal.UResolution import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.common.event.FMLInitializationEvent import net.minecraftforge.fml.common.event.FMLPostInitializationEvent -import org.polyfrost.crosshair.config.Drawer.loadImage import org.polyfrost.crosshair.config.ModConfig import org.polyfrost.crosshair.render.CrosshairRenderer -import org.polyfrost.crosshair.utils.toBufferedImage import java.io.File @Mod( @@ -32,8 +27,6 @@ object PolyCrosshair { val dir = File(path) - private var lastGuiScale = 1f - @Mod.EventHandler fun onFMLInitialization(event: FMLInitializationEvent) { clearCaches() @@ -48,19 +41,6 @@ object PolyCrosshair { CrosshairRenderer.updateVanilla() } - @Subscribe - fun onTick(event: TickEvent) { - if (event.stage != Stage.END) return - if (UResolution.scaleFactor.toFloat() != lastGuiScale) { - lastGuiScale = UResolution.scaleFactor.toFloat() - toBufferedImage(ModConfig.newCurrentCrosshair.img)?.let { it -> - loadImage(it, false, ModConfig.newCurrentCrosshair)?.let { - CrosshairRenderer.updateTexture(it) - } - } - } - } - @Subscribe fun onShutDown(e: ShutdownEvent) { clearCaches() diff --git a/src/main/kotlin/org/polyfrost/crosshair/config/Drawer.kt b/src/main/kotlin/org/polyfrost/crosshair/config/Drawer.kt index cdf2553..281e5c9 100644 --- a/src/main/kotlin/org/polyfrost/crosshair/config/Drawer.kt +++ b/src/main/kotlin/org/polyfrost/crosshair/config/Drawer.kt @@ -14,12 +14,10 @@ import cc.polyfrost.oneconfig.libs.universal.UKeyboard import cc.polyfrost.oneconfig.renderer.scissor.ScissorHelper import cc.polyfrost.oneconfig.utils.IOUtils import cc.polyfrost.oneconfig.utils.InputHandler -import cc.polyfrost.oneconfig.utils.Notifications import cc.polyfrost.oneconfig.utils.color.ColorPalette import cc.polyfrost.oneconfig.utils.dsl.mc import cc.polyfrost.oneconfig.utils.dsl.nanoVGHelper import cc.polyfrost.oneconfig.utils.dsl.runAsync -import org.polyfrost.crosshair.PolyCrosshair import org.polyfrost.crosshair.elements.ColorSelector import org.polyfrost.crosshair.elements.PresetElement import org.polyfrost.crosshair.render.CrosshairRenderer @@ -32,9 +30,6 @@ import java.io.File import javax.imageio.ImageIO import kotlin.math.ceil - -private fun notify(message: String) = Notifications.INSTANCE.send(PolyCrosshair.NAME, message) - object Drawer : BasicOption(null, null, "", "", "", "", 2) { val pixels: Array = Array(1024) { Pixel(it) } diff --git a/src/main/kotlin/org/polyfrost/crosshair/config/ModConfig.kt b/src/main/kotlin/org/polyfrost/crosshair/config/ModConfig.kt index 0b29fe3..5284228 100644 --- a/src/main/kotlin/org/polyfrost/crosshair/config/ModConfig.kt +++ b/src/main/kotlin/org/polyfrost/crosshair/config/ModConfig.kt @@ -6,7 +6,6 @@ import cc.polyfrost.oneconfig.config.annotations.* import cc.polyfrost.oneconfig.config.core.* import cc.polyfrost.oneconfig.config.data.* import cc.polyfrost.oneconfig.config.elements.* -import cc.polyfrost.oneconfig.utils.Notifications import club.sk1er.patcher.config.OldPatcherConfig import org.polyfrost.crosshair.PolyCrosshair import org.polyfrost.crosshair.utils.* @@ -101,10 +100,9 @@ object ModConfig : Config(Mod(PolyCrosshair.NAME, ModType.HUD, "/${PolyCrosshair renderConfig.didPatcherMigration = true save() if (didAnything) { - Notifications.INSTANCE.send("PolyCrosshair", "Migrated Patcher settings replaced by PolyCrosshair. Please check PolyCrosshair's settings to make sure they are correct.") + notify("Migrated Patcher settings replaced by PolyCrosshair. Please check PolyCrosshair's settings to make sure they are correct.") } } catch (_: ClassNotFoundException) { - } } } diff --git a/src/main/kotlin/org/polyfrost/crosshair/utils/Utils.kt b/src/main/kotlin/org/polyfrost/crosshair/utils/Utils.kt index 212f64e..7413558 100644 --- a/src/main/kotlin/org/polyfrost/crosshair/utils/Utils.kt +++ b/src/main/kotlin/org/polyfrost/crosshair/utils/Utils.kt @@ -11,11 +11,10 @@ import java.awt.Image import java.awt.image.BufferedImage import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream -import java.io.IOException import java.util.* import javax.imageio.ImageIO -private fun notify(message: String) = Notifications.INSTANCE.send(PolyCrosshair.NAME, message) +fun notify(message: String) = Notifications.INSTANCE.send(PolyCrosshair.NAME, message) fun posToIndex(x: Int, y: Int): Int = x + y * 32 @@ -30,15 +29,6 @@ fun export(image: BufferedImage?, name: String): String { return path } -@Throws(IOException::class) -fun resizeImage(originalImage: BufferedImage, targetWidth: Int, targetHeight: Int): BufferedImage { - val resizedImage = BufferedImage(targetWidth, targetHeight, BufferedImage.TYPE_INT_RGB) - val graphics2D = resizedImage.createGraphics() - graphics2D.drawImage(originalImage, 0, 0, targetWidth, targetHeight, null) - graphics2D.dispose() - return resizedImage -} - fun save(image: OneImage?) { image ?: return val base64 = toBase64(image.image)