Replace OptionValueAccessor.java with an access widener to make it work fine on forge
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
9503ac000b
commit
930cbc2f6a
|
@ -3,6 +3,7 @@ import com.modrinth.minotaur.ModrinthExtension
|
||||||
import com.modrinth.minotaur.dependencies.DependencyType
|
import com.modrinth.minotaur.dependencies.DependencyType
|
||||||
import masecla.modrinth4j.model.version.ProjectVersion.VersionType
|
import masecla.modrinth4j.model.version.ProjectVersion.VersionType
|
||||||
import net.fabricmc.loom.LoomGradleExtension
|
import net.fabricmc.loom.LoomGradleExtension
|
||||||
|
import net.fabricmc.loom.api.LoomGradleExtensionAPI
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -26,7 +27,7 @@ plugins {
|
||||||
|
|
||||||
group = "fr.username404"
|
group = "fr.username404"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
val groupAndName = "${rootProject.group}.${rootProject.name.toLowerCase()}"
|
val groupAndName = "${rootProject.group}.${rootProject.name.lowercase()}"
|
||||||
|
|
||||||
val javaVer: String = "21"
|
val javaVer: String = "21"
|
||||||
val sourceJavaVer: String = javaVer
|
val sourceJavaVer: String = javaVer
|
||||||
|
@ -50,6 +51,9 @@ subprojects {
|
||||||
apply(plugin = "dev.architectury.loom")
|
apply(plugin = "dev.architectury.loom")
|
||||||
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
|
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
|
||||||
extensions.configure<LoomGradleExtension>("loom") {
|
extensions.configure<LoomGradleExtension>("loom") {
|
||||||
|
if (this@subprojects.project.name != "common") {
|
||||||
|
accessWidenerPath.set(project(":common").extensions.getByType<LoomGradleExtensionAPI>().accessWidenerPath)
|
||||||
|
}
|
||||||
mappingsDep = layered {
|
mappingsDep = layered {
|
||||||
silentMojangMappingsLicense()
|
silentMojangMappingsLicense()
|
||||||
officialMojangMappings().parchment("org.parchmentmc.data:parchment-1.21:2024.06.23")
|
officialMojangMappings().parchment("org.parchmentmc.data:parchment-1.21:2024.06.23")
|
||||||
|
@ -114,7 +118,7 @@ subprojects {
|
||||||
val dictionariesDir = "$rootDir/obfuscation"
|
val dictionariesDir = "$rootDir/obfuscation"
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
injars(shadowJar)
|
injars(shadowJar)
|
||||||
outjars("$buildDir/shrinkedJar/${shadowJar.outputs.files.singleFile.name}")
|
outjars("${rootProject.layout.buildDirectory}/shrinkedJar/${shadowJar.outputs.files.singleFile.name}")
|
||||||
keep("class $group.snowygui.mixins.* { * ; }")
|
keep("class $group.snowygui.mixins.* { * ; }")
|
||||||
keep("class $group.snowygui.fabric.FabricInit")
|
keep("class $group.snowygui.fabric.FabricInit")
|
||||||
keep("class $group.snowygui.fabric.ModMenuConf")
|
keep("class $group.snowygui.fabric.ModMenuConf")
|
||||||
|
|
|
@ -6,4 +6,8 @@ dependencies {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loom {
|
||||||
|
accessWidenerPath = file("src/main/resources/${rootProject.name.lowercase()}.accessWidener")
|
||||||
|
}
|
||||||
|
|
||||||
tasks.getByName("shrinkJar").enabled = false
|
tasks.getByName("shrinkJar").enabled = false
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
package fr.username404.snowygui.mixins;
|
|
||||||
|
|
||||||
import net.minecraft.client.OptionInstance;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
@Mixin(OptionInstance.class)
|
|
||||||
public interface OptionValueAccessor {
|
|
||||||
@Accessor("value")
|
|
||||||
void setValue(Object value);
|
|
||||||
}
|
|
|
@ -1,6 +1,5 @@
|
||||||
package fr.username404.snowygui.gui.feature
|
package fr.username404.snowygui.gui.feature
|
||||||
|
|
||||||
import fr.username404.snowygui.mixins.OptionValueAccessor
|
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
|
|
||||||
@ButtonInfo(Category.MISC)
|
@ButtonInfo(Category.MISC)
|
||||||
|
@ -10,11 +9,11 @@ object GammaBoost: ButtonImpl() {
|
||||||
override fun execAction() {
|
override fun execAction() {
|
||||||
with(Minecraft.getInstance().options) {
|
with(Minecraft.getInstance().options) {
|
||||||
val gamma = gamma().get()
|
val gamma = gamma().get()
|
||||||
@Suppress("KotlinConstantConditions")
|
gamma().value =
|
||||||
(gamma() as OptionValueAccessor).setValue(if (toggled) {
|
if (toggled) {
|
||||||
if (gamma < boost) oldGamma = gamma
|
if (gamma < boost) oldGamma = gamma
|
||||||
boost
|
boost
|
||||||
} else oldGamma)
|
} else oldGamma
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,9 +2,7 @@
|
||||||
"required": true,
|
"required": true,
|
||||||
"package": "fr.username404.snowygui.mixins",
|
"package": "fr.username404.snowygui.mixins",
|
||||||
"compatibilityLevel": "JAVA_18",
|
"compatibilityLevel": "JAVA_18",
|
||||||
"client": [
|
"client": [],
|
||||||
"OptionValueAccessor"
|
|
||||||
],
|
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
accessWidener v2 named
|
||||||
|
accessible field net/minecraft/client/OptionInstance value Ljava/lang/Object;
|
||||||
|
mutable field net/minecraft/client/OptionInstance value Ljava/lang/Object;
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"accessWidener": "snowygui.accessWidener"
|
||||||
|
}
|
|
@ -32,6 +32,7 @@
|
||||||
"snowygui-common.mixins.json",
|
"snowygui-common.mixins.json",
|
||||||
"snowygui-fabric.mixins.json"
|
"snowygui-fabric.mixins.json"
|
||||||
],
|
],
|
||||||
|
"accessWidener": "snowygui.accessWidener",
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=${fabric_loader}",
|
"fabricloader": ">=${fabric_loader}",
|
||||||
"fabric-language-kotlin": ">=${fabric_kotlin}",
|
"fabric-language-kotlin": ">=${fabric_kotlin}",
|
||||||
|
|
Loading…
Reference in New Issue