From b8cd4cbd7929fa6d09477814b0d8142a7f89030b Mon Sep 17 00:00:00 2001
From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>
Date: Thu, 13 Jun 2024 14:21:47 -0400
Subject: [PATCH 1/2] fix: apply MixinExtras at the PREINIT environment
---
build.gradle.kts | 6 +-
.../tweaker/InitMixinPlugin.kt | 55 +++++++++++++++++++
.../simpletogglesprint/tweaker/MixinPlugin.kt | 3 -
.../mixins.simpletogglesprint-init.json | 7 +++
4 files changed, 65 insertions(+), 6 deletions(-)
create mode 100644 src/main/kotlin/mynameisjeff/simpletogglesprint/tweaker/InitMixinPlugin.kt
create mode 100644 src/main/resources/mixins.simpletogglesprint-init.json
diff --git a/build.gradle.kts b/build.gradle.kts
index b27b6d6..66d92d9 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -56,12 +56,12 @@ loom {
property("fml.remappingDebug.dumpMethodMaps", "true")
property("fml.coreMods.load", "mynameisjeff.simpletogglesprint.tweaker.FMLLoadingPlugin")
programArgs("--tweakClass", "gg.essential.loader.stage0.EssentialSetupTweaker")
- programArgs("--mixin", "mixins.simpletogglesprint.json")
+ programArgs("--mixin", "mixins.simpletogglesprint.json", "mixins.simpletogglesprint-init.json")
}
remove(getByName("server"))
}
forge {
- mixinConfig("mixins.simpletogglesprint.json")
+ mixinConfig("mixins.simpletogglesprint.json", "mixins.simpletogglesprint-init.json")
accessTransformer("src/main/resources/META-INF/accesstransformer.cfg")
}
mixin {
@@ -122,7 +122,7 @@ tasks {
"FMLCorePlugin" to "mynameisjeff.simpletogglesprint.tweaker.FMLLoadingPlugin",
"FMLCorePluginContainsFMLMod" to true,
"ForceLoadAsMod" to true,
- "MixinConfigs" to "mixins.simpletogglesprint.json",
+ "MixinConfigs" to "mixins.simpletogglesprint.json,mixins.simpletogglesprint-init.json",
"ModSide" to "CLIENT",
"ModType" to "FML",
"TweakClass" to "gg.essential.loader.stage0.EssentialSetupTweaker",
diff --git a/src/main/kotlin/mynameisjeff/simpletogglesprint/tweaker/InitMixinPlugin.kt b/src/main/kotlin/mynameisjeff/simpletogglesprint/tweaker/InitMixinPlugin.kt
new file mode 100644
index 0000000..a4b7653
--- /dev/null
+++ b/src/main/kotlin/mynameisjeff/simpletogglesprint/tweaker/InitMixinPlugin.kt
@@ -0,0 +1,55 @@
+/*
+ * SimpleToggleSprint
+ * Copyright (C) 2021 My-Name-Is-Jeff
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package mynameisjeff.simpletogglesprint.tweaker
+
+import com.llamalad7.mixinextras.MixinExtrasBootstrap
+import org.objectweb.asm.tree.ClassNode
+import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
+import org.spongepowered.asm.mixin.extensibility.IMixinInfo
+
+class InitMixinPlugin : IMixinConfigPlugin {
+ override fun onLoad(mixinPackage: String) {
+ MixinExtrasBootstrap.init()
+ }
+
+ override fun getRefMapperConfig(): String? = null
+
+ override fun shouldApplyMixin(targetClassName: String, mixinClassName: String): Boolean {
+ return true
+ }
+
+ override fun acceptTargets(myTargets: Set, otherTargets: Set) {}
+ override fun getMixins(): List? = null
+
+ override fun preApply(
+ targetClassName: String?,
+ targetClass: ClassNode?,
+ mixinClassName: String?,
+ mixinInfo: IMixinInfo?
+ ) {
+ }
+
+ override fun postApply(
+ targetClassName: String?,
+ targetClass: ClassNode?,
+ mixinClassName: String?,
+ mixinInfo: IMixinInfo?
+ ) {
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/mynameisjeff/simpletogglesprint/tweaker/MixinPlugin.kt b/src/main/kotlin/mynameisjeff/simpletogglesprint/tweaker/MixinPlugin.kt
index 0574295..3aac58a 100644
--- a/src/main/kotlin/mynameisjeff/simpletogglesprint/tweaker/MixinPlugin.kt
+++ b/src/main/kotlin/mynameisjeff/simpletogglesprint/tweaker/MixinPlugin.kt
@@ -18,7 +18,6 @@
package mynameisjeff.simpletogglesprint.tweaker
-import com.llamalad7.mixinextras.MixinExtrasBootstrap
import net.minecraftforge.fml.relauncher.CoreModManager
import org.objectweb.asm.tree.ClassNode
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
@@ -27,8 +26,6 @@ import org.spongepowered.asm.mixin.extensibility.IMixinInfo
class MixinPlugin : IMixinConfigPlugin {
private var hasPlayerAPI = false
override fun onLoad(mixinPackage: String) {
- MixinExtrasBootstrap.init()
-
for ((key, value) in CoreModManager.getTransformers()) {
if (key.startsWith("PlayerAPIPlugin") && value.contains("api.player.forge.PlayerAPITransformer")) {
println("PlayerAPI detected.")
diff --git a/src/main/resources/mixins.simpletogglesprint-init.json b/src/main/resources/mixins.simpletogglesprint-init.json
new file mode 100644
index 0000000..5abbd40
--- /dev/null
+++ b/src/main/resources/mixins.simpletogglesprint-init.json
@@ -0,0 +1,7 @@
+{
+ "compatibilityLevel": "JAVA_8",
+ "package": "mynameisjeff.simpletogglesprint.mixins.init",
+ "plugin": "mynameisjeff.simpletogglesprint.tweaker.InitMixinPlugin",
+ "target": "@env(PREINIT)",
+ "verbose": true
+}
\ No newline at end of file
From d598ec637ae29b69be5d7b543325b03cdedbb362 Mon Sep 17 00:00:00 2001
From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>
Date: Thu, 13 Jun 2024 14:22:11 -0400
Subject: [PATCH 2/2] version: 2.4.0
---
build.gradle.kts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.gradle.kts b/build.gradle.kts
index 66d92d9..71ab0a0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -32,7 +32,7 @@ plugins {
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
}
-version = "2.3.0"
+version = "2.4.0"
group = "mynameisjeff.simpletogglesprint"
quiltflower {