Compare commits

..

No commits in common. "3719d60446a6798100a5b1da9ad7e8eead4bda04" and "968b184cbefa68fa4bb4d734cf0e304e06737dda" have entirely different histories.

2 changed files with 12 additions and 5 deletions

View File

@ -27,7 +27,7 @@ plugins {
}
group = "fr.username404"
version = "0.4.3"
version = "0.4.2"
val groupAndName = "${rootProject.group}.${rootProject.name.lowercase()}"
val javaVer: String = "21"

View File

@ -4,13 +4,20 @@ import fr.username404.snowygui.gui.feature.Zoom
import net.fabricmc.loader.api.FabricLoader
@JvmField
var isOkZoomerPresent: Boolean = FabricLoader.getInstance().isModLoaded("ok_zoomer")
var isOkZoomerPresent: Boolean = FabricLoader.getInstance().isModLoaded("okzoomer")
private val okZoomerPairs by lazy {
with(Class.forName("io.github.ennuil.okzoomer.utils.ZoomUtils").getDeclaredField("ZOOMER_ZOOM")) {
get(null).javaClass.run {
(getDeclaredField("zoomDivisor") to this@with.get(null)) to (getDeclaredField("zoom") to this@with.get(null))
}
}.apply { first.first.isAccessible = true; second.first.isAccessible = true; }
}
fun fabricZoom() {
try {
with(Class.forName("page.langeweile.ok_zoomer.zoom.Zoom")) {
getDeclaredMethod("setZoomDivisor", Double::class.java)(null, Zoom.zoomFactor);
getDeclaredMethod("setZooming", Boolean::class.java)(null, Zoom.toggled)
with(okZoomerPairs) {
first.run { first.setFloat(second, Zoom.zoomFactor.toFloat()) }
second.run { first.setBoolean(second, Zoom.toggled) }
}
} catch (e: Exception) {
isOkZoomerPresent = false