remove overkill mixin registration to register one string

This commit is contained in:
Alexdoru committed 2025-07-09 02:04:27 +02:00
1 parent 7b9a6b143c
commit 105558f283
2 files changed
+8 -76

No files matched your search

@@ -1,14 +1,12 @@
package makeo.gadomancy.coremod;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import com.gtnewhorizon.gtnhlib.mixin.IMixins;
import com.gtnewhorizon.gtnhmixins.ILateMixinLoader;
import com.gtnewhorizon.gtnhmixins.LateMixin;
import makeo.gadomancy.coremod.mixins.Mixins;
@LateMixin
public class GadomancyLateMixins implements ILateMixinLoader {
@@ -19,6 +17,12 @@ public class GadomancyLateMixins implements ILateMixinLoader {
@Override
public List<String> getMixins(Set<String> loadedMods) {
return IMixins.getLateMixins(Mixins.class, loadedMods);
if (loadedMods.contains("Thaumcraft")) {
// Replaces Thaumcraft's blockAiry with more nodes
// Config for this mixin is in the mixin itself
// config is not loaded at apply time
return Collections.singletonList("thaumcraft.MixinConfigBlocks");
}
return Collections.emptyList();
}
}
@@ -1,72 +0,0 @@
package makeo.gadomancy.coremod.mixins;
import static com.gtnewhorizon.gtnhlib.mixin.TargetedMod.THAUMCRAFT;
import java.util.List;
import java.util.function.Supplier;
import com.gtnewhorizon.gtnhlib.mixin.IMixins;
import com.gtnewhorizon.gtnhlib.mixin.ITargetedMod;
import com.gtnewhorizon.gtnhlib.mixin.MixinBuilder;
import com.gtnewhorizon.gtnhlib.mixin.Phase;
import com.gtnewhorizon.gtnhlib.mixin.Side;
public enum Mixins implements IMixins {
// Config for this one is in the mixin itself, as it may not be present at apply time
ADD_ADDITIONAL_NODES(
new MixinBuilder("Replaces Thaumcraft's blockAiry with more nodes").setPhase(Phase.LATE).setSide(Side.BOTH)
.addTargetedMod(THAUMCRAFT).addMixinClasses("thaumcraft.MixinConfigBlocks").setApplyIf(() -> true));
private final List<String> mixinClasses;
private final List<ITargetedMod> targetedMods;
private final List<ITargetedMod> excludedMods;
private final Supplier<Boolean> applyIf;
private final Phase phase;
private final Side side;
Mixins(MixinBuilder builder) {
mixinClasses = builder.mixinClasses;
targetedMods = builder.targetedMods;
excludedMods = builder.excludedMods;
applyIf = builder.applyIf;
phase = builder.phase;
side = builder.side;
if (mixinClasses.isEmpty()) throw new RuntimeException("No mixin class specified for Mixin : " + name());
if (targetedMods.isEmpty()) throw new RuntimeException("No targeted mods specified for Mixin : " + name());
if (applyIf == null) throw new RuntimeException("No ApplyIf function specified for Mixin : " + name());
if (phase == null) throw new RuntimeException("No Phase specified for Mixin : " + name());
if (side == null) throw new RuntimeException("No Side function specified for Mixin : " + name());
}
@Override
public List<String> getMixinClasses() {
return mixinClasses;
}
@Override
public Supplier<Boolean> getApplyIf() {
return applyIf;
}
@Override
public Phase getPhase() {
return phase;
}
@Override
public Side getSide() {
return side;
}
@Override
public List<ITargetedMod> getTargetedMods() {
return targetedMods;
}
@Override
public List<ITargetedMod> getExcludedMods() {
return excludedMods;
}
}