Tropicraft compat (fixes #15)

This commit is contained in:
FalsePattern committed 2022-07-13 20:09:55 +02:00
1 parent 1aa130549e
commit 642a99ea7b
6 files changed
+61

No files matched your search

+1
View File
@@ -34,6 +34,7 @@ This mod also contains patches for the following mods:
- Nature's Compass
- Realistic Terrain Generation
- Thaumcraft
- Tropicraft
- Twilight Forest
- Underground Biomes Constructs
- WorldEdit
+10
View File
@@ -76,6 +76,11 @@ dependencies {
//Thaumcraft 4.2.3.5
compile(deobfCurse("thaumcraft-223628:2227552"))
//Tropicraft 6.0.5
//This is from a mirror file, because the file on curseforge is a zip containing other files too.
//Source: https://www.curseforge.com/minecraft/mc-mods/tropicraft/files/2353906
compile(deobf("https://maven.falsepattern.com/mirror/mirror/tropicraft-6.0.5.jar"))
//Twilight Forest 2.3.8
compile(deobfCurse("twilightforest-227639:3039937"))
@@ -94,4 +99,9 @@ dependencies {
//Baubles 1.0.1.10
//needed by: Thaumcraft
compile(deobfCurse("baubles-227083:2224857"))
//CoroUtil 1.1.3
//needed by: Tropicraft
//Same reason for being local as tropicraft
compile(deobf("https://maven.falsepattern.com/mirror/mirror/coroutil-1.1.3.jar"))
}
@@ -2,11 +2,13 @@ package com.falsepattern.endlessids;
import code.elix_x.coremods.antiidconflict.managers.BiomesManager;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import lombok.SneakyThrows;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@Mod(modid = Tags.MODID,
@@ -22,10 +24,25 @@ public class EndlessIDs {
BiomesManager.conflicts = new BiomesManager.ConflictingBiomes[ExtendedConstants.biomeIDCount];
}
/**
* Trigger earlier biome registration for tropicraft so that it can be caught by AntiIDConflict.
*/
@SneakyThrows
private static void tropicraftInitPatch() {
Class.forName("net.tropicraft.world.biomes.BiomeGenTropicraft");
}
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {
if (Loader.isModLoaded("antiidconflict")) {
antiIdConflictLatePatch();
}
}
@Mod.EventHandler
public void init(FMLInitializationEvent e) {
if (Loader.isModLoaded("tropicraft")) {
tropicraftInitPatch();
}
}
}
@@ -0,0 +1,28 @@
package com.falsepattern.endlessids.mixin.mixins.common.tropicraft;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
import net.tropicraft.world.chunk.ChunkProviderTropicraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
@Mixin(value = ChunkProviderTropicraft.class,
remap = false)
public abstract class ChunkProviderTropicraftMixin {
@Shadow
private BiomeGenBase[] biomesForGeneration;
@Redirect(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
remap = true),
remap = true,
require = 1)
private byte[] setBiomesTweaked(Chunk chunk) {
return BiomePatchHelper.getBiomeArrayTweaked(chunk, biomesForGeneration);
}
}
@@ -149,6 +149,10 @@ public enum Mixin implements IMixin {
//region Thaumcraft->common
ThaumcraftUtilsMixin(Side.COMMON, require(TargetedMod.THAUMCRAFT), "thaumcraft.UtilsMixin"),
//endregion Thaumcraft->common
//region Tropicraft->common
ChunkProviderTropicraftMixin(Side.COMMON, require(TargetedMod.TROPICRAFT),
"tropicraft.ChunkProviderTropicraftMixin"),
//endregion Tropicraft->common
//region TwilightForest->common
ChunkProviderTwilightForestMixin(Side.COMMON, require(TargetedMod.TWILIGHTFOREST),
"twilightforest.ChunkProviderTwilightForestMixin"),
@@ -28,6 +28,7 @@ public enum TargetedMod implements ITargetedMod {
NATURESCOMPASS("Nature's Compass", true, startsWith("naturescompass")),
RTG("Realistic Terrain Generation", true, startsWith("rtg-")),
THAUMCRAFT("Thaumcraft", true, startsWith("thaumcraft")),
TROPICRAFT("Tropicraft", true, startsWith("tropicraft-")),
TWILIGHTFOREST("Twilight Forest", true, startsWith("twilightforest")),
UBC("Underground Biomes Constructs", false, startsWith("undergroundbiomesconstructs-")),
WORLDEDIT("WorldEdit", false, startsWith("worldedit-")),