Delete overkill mixin registration system (#26)

This commit is contained in:
Alexdoru authored and GitHub committed 2025-07-09 18:04:05 +02:00
1 parent e1faace7d5
commit 0a89708853
4 files changed
+4 -75

No files matched your search

+1 -1
View File
@@ -91,7 +91,7 @@ usesMixins = true
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
usesMixinDebug = true
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
+2 -3
View File
@@ -1,13 +1,12 @@
package chylex.hee;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.gtnewhorizon.gtnhlib.mixin.IMixins;
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
import chylex.hee.mixins.Mixins;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
public class HEECore implements IFMLLoadingPlugin, IEarlyMixinLoader {
@@ -19,7 +18,7 @@ public class HEECore implements IFMLLoadingPlugin, IEarlyMixinLoader {
@Override
public List<String> getMixins(Set<String> loadedCoreMods) {
return IMixins.getEarlyMixins(Mixins.class, loadedCoreMods);
return Collections.singletonList("minecraft.MixinBlock_ReplaceDragonEgg");
}
@Override
@@ -1,70 +0,0 @@
package chylex.hee.mixins;
import static com.gtnewhorizon.gtnhlib.mixin.TargetedMod.VANILLA;
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 {
REPLACE_DRAGON_EGG(new MixinBuilder("Replaces the dragon egg").setApplyIf(() -> true)
.addMixinClasses("minecraft.MixinBlock").addTargetedMod(VANILLA).setSide(Side.BOTH).setPhase(Phase.EARLY));
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;
}
}
@@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.Slice;
import chylex.hee.block.BlockDragonEggCustom;
@Mixin(Block.class)
public class MixinBlock {
public class MixinBlock_ReplaceDragonEgg {
@ModifyArg(
method = "registerBlocks",