mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-30 05:05:19 -05:00
* Experiment with low priority and require=0 to try to fix #25 * Revert require = 0 because it didn't work * (Hopefully) solve things with a mixin plugin Might be overkill, but we could need it again in the future... * Replace Platform call with FabricLoader
This commit is contained in:
@@ -29,7 +29,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Unique
|
||||
@Mixin(value = EffectInstance.class, priority = 1050)
|
||||
@Mixin(value = EffectInstance.class, priority = 950)
|
||||
public class MixinEffectInstance {
|
||||
@Redirect(
|
||||
method = "<init>",
|
||||
@@ -40,7 +40,7 @@ public class MixinEffectInstance {
|
||||
private ResourceLocation mojangPls(String _0, ResourceManager rm, String str) {
|
||||
return mojangPls(new ResourceLocation(str), ".json");
|
||||
}
|
||||
|
||||
|
||||
@Redirect(
|
||||
method = "getOrCreate",
|
||||
at = @At(value = "NEW",
|
||||
@@ -50,7 +50,7 @@ public class MixinEffectInstance {
|
||||
private static ResourceLocation mojangPls(String _0, ResourceManager rm, Program.Type type, String str) {
|
||||
return mojangPls(new ResourceLocation(str), type.getExtension());
|
||||
}
|
||||
|
||||
|
||||
private static ResourceLocation mojangPls(ResourceLocation rl, String ext) {
|
||||
return new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + ext);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package me.shedaniel.architectury.plugin.fabric;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ArchitecturyMixinPlugin implements IMixinConfigPlugin {
|
||||
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefMapperConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
switch (mixinClassName) {
|
||||
case "me.shedaniel.architectury.mixin.fabric.client.MixinEffectInstance":
|
||||
return !FabricLoader.getInstance().isModLoaded("satin");
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "me.shedaniel.architectury.mixin.fabric",
|
||||
"plugin": "me.shedaniel.architectury.plugin.fabric.ArchitecturyMixinPlugin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"minVersion": "0.7.11",
|
||||
"client": [
|
||||
"client.MixinClientLevel",
|
||||
"client.MixinClientPacketListener",
|
||||
"client.MixinDebugScreenOverlay",
|
||||
"client.MixinEffectInstance",
|
||||
"client.MixinGameRenderer",
|
||||
"client.MixinIntegratedServer",
|
||||
"client.MixinKeyboardHandler",
|
||||
@@ -14,8 +16,7 @@
|
||||
"client.MixinMouseHandler",
|
||||
"client.MixinMultiPlayerGameMode",
|
||||
"client.MixinScreen",
|
||||
"client.MixinTextureAtlas",
|
||||
"client.MixinEffectInstance"
|
||||
"client.MixinTextureAtlas"
|
||||
],
|
||||
"mixins": [
|
||||
"ExplosionPreInvoker",
|
||||
|
||||
Reference in New Issue
Block a user