aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/moe/nea/firmament/init/MixinPlugin.java42
-rw-r--r--src/main/resources/firmament.mixins.json17
2 files changed, 10 insertions, 49 deletions
diff --git a/src/main/java/moe/nea/firmament/init/MixinPlugin.java b/src/main/java/moe/nea/firmament/init/MixinPlugin.java
index d61d428..79a1789 100644
--- a/src/main/java/moe/nea/firmament/init/MixinPlugin.java
+++ b/src/main/java/moe/nea/firmament/init/MixinPlugin.java
@@ -18,47 +18,25 @@
package moe.nea.firmament.init;
-import org.objectweb.asm.tree.ClassNode;
-import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
-import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
+import com.unascribed.lib39.core.api.AutoMixin;
import java.util.List;
-import java.util.Set;
-public class MixinPlugin implements IMixinConfigPlugin {
- @Override
- public void onLoad(String mixinPackage) {
-
- }
-
- @Override
- public String getRefMapperConfig() {
- return null;
- }
+// TODO: replace AutoMixin with KSP plugin?
+public class MixinPlugin extends AutoMixin {
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
- return Boolean.getBoolean("firmament.debug") ||
- !mixinClassName.startsWith("moe.nea.firmament.mixins.devenv");
- }
-
- @Override
- public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
-
+ if (!Boolean.getBoolean("firmament.debug") && mixinClassName.contains("devenv.")) {
+ return false;
+ }
+ return super.shouldApplyMixin(targetClassName, mixinClassName);
}
@Override
public List<String> getMixins() {
- return null;
- }
-
- @Override
- public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
-
- }
-
- @Override
- public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
-
+ var autoDiscoveredMixins = super.getMixins();
+ autoDiscoveredMixins.removeIf(it -> !shouldApplyMixin(null, it));
+ return autoDiscoveredMixins;
}
}
diff --git a/src/main/resources/firmament.mixins.json b/src/main/resources/firmament.mixins.json
index 1f63bd0..43f3601 100644
--- a/src/main/resources/firmament.mixins.json
+++ b/src/main/resources/firmament.mixins.json
@@ -3,23 +3,6 @@
"plugin": "moe.nea.firmament.init.MixinPlugin",
"package": "moe.nea.firmament.mixins",
"compatibilityLevel": "JAVA_16",
- "client": [
- "MixinDownloadingTerrainScreen",
- "MixinMessageHandler",
- "MixinMinecraft",
- "MixinWorldRenderer",
- "accessor.AccessorHandledScreen",
- "devenv.DisableCommonPacketWarnings"
- ],
- "mixins": [
- "MixinClientPacketHandler",
- "MixinClientPlayerEntity",
- "MixinEntityIdFix",
- "MixinHandledScreen",
- "MixinPlayerInventory",
- "devenv.DisableInvalidFishingHook",
- "devenv.MixinScoreboard"
- ],
"injectors": {
"defaultRequire": 1
}