miscellaneous fixes to make stuff *just work*

This commit is contained in:
FalsePattern committed 2022-07-13 22:02:45 +02:00
1 parent 86f9e54251
commit 600c28edbb
9 files changed
+146 -2

No files matched your search

@@ -6,6 +6,7 @@ import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLConstructionEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@@ -24,6 +25,11 @@ public class EndlessIDs {
modId = Tags.MODID)
private static CommonManager patchManager;
@Mod.EventHandler
public void construct(FMLConstructionEvent e) {
patchManager.construct();
}
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {
patchManager.preInit();
@@ -0,0 +1,19 @@
package com.falsepattern.endlessids.mixin.mixins.common.tropicraft;
import com.falsepattern.endlessids.constants.VanillaConstants;
import net.tropicraft.world.genlayer.GenLayerTropiVoronoiZoom;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(value = GenLayerTropiVoronoiZoom.class,
remap = false)
public abstract class GenLayerTropiVoronoiZoomMixin {
@ModifyConstant(method = "getInts",
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
remap = true,
require = 1)
private int fixStupidBitMask(int constant) {
return 0xFFFFFFFF;
}
}
@@ -159,6 +159,8 @@ public enum Mixin implements IMixin {
//region Tropicraft->common
ChunkProviderTropicraftMixin(Side.COMMON, require(TargetedMod.TROPICRAFT),
"tropicraft.ChunkProviderTropicraftMixin"),
GenLayerTropiVoronoiZoomMixin(Side.COMMON, require(TargetedMod.TROPICRAFT),
"tropicraft.GenLayerTropiVoronoiZoomMixin"),
//endregion Tropicraft->common
//region TwilightForest->common
ChunkProviderTwilightForestMixin(Side.COMMON, require(TargetedMod.TWILIGHTFOREST),
@@ -19,6 +19,22 @@ public class CommonManager {
patches.add(new Futurepack());
}
@SneakyThrows
public final void construct() {
for (val patch : patches) {
if (Loader.isModLoaded(patch.modid)) {
try {
if (patch.construct()) {
EndlessIDs.LOG.info("Applied preInit patches for " + patch.modid);
}
} catch (Exception e) {
EndlessIDs.LOG.fatal("Failed to apply preInit patches for " + patch.modid, e);
throw e;
}
}
}
}
@SneakyThrows
public final void preInit() {
for (val patch : patches) {
@@ -6,6 +6,11 @@ import lombok.RequiredArgsConstructor;
public class Patch {
public final String modid;
@SuppressWarnings("RedundantThrows")
public boolean construct() throws Exception {
return false;
}
@SuppressWarnings("RedundantThrows")
public boolean preInit() throws Exception {
return false;
@@ -8,7 +8,7 @@ public class Futurepack extends Patch {
}
@Override
public boolean init() throws Exception {
public boolean construct() throws Exception {
Class.forName("futurepack.common.dim.BiomeGenSpace");
return true;
}