diff --git a/client/src/main/java/com/terraformersmc/terrestria/mixin/MixinBlockDustParticle.java b/client/src/main/java/com/terraformersmc/terrestria/mixin/MixinBlockDustParticle.java index 52581a17..4fde67e1 100644 --- a/client/src/main/java/com/terraformersmc/terrestria/mixin/MixinBlockDustParticle.java +++ b/client/src/main/java/com/terraformersmc/terrestria/mixin/MixinBlockDustParticle.java @@ -16,7 +16,7 @@ @Environment(EnvType.CLIENT) public class MixinBlockDustParticle { @Redirect(method = "(Lnet/minecraft/client/world/ClientWorld;DDDDDDLnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z")) + at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z"), require = 0) private boolean terrestria$fixParticleColors(BlockState blockState, Block requiredBlock) { Block block = blockState.getBlock(); diff --git a/client/src/main/java/com/terraformersmc/terrestria/mixin/TerrestriaClientMixinPlugin.java b/client/src/main/java/com/terraformersmc/terrestria/mixin/TerrestriaClientMixinPlugin.java new file mode 100644 index 00000000..c81eab7f --- /dev/null +++ b/client/src/main/java/com/terraformersmc/terrestria/mixin/TerrestriaClientMixinPlugin.java @@ -0,0 +1,57 @@ +package com.terraformersmc.terrestria.mixin; + +import com.google.common.collect.ImmutableMap; +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.Map; +import java.util.Set; +import java.util.function.Supplier; + +public class TerrestriaClientMixinPlugin implements IMixinConfigPlugin { + private static final Supplier TRUE = () -> true; + + private static final Map> CONDITIONS = ImmutableMap.of( + "com.terraformersmc.terrestria.mixin.MixinBlockDustParticle", () -> !FabricLoader.getInstance().isModLoaded("immersive_weathering") + ); + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + return CONDITIONS.getOrDefault(mixinClassName, TRUE).get(); + } + + // Boilerplate + + @Override + public void onLoad(String mixinPackage) { + + } + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) { + + } + + @Override + public List 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) { + + } +} diff --git a/client/src/main/resources/fabric.mod.json b/client/src/main/resources/fabric.mod.json index a7f91e66..ab164bad 100644 --- a/client/src/main/resources/fabric.mod.json +++ b/client/src/main/resources/fabric.mod.json @@ -6,6 +6,7 @@ "license": "LGPL-3.0-only", "icon": "assets/terrestria/icon.png", "environment": "client", + "plugin": "com.terraformersmc.terrestria.mixin.TerrestriaClientMixinPlugin", "mixins": [ "mixins.terrestria-client.json" ],