Compare commits

..
Author SHA1 Message Date
FalsePattern b1c8d1edb2 twilight forest fix 2022-07-11 00:21:48 +02:00
FalsePattern 4b23b1949c update fplib dep 2022-07-11 00:05:27 +02:00
FalsePattern 0e32ffebae code cleanup 2022-07-11 00:04:59 +02:00
FalsePattern ef52fa6e51 Thaumcraft compat 2022-07-11 00:02:17 +02:00
FalsePattern 42c59a668f twilightforest naming fixes 2022-07-10 23:58:31 +02:00
FalsePattern 9d24a015ff BOP fixes 2022-07-10 23:39:53 +02:00
FalsePattern 3b85cf7db5 chunk provider logic unification 2022-07-10 23:34:52 +02:00
FalsePattern 15803fceff Twilight Forest compat 2022-07-10 23:07:02 +02:00
FalsePattern 4a185892ea clean up some logging 2022-07-10 23:06:24 +02:00
FalsePattern a2d354dd38 more fixes to AIDC 2022-07-04 18:51:07 +02:00
FalsePattern 5c3f35a855 externalize dependencies 2022-07-04 18:48:31 +02:00
FalsePattern 1082b5538f improve AntiIDConflict's code. 2022-07-04 18:37:15 +02:00
FalsePattern 9bb729071b fix a crash without AntiIDConflict.
We don't need this patch without it anyways.
2022-07-04 16:23:45 +02:00
FalsePattern f28d5fbc3e Immersive Cavegen compat 2022-07-03 23:18:52 +02:00
FalsePattern 3c53ecf624 add archaicfix to dev and readme 2022-07-03 23:17:13 +02:00
FalsePattern 0c3e745afa surround my dynamics 2022-07-03 22:35:19 +02:00
FalsePattern d594898485 fix archaicfix 2022-07-03 22:13:48 +02:00
FalsePattern 85689649bd update readme again 2022-07-03 20:15:37 +02:00
FalsePattern 04ddf0c29a update readme 2022-07-03 20:01:26 +02:00
FalsePattern fb6fb88a49 remove BoP testing code 2022-07-03 19:56:38 +02:00
FalsePattern 8e23dd1f07 Nature's Compass compat 2022-07-03 19:56:08 +02:00
FalsePattern 362e1dc9ca AntiIDConflict do not log placeholders 2022-07-03 19:43:23 +02:00
FalsePattern a2774e84ef restyle code 2022-07-03 19:40:42 +02:00
FalsePattern f315774db4 Realistic Terrain Generation compat 2022-07-03 19:39:34 +02:00
FalsePattern 6e66066f65 way more reliable DragonAPI patch 2022-07-03 19:17:16 +02:00
46 changed files with 1052 additions and 436 deletions

No files matched your search

+30 -8
View File
@@ -1,24 +1,46 @@
EndlessIDs is a modern rewrite of NotEnoughIDs which increases the limit even more, up to the maximum 24 bit unsigned integer value.
EndlessIDs is the unofficial successor of NotEnoughIDs, with more focus on compatibility, stability, and reaching
new limits.
| | Vanilla | NotEnoughIDs | EndlessIDs |
|-----------|---------|--------------|------------|
| Block IDs | 4096 | 32000 | 16777216 |
| Item IDs | 32000 | 32000 | 16777216 |
Comparison of the known limits:
| | Vanilla | NotEnoughIDs | EndlessIDs |
|-----------------|----------------------------------------------------|--------------|----------------------------------|
| Block IDs | 4,096 | 32,000 | 16,777,216 |
| Item IDs | 32,000 | 32,000 | 16,777,216 |
| Biome IDs | 256 | 256 | 65,536 |
| Entity IDs | 256 | 256 | 256 right now, extension planned |
| Potion IDs | 32 | 32 | 32 right now, extension planned |
| Enchantment IDs | 256 | 256 | 256 right now, extension planned |
| Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same |
This mod also contains patches for the following mods:
- Anti ID Conflict
- Alternate Terrain Generation
- Anti ID Conflict
- ArchaicFix
- Biomes O' Plenty
- CoFH Lib
- DragonAPI
- GalactiCraft
- Immersive Cavegen
- More Fun Quicksand Mod
- Nature's Compass
- Realistic Terrain Generation
- Thaumcraft
- Twilight Forest
- Underground Biomes Constructs
- WorldEdit
Mods not listed here may or may not work. A good rule of thumb is that the more invasive a mod is, the higher the chance
it's broken without a patch once the IDs exceed 4096 and 32000.
Mods not listed here may or may not work.
- For item/block IDs:
- A good rule of thumb is that the more invasive a mod is, the higher the chance
it's broken without a patch once the IDs exceed 4096 and 32000.
- For biome IDs:
- If a mod adds a custom world generator, it has a high chance of invoking an old vanilla method in the worldgen code.
To avoid world corruption and broken biomes, this method has been replaced with an instant crash that refers the
user to this github repo.
If you find any crashes or incompatibilities, don't hesitate to open an issue.
+10 -2
View File
@@ -4,7 +4,7 @@ dependencies {
}
annotationProcessor("org.projectlombok:lombok:1.18.22")
compile("com.falsepattern:falsepatternlib-mc1.7.10:0.9.1:dev")
compile("com.falsepattern:falsepatternlib-mc1.7.10:0.9.2:dev")
String curseMaven = "https://cursemaven.falsepattern.com/" //Use https://cursemaven.com/ if this is down
compileOnly(deobfMaven(curseMaven, "curse.maven:undergroundbiomesconstructs-72744:2304497")) // 0.8-beta49
@@ -16,5 +16,13 @@ dependencies {
compile(deobfMaven(curseMaven, "curse.maven:antiidconflict-246288:2308279")) // 1.3.5
compile("curse.maven:atg-228356:2231155") // 0.12.0
compile(deobfMaven(curseMaven, "curse.maven:biomesoplenty-220318:2499612")) // 2.1.0.2308
compileOnly(files("lib/GalacticraftCore-1.7-3.0.12.504-deobf.jar"))
compile(deobfMaven(curseMaven, "curse.maven:rtg-237989:2521557")) // 1.1.1.7
compile(deobfMaven(curseMaven, "curse.maven:naturescompass-252848:2451823")) // 1.3.1
compile(deobfMaven(curseMaven, "curse.maven:dynamicsurrounding-238891:2642381")) // 1.0.6.4
compile(deobfMaven(curseMaven, "curse.maven:immersivecavegen-521557:3649411")) // 1.2g
compile(deobfMaven(curseMaven, "curse.maven:twilightforest-227639:3039937")) // 2.3.8
compile(deobfMaven(curseMaven, "curse.maven:thaumcraft-223628:2227552")) // 4.2.3.5
compile(deobfMaven(curseMaven, "curse.maven:baubles-227083:2224857")) // 1.0.1.10, dependency of thaumcraft
compile("com.github.embeddedt:ArchaicFix:be8666cb2dbf2e0a8b799e88cef3c0d12e5d4911:dev")
compileOnly(deobf("https://micdoodle8.com/new-builds/GC-1.7/504/GalacticraftCore-1.7-3.0.12.504.jar"))
}
+1 -1
View File
@@ -86,7 +86,7 @@ usesShadowedDependencies = false
# path will be removed, and all classes that refer to said classes will be modified so that the "stubpackage" will map
# to the root package instead. This is useful for referring to compile-time inaccessible classes, such as classes in the
# default package
remapStubs = false
remapStubs = true
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
Binary file not shown.
+4
View File
@@ -12,4 +12,8 @@ repositories {
name = "mavenpattern"
url = "https://maven.falsepattern.com/"
}
maven {
name = "jitpack"
url = "https://jitpack.falsepattern.com/"
}
}
@@ -5,21 +5,18 @@ import com.falsepattern.endlessids.constants.ExtendedConstants;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@Mod(modid = Tags.MODID,
version = Tags.VERSION,
name = Tags.MODNAME,
acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:falsepatternlib@[0.9.1,);after:antiidconflict")
dependencies = "required-after:falsepatternlib@[0.9.2,);after:antiidconflict")
public class EndlessIDs {
public static final byte[] BIOME_ARRAY_PLACEHOLDER = new byte[0];
public static final Logger LOG = LogManager.getLogger(Tags.MODNAME);
public static BiomeGenBase[] fakeBiomeArray;
public static boolean postInitFinished = false;
private static void antiIdConflictLatePatch() {
BiomesManager.conflicts = new BiomesManager.ConflictingBiomes[ExtendedConstants.biomeIDCount];
@@ -31,10 +28,4 @@ public class EndlessIDs {
antiIdConflictLatePatch();
}
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent e) {
postInitFinished = true;
fakeBiomeArray = null;
}
}
@@ -3,10 +3,14 @@ package com.falsepattern.endlessids;
import com.falsepattern.endlessids.asm.IETransformer;
import com.falsepattern.lib.config.ConfigException;
import com.falsepattern.lib.config.ConfigurationManager;
import lombok.SneakyThrows;
import lombok.val;
import net.minecraft.launchwrapper.LaunchClassLoader;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import java.util.Map;
import java.util.Set;
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.DependsOn;
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
@@ -30,7 +34,19 @@ public class IEPlugin implements IFMLLoadingPlugin {
super();
}
@SneakyThrows
public String[] getASMTransformerClass() {
val cl = ((LaunchClassLoader) this.getClass().getClassLoader());
val field = cl.getClass().getDeclaredField("transformerExceptions");
field.setAccessible(true);
val exceptions = (Set<String>) field.get(cl);
if (exceptions.contains("code.elix_x.coremods")) {
IETransformer.logger.info("AntiIDConflict detected!");
IETransformer.logger.info("Removing ASM protections so that we can fix its code.");
exceptions.remove("code.elix_x.coremods");
exceptions.add("code.elix_x.coremods.antiidconflict.core");
exceptions.add("code.elix_x.coremods.antiidconflict.ByteCodeTester");
}
return new String[]{IETransformer.class.getName()};
}
@@ -0,0 +1,48 @@
package com.falsepattern.endlessids.asm;
import Reika.DragonAPI.Libraries.Java.ReikaJavaLibrary;
import com.falsepattern.endlessids.asm.stubpackage.Reika.DragonAPI.ModList;
import lombok.SneakyThrows;
import cpw.mods.fml.common.Loader;
public class ASMHooks {
@SneakyThrows
public static void DragonAPIModListConstructorTweak(ModList list) {
list.successful = false;
DragonAPIModListTryLoad(list);
}
public static boolean DragonAPIModListTryLoad(ModList list) {
if (!list.successful) {
try {
list.condition = Loader.isModLoaded(list.modLabel);
list.successful = true;
if (list.condition) {
ReikaJavaLibrary.pConsole(
"DRAGONAPI: " + list + " detected in the MC installation. Adjusting behavior accordingly.");
} else {
ReikaJavaLibrary.pConsole(
"DRAGONAPI: " + list + " not detected in the MC installation. No special action taken.");
}
if (list.condition) {
ReikaJavaLibrary.pConsole("DRAGONAPI: Attempting to load data from " + list);
if (list.blockClasses == null) {
ReikaJavaLibrary.pConsole("DRAGONAPI: Could not block class for " + list +
": Specified class was null. This may not be an error.");
}
if (list.itemClasses == null) {
ReikaJavaLibrary.pConsole("DRAGONAPI: Could not item class for " + list +
": Specified class was null. This may not be an error.");
}
}
} catch (NullPointerException e) {
list.condition = list.successful = false;
}
}
return list.condition;
}
public static void DragonAPIModListSuppressLogging(Object obj) {
}
}
@@ -1,5 +1,6 @@
package com.falsepattern.endlessids.asm;
import com.falsepattern.endlessids.asm.transformer.DragonAPIModList;
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
import java.util.HashMap;
@@ -8,7 +9,7 @@ import java.util.Map;
public enum ClassEdit {
FmlRegistry(new FmlRegistry(), new String[]{"cpw.mods.fml.common.registry.GameData",
"cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry"}),
;
DragonAPIModList(new DragonAPIModList(), new String[]{"Reika.DragonAPI.ModList"});
private static final Map<String, ClassEdit> editMap;
@@ -0,0 +1,9 @@
package com.falsepattern.endlessids.asm.stubpackage.Reika.DragonAPI;
public class ModList {
public String modLabel;
public boolean condition;
public boolean successful;
public String[] itemClasses;
public String[] blockClasses;
}
@@ -0,0 +1,140 @@
package com.falsepattern.endlessids.asm.transformer;
import com.falsepattern.endlessids.asm.ASMHooks;
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
import lombok.val;
import lombok.var;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.FrameNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.LineNumberNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.VarInsnNode;
import java.util.Arrays;
import java.util.List;
public class DragonAPIModList implements IClassNodeTransformer {
private static final List<String> fields = Arrays.asList("condition", "itemClasses", "blockClasses");
private static void tweakIsLoaded(MethodNode method) {
val iterator = method.instructions.iterator();
iterator.next();
iterator.next();
iterator.next();
iterator.next();
iterator.set(new MethodInsnNode(Opcodes.INVOKESTATIC, Type.getInternalName(ASMHooks.class),
"DragonAPIModListTryLoad", "(LReika/DragonAPI/ModList;)Z", false));
}
private static void tweakInit(MethodNode method) {
val iterator = method.instructions.iterator();
while (iterator.hasNext()) {
var insn = iterator.next();
if (insn instanceof LineNumberNode && ((LineNumberNode) insn).line == 154) {
//SRC:
// L3
// LINENUMBER 154 L3
// ALOAD 0
// ALOAD 0
// GETFIELD Reika/DragonAPI/ModList.modLabel : Ljava/lang/String;
// INVOKESTATIC cpw/mods/fml/common/Loader.isModLoaded (Ljava/lang/String;)Z
// PUTFIELD Reika/DragonAPI/ModList.condition : Z
//TGT:
// L3
// LINENUMBER 154 L3
// ALOAD 0
// ALOAD 5
// PUTFIELD Reika/DragonAPI/ModList.itemClasses : [Ljava/lang/String;
// ALOAD 0
// ALOAD 4
// PUTFIELD Reika/DragonAPI/ModList.blockClasses : [Ljava/lang/String;
// ALOAD 0
// INVOKESTATIC ASMHooks.isModLoaded (LReika/DragonAPI/ModList;)V
// FRAME FULL [Reika/DragonAPI/ModList java/lang/String I java/lang/String [Ljava/lang/String; [Ljava/lang/String;] []
// RETURN
iterator.add(new VarInsnNode(Opcodes.ALOAD, 0));
iterator.add(new VarInsnNode(Opcodes.ALOAD, 5));
iterator.add(new FieldInsnNode(Opcodes.PUTFIELD, "Reika/DragonAPI/ModList", "itemClasses",
"[Ljava/lang/String;"));
iterator.add(new VarInsnNode(Opcodes.ALOAD, 0));
iterator.add(new VarInsnNode(Opcodes.ALOAD, 4));
iterator.add(new FieldInsnNode(Opcodes.PUTFIELD, "Reika/DragonAPI/ModList", "blockClasses",
"[Ljava/lang/String;"));
iterator.next();
iterator.remove();
iterator.next();
iterator.next();
iterator.remove();
var methodInsn = (MethodInsnNode) iterator.next();
methodInsn.owner = Type.getInternalName(ASMHooks.class);
methodInsn.name = "DragonAPIModListConstructorTweak";
methodInsn.desc = "(LReika/DragonAPI/ModList;)V";
iterator.add(new FrameNode(Opcodes.F_FULL, 6,
new Object[]{"Reika/DragonAPI/ModList", "java/lang/String", Opcodes.INTEGER,
"java/lang/String", "[Ljava/lang/String;",
"[Ljava/lang/String;"}, 0, new Object[]{}));
iterator.add(new InsnNode(Opcodes.RETURN));
iterator.add(new FrameNode(Opcodes.F_FULL, 6,
new Object[]{"Reika/DragonAPI/ModList", "java/lang/String", Opcodes.INTEGER,
"java/lang/String", "[Ljava/lang/String;",
"[Ljava/lang/String;"}, 0, new Object[]{}));
iterator.next();
iterator.remove();
break;
}
}
}
private void crash() {
throw new IllegalStateException("Tweaking failed!");
}
@Override
public void transform(final ClassNode cn, final boolean obfuscated) {
int state = 0;
for (val field : cn.fields) {
if (field.name.equals("__MARKER__FALSEPATTERN__MIXINPATCH__")) {
return;
}
}
for (val field : cn.fields) {
if (field.name.equals("condition") && field.desc.equals("Z")) {
field.access &= ~Opcodes.ACC_FINAL;
state++;
}
if (fields.contains(field.name)) {
field.access &= ~Opcodes.ACC_PRIVATE;
field.access &= ~Opcodes.ACC_PROTECTED;
field.access |= Opcodes.ACC_PUBLIC;
state++;
}
}
if (state != 4) {
crash();
}
cn.fields.add(new FieldNode(Opcodes.ACC_PUBLIC, "successful", "Z", null, 0));
cn.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, "__MARKER__FALSEPATTERN__MIXINPATCH__", "Z", null, 0));
int state2 = 0;
for (val method : cn.methods) {
if ((state2 & 1) == 0 && method.name.equals("<init>") &&
method.desc.equals("(Ljava/lang/String;ILjava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)V")) {
tweakInit(method);
state2 |= 1;
}
if ((state2 & 2) == 0 && method.name.equals("isLoaded") && method.desc.equals("()Z")) {
tweakIsLoaded(method);
state2 |= 2;
}
}
if (state2 != 3) {
crash();
}
}
}
@@ -0,0 +1,13 @@
package com.falsepattern.endlessids.mixin.helpers;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class AIDCStringFixer {
public static String fixString(String str) {
str = str.replace("\\", "");
str = str.replace("vaible", "vailable");
return str;
}
}
@@ -0,0 +1,30 @@
package com.falsepattern.endlessids.mixin.helpers;
import lombok.val;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import java.util.function.IntFunction;
import static com.falsepattern.endlessids.EndlessIDs.BIOME_ARRAY_PLACEHOLDER;
public class BiomePatchHelper {
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
for (int i = 0; i < chunkBiomes.length; ++i) {
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
}
return BIOME_ARRAY_PLACEHOLDER;
}
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
for (int i = 0; i < chunkBiomes.length; ++i) {
chunkBiomes[i] = (short) biomesForGeneration[i].biomeID;
}
return BIOME_ARRAY_PLACEHOLDER;
}
}
@@ -0,0 +1,36 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
import org.spongepowered.asm.lib.Opcodes;
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.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import java.io.File;
@Mixin(value = AntiIdConflictBase.class,
remap = false)
public abstract class AntiIdConflictBaseMixin {
@Shadow
public static File mainFolder;
@Inject(method = "preinit",
at = @At("HEAD"),
require = 1)
private static void fixPath(FMLPreInitializationEvent event, CallbackInfo ci) {
mainFolder = new File(event.getModConfigurationDirectory().getPath(), "AntiIDConflict");
}
@Redirect(method = "preinit",
at = @At(value = "FIELD",
target = "Lcode/elix_x/coremods/antiidconflict/AntiIdConflictBase;mainFolder:Ljava/io/File;",
opcode = Opcodes.PUTSTATIC),
require = 1)
private static void removeOldPut(File value) {
}
}
@@ -1,35 +0,0 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import com.falsepattern.endlessids.EndlessIDs;
import lombok.val;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Final;
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;
@Mixin(BiomeGenBase.class)
public abstract class BiomeGenBaseMixin {
@Shadow
@Final
private static BiomeGenBase[] biomeList;
@Redirect(method = "getBiomeGenArray",
at = @At(value = "FIELD",
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeList:[Lnet/minecraft/world/biome/BiomeGenBase;",
opcode = Opcodes.GETSTATIC),
require = 1)
private static BiomeGenBase[] returnFakeArray() {
if (!EndlessIDs.postInitFinished) {
val trace = Thread.currentThread().getStackTrace()[3];
if (trace.getMethodName().equals("updateBiomesFolder") &&
trace.getClassName().equals("code.elix_x.coremods.antiidconflict.managers.BiomesManager")) {
return EndlessIDs.fakeBiomeArray;
}
}
return biomeList;
}
}
@@ -23,8 +23,10 @@ public abstract class BiomeGenBasePlaceholderMixin {
remap = false),
require = 1)
private int removePlaceholders(int id, boolean register) {
if (biomeList[id] instanceof PlaceholderBiome) {
biomeList[id] = null;
if (register) {
if (biomeList[id] instanceof PlaceholderBiome) {
biomeList[id] = null;
}
}
return AsmHooks.getBiomeID(id, register);
}
@@ -0,0 +1,218 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
import code.elix_x.coremods.antiidconflict.managers.BiomesManager;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
import lombok.val;
import org.apache.commons.lang3.ArrayUtils;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import net.minecraft.world.biome.BiomeGenBase;
import java.io.File;
import java.io.PrintWriter;
import static code.elix_x.coremods.antiidconflict.managers.BiomesManager.conflicts;
@Mixin(value = BiomesManager.class,
remap = false)
public abstract class BiomesManagerMixin {
@Shadow
public static String freeBiomeIDs;
@Shadow
public static String occupiedBiomeIDs;
@Shadow
public static boolean debug;
@Shadow
public static int IconflictedIds;
@Shadow
public static String conflictedIds;
private static String[] getIntervalNaming(int first, int last) {
if (first == last) {
return new String[]{Integer.toString(first)};
} else if (first + 1 == last) {
return new String[]{Integer.toString(first), Integer.toString(last)};
} else {
return new String[]{first + "-" + last};
}
}
@ModifyConstant(method = "<clinit>",
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
require = 1)
private static int extendIDs(int constant) {
return ExtendedConstants.biomeIDCount;
}
@ModifyConstant(method = {"preinit", "setUpBiomesFolder"},
constant = {@Constant(stringValue = "\\biomes"),
@Constant(stringValue = "\\main.cfg")})
private static String fixPaths(String original) {
return AIDCStringFixer.fixString(original);
}
/**
* @author FalsePattern
* @reason Better code, and detecting empty areas.
*/
@Overwrite
public static void updateBiomesFolder() throws Exception {
val biomes = BiomeGenBase.getBiomeGenArray();
val builder = new StringBuilder();
boolean hasEmpty = false;
int emptyRegionStart = 0;
for (int i = 0; i < biomes.length; ++i) {
if (biomes[i] == null) {
if (!hasEmpty) {
emptyRegionStart = i;
hasEmpty = true;
}
++BiomesManager.freeIds;
} else if (hasEmpty) {
hasEmpty = false;
for (val part : getIntervalNaming(emptyRegionStart, i - 1)) {
builder.append(part).append('\n');
}
}
}
if (hasEmpty) {
for (val part : getIntervalNaming(emptyRegionStart, ExtendedConstants.biomeIDCount - 1)) {
builder.append(part).append('\n');
}
}
freeBiomeIDs = builder.toString();
builder.setLength(0);
System.out.println("Found " + BiomesManager.freeIds + " free biome ids in total.");
for (val biome : biomes) {
if (biome != null) {
builder.append(biome.biomeID)
.append(" : ")
.append(biome.biomeName)
.append(" (")
.append(biome.getBiomeClass())
.append(")\n");
++BiomesManager.occupiedIds;
}
}
occupiedBiomeIDs = builder.toString();
builder.setLength(0);
System.out.println("Found " + BiomesManager.occupiedIds + " occupied biome ids in total.");
for (val conflict : conflicts) {
if (conflict != null) {
if (debug) {
System.out.println(
"Found biomes id conflict for " + conflict.ID + " : " + conflict.getCrashMessage());
}
builder.append(conflict.getCrashMessage()).append('\n');
++IconflictedIds;
}
}
conflictedIds = builder.toString();
builder.setLength(0);
System.out.println("Found " + IconflictedIds + " conflicted biome ids in total.");
File available = new File(AntiIdConflictBase.biomesFolder, "availableIDs.txt");
if (available.exists()) {
available.delete();
}
available.createNewFile();
PrintWriter writer = new PrintWriter(available);
writer.println("Total amount of free biome ids: " + available);
writer.println("List of free biome ids:");
val freeIDs = freeBiomeIDs.split("\n");
for (val freeID : freeIDs) {
writer.println(freeID);
}
writer.close();
val occupied = new File(AntiIdConflictBase.biomesFolder, "occupiedIDs.txt");
if (occupied.exists()) {
occupied.delete();
}
occupied.createNewFile();
writer = new PrintWriter(occupied);
writer.println("Total amount of occupied biome ids: " + BiomesManager.occupiedIds);
writer.println("Table of occupied biome ids and their owners");
writer.println("id:name(class)");
val occupiedIDs = occupiedBiomeIDs.split("\n");
for (String occupiedID : occupiedIDs) {
writer.println(occupiedID);
}
writer.close();
val conflicted = new File(AntiIdConflictBase.biomesFolder, "conflictedIDs.txt");
if (conflicted.exists()) {
conflicted.delete();
}
conflicted.createNewFile();
writer = new PrintWriter(conflicted);
writer.println("Total amount of conflicted biome ids: " + IconflictedIds);
writer.println("IDs in conflict:\n");
val conflictedIDs = conflictedIds.split("\n");
for (val conflictedID : conflictedIDs) {
writer.println(conflictedID);
}
writer.close();
val all = new File(AntiIdConflictBase.biomesFolder, "AllIDs.txt");
writer = new PrintWriter(all);
writer.println("Total amount of free biome ids: " + BiomesManager.freeIds);
writer.println("Total amount of occupied biome ids: " + BiomesManager.occupiedIds);
writer.println("Total amount of conflicted biome ids: " + IconflictedIds);
writer.println("All ids and their position:");
hasEmpty = false;
emptyRegionStart = 0;
for (int i = 0; i < biomes.length; ++i) {
if (!ArrayUtils.isEmpty(conflicts) && conflicts[i] != null) {
writer.println(conflicts[i].getCrashMessage());
} else if (biomes[i] != null) {
if (hasEmpty) {
hasEmpty = false;
for (val part : getIntervalNaming(emptyRegionStart, i - 1)) {
writer.print(part);
writer.println(" is Available");
}
}
writer.print(i);
writer.print(" is Occupied by ");
writer.print(biomes[i].biomeName);
writer.print(" (");
writer.print(biomes[i].getBiomeClass().getName());
writer.println(")");
} else if (!hasEmpty) {
hasEmpty = true;
emptyRegionStart = i;
}
}
if (hasEmpty) {
for (val part : getIntervalNaming(emptyRegionStart, ExtendedConstants.biomeIDCount - 1)) {
writer.print(part);
writer.println(" is Available");
}
}
writer.close();
}
}
@@ -0,0 +1,22 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import code.elix_x.coremods.antiidconflict.managers.DimensionsManager;
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(value = DimensionsManager.class,
remap = false)
public abstract class DimensionsManagerMixin {
@ModifyConstant(method = "*",
constant = {@Constant(stringValue = "\\dimensions"),
@Constant(stringValue = "\\main.cfg"),
@Constant(stringValue = "\\avaibleIDs.txt"),
@Constant(stringValue = "\\occupiedIDs.txt"),
@Constant(stringValue = "\\AllIDs.txt")})
private static String fixPaths(String original) {
return AIDCStringFixer.fixString(original);
}
}
@@ -0,0 +1,22 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import code.elix_x.coremods.antiidconflict.managers.EnchantementsManager;
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(value = EnchantementsManager.class,
remap = false)
public abstract class EnchantementsManagerMixin {
@ModifyConstant(method = "*",
constant = {@Constant(stringValue = "\\enchantements"),
@Constant(stringValue = "\\main.cfg"),
@Constant(stringValue = "\\avaibleIDs.txt"),
@Constant(stringValue = "\\occupiedIDs.txt"),
@Constant(stringValue = "\\AllIDs.txt")})
private static String fixPaths(String original) {
return AIDCStringFixer.fixString(original);
}
}
@@ -0,0 +1,22 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import code.elix_x.coremods.antiidconflict.managers.EntitiesManager;
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(value = EntitiesManager.class,
remap = false)
public abstract class EntitiesManagerMixin {
@ModifyConstant(method = "*",
constant = {@Constant(stringValue = "\\entities"),
@Constant(stringValue = "\\main.cfg"),
@Constant(stringValue = "\\avaibleIDs.txt"),
@Constant(stringValue = "\\occupiedIDs.txt"),
@Constant(stringValue = "\\AllIDs.txt")})
private static String fixPaths(String original) {
return AIDCStringFixer.fixString(original);
}
}
@@ -0,0 +1,23 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import code.elix_x.coremods.antiidconflict.managers.PotionsManager;
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(value = PotionsManager.class,
remap = false)
public abstract class PotionsManagerMixin {
@ModifyConstant(method = "*",
constant = {@Constant(stringValue = "\\potions"),
@Constant(stringValue = "\\main.cfg"),
@Constant(stringValue = "\\avaibleIDs.txt"),
@Constant(stringValue = "\\occupiedIDs.txt"),
@Constant(stringValue = "\\conflictedIDs.txt"),
@Constant(stringValue = "\\AllIDs.txt")})
private static String fixPaths(String original) {
return AIDCStringFixer.fixString(original);
}
}
@@ -1,16 +1,12 @@
package com.falsepattern.endlessids.mixin.mixins.common.atg;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import lombok.val;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.asm.mixin.injection.Redirect;
import ttftcuts.atg.ATGChunkProvider;
import net.minecraft.block.Block;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
@@ -20,21 +16,13 @@ public abstract class ATGChunkProviderMixin {
@Shadow
private BiomeGenBase[] biomesForGeneration;
@Inject(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
remap = true,
shift = At.Shift.BEFORE),
cancellable = true,
remap = true,
locals = LocalCapture.CAPTURE_FAILHARD,
require = 1)
private void hijackChunkBiomeSetup(int chunkX, int chunkY, CallbackInfoReturnable<Chunk> cir, Block[] data, byte[] abyte, Chunk chunk) {
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
for (int i = 0; i < chunkBiomes.length; i++) {
chunkBiomes[i] = (short) biomesForGeneration[i].biomeID;
}
chunk.generateSkylightMap();
cir.setReturnValue(chunk);
@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);
}
}
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(value = BOPBiomeManager.class,
remap = false)
public abstract class BoPBiomeManagerMixin {
public abstract class BOPBiomeManagerMixin {
@ModifyConstant(method = "getNextFreeBiomeId",
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
require = 1)
@@ -23,11 +23,4 @@ public abstract class BoPBiomeManagerMixin {
private static int extendIDs2(int constant) {
return ExtendedConstants.biomeIDCount - 1;
}
@ModifyConstant(method = "<clinit>",
constant = @Constant(intValue = 40),
require = 1)
private static int moveBOPReallyFar(int constant) {
return 20000;
}
}
@@ -0,0 +1,28 @@
package com.falsepattern.endlessids.mixin.mixins.common.bop;
import biomesoplenty.common.world.ChunkProviderBOPEnd;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
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 = ChunkProviderBOPEnd.class,
remap = false)
public abstract class ChunkProviderBOPEndMixin {
@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);
}
}
@@ -0,0 +1,47 @@
package com.falsepattern.endlessids.mixin.mixins.common.bop;
import biomesoplenty.common.world.ChunkProviderBOPHell;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.block.Block;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
@Mixin(value = ChunkProviderBOPHell.class,
remap = false)
public abstract class ChunkProviderBOPHellMixin {
private BiomeGenBase[] bgb;
@Inject(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
shift = At.Shift.BEFORE,
remap = true),
locals = LocalCapture.CAPTURE_FAILHARD,
remap = true,
require = 1)
private void setBiomesTweaked1(int par1, int par2, CallbackInfoReturnable<Chunk> cir, byte[] abyte, Block[] blocks, Chunk chunk, BiomeGenBase[] abiomegenbase) {
bgb = abiomegenbase;
}
@Redirect(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
remap = true),
remap = true,
require = 1)
private byte[] setBiomesTweaked2(Chunk chunk) {
try {
return BiomePatchHelper.getBiomeArrayTweaked(chunk, bgb);
} finally {
bgb = null;
}
}
}
@@ -2,7 +2,6 @@ package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
import Reika.DragonAPI.Extras.IDType;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@@ -16,6 +15,7 @@ public abstract class IDTypeMixin {
private static int extendBiomeIDs(int constant) {
return ExtendedConstants.biomeIDCount - 2;
}
@ModifyConstant(method = "<clinit>",
constant = {@Constant(intValue = 4095), @Constant(intValue = 32767)},
require = 2)
@@ -12,7 +12,7 @@ import net.minecraft.world.gen.layer.GenLayerRiverMix;
public abstract class GenLayerRiverMixMixin {
@ModifyConstant(method = "getInts",
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
expect = 0)
expect = -1)
private int extendTheID(int constant) {
return ExtendedConstants.biomeIDMask;
}
@@ -0,0 +1,19 @@
package com.falsepattern.endlessids.mixin.mixins.common.icg;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import net.tclproject.mysteriumlib.asm.fixes.MysteriumPatchesFixesCave;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(value = MysteriumPatchesFixesCave.class,
remap = false)
public abstract class MysteriumPatchesFixesCaveMixin {
@ModifyConstant(method = "<clinit>",
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
require = 1)
private static int extendIDs(int constant) {
return ExtendedConstants.biomeIDCount;
}
}
@@ -0,0 +1,24 @@
package com.falsepattern.endlessids.mixin.mixins.common.naturescompass;
import com.chaosthedude.naturescompass.util.BiomeUtils;
import com.falsepattern.endlessids.PlaceholderBiome;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.world.biome.BiomeGenBase;
@Mixin(value = BiomeUtils.class,
remap = false)
public abstract class BiomeUtilsMixin {
@Inject(method = "biomeIsBlacklisted",
at = @At("HEAD"),
cancellable = true,
require = 1)
private static void blockPlaceholders(BiomeGenBase biome, CallbackInfoReturnable<Boolean> cir) {
if (biome instanceof PlaceholderBiome) {
cir.setReturnValue(true);
}
}
}
@@ -0,0 +1,41 @@
package com.falsepattern.endlessids.mixin.mixins.common.rtg;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
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 rtg.world.gen.ChunkProviderRTG;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
@Mixin(value = ChunkProviderRTG.class,
remap = false)
public abstract class ChunkProviderRTGMixin {
@Shadow
private BiomeGenBase[] baseBiomesList;
@Shadow
private int[] xyinverted;
@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, (i) -> baseBiomesList[xyinverted[i]]);
}
@Redirect(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V",
remap = true),
remap = true,
require = 1)
private void removeUnnecessarySet(Chunk chunk, byte[] bytes) {
}
}
@@ -0,0 +1,19 @@
package com.falsepattern.endlessids.mixin.mixins.common.rtg;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import rtg.world.gen.LandscapeGenerator;
@Mixin(value = LandscapeGenerator.class,
remap = false)
public abstract class LandscapeGeneratorMixin {
@ModifyConstant(method = "getNewerNoise",
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
require = 1)
private int extendIDs(int constant) {
return ExtendedConstants.biomeIDCount;
}
}
@@ -0,0 +1,8 @@
package com.falsepattern.endlessids.mixin.mixins.common.rtg;
import org.spongepowered.asm.mixin.Mixin;
import rtg.world.biome.realistic.RealisticBiomeBase;
@Mixin(RealisticBiomeBase.class)
public abstract class RealisticBiomeBaseMixin {
}
@@ -0,0 +1,37 @@
package com.falsepattern.endlessids.mixin.mixins.common.thaumcraft;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import thaumcraft.common.lib.network.PacketHandler;
import thaumcraft.common.lib.network.misc.PacketBiomeChange;
import thaumcraft.common.lib.utils.Utils;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import cpw.mods.fml.common.network.NetworkRegistry;
@Mixin(value = Utils.class,
remap = false)
public abstract class UtilsMixin {
/**
* @author FalsePattern
* @reason Biome ID Extension
*/
@Overwrite
public static void setBiomeAt(World world, int x, int z, BiomeGenBase biome) {
if (biome != null) {
Chunk chunk = world.getChunkFromBlockCoords(x, z);
short[] array = ((IChunkMixin) chunk).getBiomeShortArray();
array[(z & 15) << 4 | x & 15] = (short) (biome.biomeID);
if (!world.isRemote) {
PacketHandler.INSTANCE.sendToAllAround(new PacketBiomeChange(x, z, (short) biome.biomeID),
new NetworkRegistry.TargetPoint(world.provider.dimensionId, x,
world.getHeightValue(x, z), z,
32.0));
}
}
}
}
@@ -0,0 +1,28 @@
package com.falsepattern.endlessids.mixin.mixins.common.twilightforest;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
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 twilightforest.world.ChunkProviderTwilightForest;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
@Mixin(value = ChunkProviderTwilightForest.class,
remap = false)
public abstract class ChunkProviderTwilightForestMixin {
@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);
}
}
@@ -0,0 +1,19 @@
package com.falsepattern.endlessids.mixin.mixins.common.twilightforest;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import twilightforest.biomes.TFBiomeBase;
@Mixin(value = TFBiomeBase.class,
remap = false)
public abstract class TFBiomeBaseMixin {
@ModifyConstant(method = "findNextOpenBiomeId",
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
require = 1)
private static int extendIDs(int constant) {
return ExtendedConstants.biomeIDCount;
}
}
@@ -1,6 +1,5 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.biome;
import com.falsepattern.endlessids.EndlessIDs;
import com.falsepattern.endlessids.PlaceholderBiome;
import lombok.val;
import org.spongepowered.asm.mixin.Mixin;
@@ -11,8 +10,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import java.util.Arrays;
@Mixin(value = BiomeDictionary.class,
remap = false)
public abstract class BiomeDictionaryMixin {
@@ -21,7 +18,6 @@ public abstract class BiomeDictionaryMixin {
require = 1)
private static void cleanupBiomeArray(CallbackInfo ci) {
val biomes = BiomeGenBase.getBiomeGenArray();
EndlessIDs.fakeBiomeArray = Arrays.copyOf(biomes, biomes.length);
for (int i = 0; i < biomes.length; i++) {
if (biomes[i] instanceof PlaceholderBiome) {
biomes[i] = null;
@@ -34,8 +34,8 @@ public abstract class BiomeGenBaseMixin {
@Inject(method = "<init>(IZ)V",
at = @At(value = "RETURN"),
require = 1)
private void generatePlaceholders(int p_i1971_1_, boolean register, CallbackInfo ci) {
if (((Object) this) instanceof PlaceholderBiome) {
private void generatePlaceholders(int id, boolean register, CallbackInfo ci) {
if (((Object) this) instanceof PlaceholderBiome || !register) {
return;
}
if (biomeID >= 128 && biomeList[biomeID - 128] == null) {
@@ -1,36 +0,0 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.biome;
import com.falsepattern.endlessids.PlaceholderBiome;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
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;
@Mixin(BiomeGenBase.class)
public abstract class BiomeGenBasePlaceholderMixin {
@Shadow
@Final
private static BiomeGenBase[] biomeList;
@Mutable
@Shadow
@Final
public int biomeID;
@Redirect(method = "<init>(IZ)V",
at = @At(value = "FIELD",
opcode = Opcodes.PUTFIELD,
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeID:I"),
require = 1)
private void removePlaceholders(BiomeGenBase instance, int id) {
if (biomeList[id] instanceof PlaceholderBiome) {
biomeList[id] = null;
}
biomeID = id;
}
}
@@ -21,7 +21,8 @@ import net.minecraft.world.chunk.Chunk;
import java.util.Arrays;
@Mixin(Chunk.class)
@Mixin(value = Chunk.class,
priority = 900)
public abstract class ChunkMixin implements IChunkMixin {
@Shadow
@Final
@@ -30,6 +31,8 @@ public abstract class ChunkMixin implements IChunkMixin {
@Final
public int zPosition;
@Shadow
public World worldObj;
@Shadow
private byte[] blockBiomeArray;
private short[] blockBiomeShortArray;
@@ -72,6 +75,10 @@ public abstract class ChunkMixin implements IChunkMixin {
public BiomeGenBase getBiomeGenForWorldCoords(int x, int z, WorldChunkManager manager) {
int id = this.blockBiomeShortArray[z << 4 | x] & ExtendedConstants.biomeIDMask;
if (id == ExtendedConstants.biomeIDNull) {
//Source: https://github.com/embeddedt/ArchaicFix/blob/3d1392f4db5a7221534a6f9b00c0c36a49d9be59/src/main/java/org/embeddedt/archaicfix/mixins/common/core/MixinChunk.java#L52
if (this.worldObj.isRemote) {
return BiomeGenBase.ocean;
}
BiomeGenBase gen = manager.getBiomeGenAt((this.xPosition << 4) + x, (this.zPosition << 4) + z);
id = gen.biomeID;
this.blockBiomeShortArray[z << 4 | x] = (short) (id & ExtendedConstants.biomeIDMask);
@@ -1,58 +1,25 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.ChunkProviderEnd;
import java.util.Random;
@Mixin(ChunkProviderEnd.class)
public abstract class ChunkProviderEndMixin {
@Shadow
private Random endRNG;
@Shadow
private BiomeGenBase[] biomesForGeneration;
@Shadow
private World endWorld;
@Shadow
public abstract void func_147420_a(int p_147420_1_, int p_147420_2_, Block[] p_147420_3_, BiomeGenBase[] p_147420_4_);
@Shadow(remap = false)
public abstract void replaceBiomeBlocks(int p_147421_1_, int p_147421_2_, Block[] p_147421_3_, BiomeGenBase[] p_147421_4_, byte[] meta);
/**
* @author FalsePattern
* @reason Direct port from decompiled code
*/
@Overwrite
public Chunk provideChunk(int x, int z) {
this.endRNG.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
Block[] blocks = new Block[32768];
byte[] metadatas = new byte[blocks.length];
this.biomesForGeneration = this.endWorld.getWorldChunkManager()
.loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16,
16);
this.func_147420_a(x, z, blocks, this.biomesForGeneration);
this.replaceBiomeBlocks(x, z, blocks, this.biomesForGeneration, metadatas);
Chunk chunk = new Chunk(this.endWorld, blocks, metadatas, x, z);
short[] biomes = ((IChunkMixin) chunk).getBiomeShortArray();
for (int i = 0; i < biomes.length; ++i) {
biomes[i] = (short) this.biomesForGeneration[i].biomeID;
}
chunk.generateSkylightMap();
return chunk;
@Redirect(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
require = 1)
private byte[] setBiomesTweaked(Chunk chunk) {
return BiomePatchHelper.getBiomeArrayTweaked(chunk, biomesForGeneration);
}
}
@@ -1,81 +1,43 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import org.spongepowered.asm.mixin.Final;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraft.world.gen.ChunkProviderFlat;
import net.minecraft.world.gen.MapGenBase;
import java.util.List;
@Mixin(ChunkProviderFlat.class)
public abstract class ChunkProviderFlatMixin implements IChunkProvider {
@Shadow
private World worldObj;
private BiomeGenBase[] bgb;
@Shadow
@Final
private Block[] cachedBlockIDs;
@Inject(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
shift = At.Shift.BEFORE),
locals = LocalCapture.CAPTURE_FAILHARD,
require = 1)
private void setBiomesTweaked1(int p_73154_1_, int p_73154_2_, CallbackInfoReturnable<Chunk> cir, Chunk chunk, BiomeGenBase[] abiomegenbase) {
bgb = abiomegenbase;
@Shadow
@Final
private byte[] cachedBlockMetadata;
}
@Shadow
@Final
private List structureGenerators;
/**
* @author FalsePattern
* @reason Direct port from dumped code
*/
@Overwrite
public Chunk provideChunk(int x, int z) {
Chunk chunk = new Chunk(this.worldObj, x, z);
for (int Y = 0; Y < this.cachedBlockIDs.length; ++Y) {
Block block = this.cachedBlockIDs[Y];
if (block != null) {
int ebsID = Y >> 4;
ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[ebsID];
if (ebs == null) {
ebs = new ExtendedBlockStorage(Y, !this.worldObj.provider.hasNoSky);
chunk.getBlockStorageArray()[ebsID] = ebs;
}
for (int X = 0; X < 16; ++X) {
for (int Z = 0; Z < 16; ++Z) {
ebs.func_150818_a(X, Y & 15, Z, block);
ebs.setExtBlockMetadata(X, Y & 15, Z, this.cachedBlockMetadata[Y]);
}
}
}
@Redirect(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
require = 1)
private byte[] setBiomesTweaked2(Chunk chunk) {
try {
return BiomePatchHelper.getBiomeArrayTweaked(chunk, bgb);
} finally {
bgb = null;
}
chunk.generateSkylightMap();
BiomeGenBase[] bgb = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(null, x * 16, z * 16, 16, 16);
short[] biomeArray = ((IChunkMixin) chunk).getBiomeShortArray();
for (int i = 0; i < biomeArray.length; ++i) {
biomeArray[i] = (short) bgb[i].biomeID;
}
for (Object o : this.structureGenerators) {
MapGenBase structureGenerator = (MapGenBase) o;
structureGenerator.func_151539_a(this, this.worldObj, x, z, null);
}
chunk.generateSkylightMap();
return chunk;
}
}
@@ -1,86 +1,26 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import org.spongepowered.asm.mixin.Final;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderGenerate;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.structure.MapGenMineshaft;
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
import net.minecraft.world.gen.structure.MapGenStronghold;
import net.minecraft.world.gen.structure.MapGenVillage;
import java.util.Random;
@Mixin(ChunkProviderGenerate.class)
public abstract class ChunkProviderGenerateMixin implements IChunkProvider {
@Shadow
private Random rand;
@Shadow
private BiomeGenBase[] biomesForGeneration;
@Shadow
private World worldObj;
@Shadow
private MapGenBase caveGenerator;
@Shadow
private MapGenBase ravineGenerator;
@Shadow
@Final
private boolean mapFeaturesEnabled;
@Shadow
private MapGenMineshaft mineshaftGenerator;
@Shadow
private MapGenVillage villageGenerator;
@Shadow
private MapGenStronghold strongholdGenerator;
@Shadow
private MapGenScatteredFeature scatteredFeatureGenerator;
@Shadow
public abstract void func_147424_a(int p_147424_1_, int p_147424_2_, Block[] p_147424_3_);
@Shadow
public abstract void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_);
/**
* @author FalsePattern
* @reason Direct port from dumped code
*/
@Overwrite
public Chunk provideChunk(int x, int z) {
this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
Block[] blocks = new Block[65536];
byte[] metadata = new byte[65536];
this.func_147424_a(x, z, blocks);
this.biomesForGeneration = this.worldObj.getWorldChunkManager()
.loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16,
16);
this.replaceBlocksForBiome(x, z, blocks, metadata, this.biomesForGeneration);
this.caveGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.ravineGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
if (this.mapFeaturesEnabled) {
this.mineshaftGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.villageGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.strongholdGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
}
Chunk chunk = new Chunk(this.worldObj, blocks, metadata, x, z);
short[] biomes = ((IChunkMixin) chunk).getBiomeShortArray();
for (int i = 0; i < biomes.length; ++i) {
biomes[i] = (short) this.biomesForGeneration[i].biomeID;
}
chunk.generateSkylightMap();
return chunk;
@Redirect(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
require = 1)
private byte[] setBiomesTweaked(Chunk chunk) {
return BiomePatchHelper.getBiomeArrayTweaked(chunk, biomesForGeneration);
}
}
@@ -1,61 +1,43 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderHell;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.structure.MapGenNetherBridge;
import java.util.Random;
@Mixin(ChunkProviderHell.class)
public abstract class ChunkProviderHellMixin implements IChunkProvider {
private BiomeGenBase[] bgb;
@Shadow
public MapGenNetherBridge genNetherBridge;
@Shadow
private Random hellRNG;
@Shadow
private World worldObj;
@Shadow
private MapGenBase netherCaveGenerator;
@Inject(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
shift = At.Shift.BEFORE),
locals = LocalCapture.CAPTURE_FAILHARD,
require = 1)
private void setBiomesTweaked1(int p_73154_1_, int p_73154_2_, CallbackInfoReturnable<Chunk> cir, Block[] ablock, byte[] meta, BiomeGenBase[] abiomegenbase, Chunk chunk) {
bgb = abiomegenbase;
@Shadow
public abstract void func_147419_a(int p_147419_1_, int p_147419_2_, Block[] p_147419_3_);
}
@Shadow(remap = false)
public abstract void replaceBiomeBlocks(int p_147418_1_, int p_147418_2_, Block[] p_147418_3_, byte[] meta, BiomeGenBase[] biomes);
/**
* @author FalsePattern
* @reason Direct port from dumped code
*/
@Overwrite
public Chunk provideChunk(int x, int z) {
this.hellRNG.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
Block[] blocks = new Block[32768];
byte[] metadata = new byte[blocks.length];
BiomeGenBase[] bgb = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(null, x * 16, z * 16, 16, 16);
this.func_147419_a(x, z, blocks);
this.replaceBiomeBlocks(x, z, blocks, metadata, bgb);
this.netherCaveGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.genNetherBridge.func_151539_a(this, this.worldObj, x, z, blocks);
Chunk chunk = new Chunk(this.worldObj, blocks, metadata, x, z);
short[] biomes = ((IChunkMixin) chunk).getBiomeShortArray();
for (int i = 0; i < biomes.length; ++i) {
biomes[i] = (short) bgb[i].biomeID;
@Redirect(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
require = 1)
private byte[] setBiomesTweaked2(Chunk chunk) {
try {
return BiomePatchHelper.getBiomeArrayTweaked(chunk, bgb);
} finally {
bgb = null;
}
chunk.resetRelightChecks();
return chunk;
}
}
@@ -34,8 +34,6 @@ public enum Mixin implements IMixin {
//region Minecraft->common->biome
BiomeDictionaryMixin(Side.COMMON, always(), "vanilla.biome.BiomeDictionaryMixin"),
BiomeGenBaseMixin(Side.COMMON, always(), "vanilla.biome.BiomeGenBaseMixin"),
BiomesGenBasePlaceholderMixin(Side.COMMON, avoid(TargetedMod.ANTIIDCONFLICT),
"vanilla.biome.BiomeGenBasePlaceholderMixin"),
//endregion Minecraft->common->biome
//region Minecraft->common->misc
BlockFireMixin(Side.COMMON, always(), "vanilla.misc.BlockFireMixin"),
@@ -61,9 +59,17 @@ public enum Mixin implements IMixin {
//endregion Minecraft->client
//endregion Minecraft
//region AntiIDConflict->common
AIDCBiomesGenBaseMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.BiomeGenBaseMixin"),
AIDCAntiIdConflictBaseMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT),
"antiidconflict.AntiIdConflictBaseMixin"),
AIDCBiomesGenBasePlaceholderMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT),
"antiidconflict.BiomeGenBasePlaceholderMixin"),
AIDCBiomesManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.BiomesManagerMixin"),
AIDCDimensionsManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT),
"antiidconflict.DimensionsManagerMixin"),
AIDCEnchantementsManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT),
"antiidconflict.EnchantementsManagerMixin"),
AIDCEntitiesManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.EntitiesManagerMixin"),
AIDCPotionsManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.PotionsManagerMixin"),
//endregion AntiIDConflict->common
//region ATG->common
ATGBiomeConfigMixin(Side.COMMON, require(TargetedMod.ATG), "atg.ATGBiomeConfigMixin"),
@@ -72,14 +78,17 @@ public enum Mixin implements IMixin {
ATGWorldGenRocksMixin(Side.COMMON, require(TargetedMod.ATG), "atg.ATGWorldGenRocksMixin"),
//endregion ATG->common
//region BoP->common
BoPBiomeManagerMixin(Side.COMMON, require(TargetedMod.BOP), "bop.BoPBiomeManagerMixin"),
BOPBiomeManagerMixin(Side.COMMON, require(TargetedMod.BOP), "bop.BOPBiomeManagerMixin"),
ChunkProviderBOPEndMixin(Side.COMMON, require(TargetedMod.BOP), "bop.ChunkProviderBOPEndMixin"),
ChunkProviderBOPHellMixin(Side.COMMON, require(TargetedMod.BOP), "bop.ChunkProviderBOPHellMixin"),
//endregion BoP->common
//region CoFHLib->common
CoFHLibCofhBlockHelperMixin(Side.COMMON, require(TargetedMod.COFHLIB), "cofhlib.BlockHelperMixin"),
//endregion CoFHLib->common
//region DragonAPI->common
//region DragonAPI->common->vanilla
DragonAPIGenLayerRiverMixMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.vanilla.GenLayerRiverMixMixin"),
DragonAPIGenLayerRiverMixMixin(Side.COMMON, require(TargetedMod.DRAGONAPI),
"dragonapi.vanilla.GenLayerRiverMixMixin"),
//endregion DragonAPI->common->vanilla
DragonAPIGenLayerRiverEventMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.GenLayerRiverEventMixin"),
DragonAPIBlockPropertiesMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.BlockPropertiesMixin"),
@@ -89,11 +98,30 @@ public enum Mixin implements IMixin {
GalactiCraftCoreConfigManagerCoreMixin(Side.COMMON, require(TargetedMod.GALACTICRAFTCORE),
"galacticraft.ConfigManagerCoreMixin"),
//endregion GalactiCraftCore->common
//region ICG->common
ICGMysteriumPatchesFixesCaveMixin(Side.COMMON, require(TargetedMod.ICG), "icg.MysteriumPatchesFixesCaveMixin"),
//endregion ICG->common
//region MFQM->common
MFQMMixin(Side.COMMON, require(TargetedMod.MFQM), "mfqm.MFQMMixin"),
MFQMDataWatcherMixin(Side.COMMON, require(TargetedMod.MFQM).and(condition(() -> IEConfig.extendDataWatcher)),
"mfqm.MFQMDataWatcherMixin"),
//endregion MFQM->common
//region NaturesCompass->common
NaturesCompassBiomeUtilsMixin(Side.COMMON, require(TargetedMod.NATURESCOMPASS), "naturescompass.BiomeUtilsMixin"),
//endregion NaturesCompass->common
//region RTG->common
RTGChunkProviderRTGMixin(Side.COMMON, require(TargetedMod.RTG), "rtg.ChunkProviderRTGMixin"),
RTGLandscapeGeneratorMixin(Side.COMMON, require(TargetedMod.RTG), "rtg.LandscapeGeneratorMixin"),
RTGRealisticBiomeBaseMixin(Side.COMMON, require(TargetedMod.RTG), "rtg.RealisticBiomeBaseMixin"),
//endregion RTG->common
//region Thaumcraft->common
ThaumcraftUtilsMixin(Side.COMMON, require(TargetedMod.THAUMCRAFT), "thaumcraft.UtilsMixin"),
//endregion Thaumcraft->common
//region TwilightForest->common
ChunkProviderTwilightForestMixin(Side.COMMON, require(TargetedMod.TWILIGHTFOREST),
"twilightforest.ChunkProviderTwilightForestMixin"),
TFBiomeBaseMixin(Side.COMMON, require(TargetedMod.TWILIGHTFOREST), "twilightforest.TFBiomeBaseMixin"),
//endregion TwilightForest->common
//region UBC->common
UBCOreUBifierMixin(Side.COMMON, require(TargetedMod.UBC), "ubc.OreUBifierMixin"),
UBCBiomeUndergroundDecoratorMixin(Side.COMMON, require(TargetedMod.UBC), "ubc.BiomeUndergroundDecoratorMixin"),
@@ -1,6 +1,5 @@
package com.falsepattern.endlessids.mixin.plugin;
import com.falsepattern.endlessids.mixin.util.DragonAPICompat;
import com.falsepattern.lib.mixin.ITargetedMod;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@@ -16,12 +15,14 @@ public enum TargetedMod implements ITargetedMod {
ATG("Alternate Terrain Generation", true, startsWith("atg")),
BOP("Biomes O' Plenty", true, startsWith("biomesoplenty-")),
COFHLIB("CoFH Lib", true, startsWith("cofhlib-")),
DRAGONAPI("DragonAPI", false, startsWith("dragonapi").and((x) -> {
DragonAPICompat.activate();
return true;
})),
DRAGONAPI("DragonAPI", false, startsWith("dragonapi")),
GALACTICRAFTCORE("GalactiCraftCore", false, startsWith("galacticraftcore")),
ICG("Immersive Cavegen", true, startsWith("immersivecavegen")),
MFQM("More Fun Quicksand Mod", false, startsWith("morefunquicksandmod-")),
NATURESCOMPASS("Nature's Compass", true, startsWith("naturescompass")),
RTG("Realistic Terrain Generation", true, startsWith("rtg-")),
THAUMCRAFT("Thaumcraft", true, startsWith("thaumcraft")),
TWILIGHTFOREST("Twilight Forest", true, startsWith("twilightforest")),
UBC("Underground Biomes Constructs", false, startsWith("undergroundbiomesconstructs-")),
WORLDEDIT("WorldEdit", false, startsWith("worldedit-")),
;
@@ -1,74 +0,0 @@
package com.falsepattern.endlessids.mixin.util;
import com.falsepattern.endlessids.mixin.plugin.MixinPlugin;
import lombok.SneakyThrows;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.Loader;
import java.lang.reflect.Field;
import java.util.Collections;
public class DragonAPICompat {
private static boolean activated = false;
public static void activate() {
if (activated) return;
activated = true;
Logger LOG = LogManager.getLogger(MixinPlugin.LOG.getName() + " DragonAPI Compat Patcher");
LOG.info("DragonAPI detected. Activating very early compatibility patches.");
int total = 1;
int complete = 0;
try {
patchFML(LOG);
complete++;
} catch (Throwable t) {
LOG.fatal("Failed to load early DragonAPI compat patches! Crash imminent! Successful: " + complete + ", Total: " + total, t);
}
LOG.info("DragonAPI early compat patching finished! Resuming normal loading.");
}
@SneakyThrows
private static void patchFML(Logger baseLog) {
Logger LOG = LogManager.getLogger(baseLog.getName() + " FML Tweaker");
LOG.info("Patching FML loader class...");
try {
LOG.info("Attempting to get a reference to " + Loader.class.getName() +
".namedMods with reflection...");
Field f;
try {
f = Loader.class.getDeclaredField("namedMods");
LOG.info("[OK] Reference retrieved!");
} catch (Throwable t) {
LOG.error("[FAIL] Failed to retrieve the field!");
throw t;
}
LOG.info("[INFO] Making the reference accessible...");
try {
f.setAccessible(true);
LOG.info("[OK] Reference is now accessible!");
} catch (Throwable t) {
LOG.error("[FAIL] Failed to make the reference accessible!");
throw t;
}
LOG.info("[INFO] Inserting placeholder Collections.emptyMap() object into the field...");
try {
if (f.get(Loader.instance()) != null) {
LOG.info("[OK] Field already had a value, not replacing.");
} else {
f.set(Loader.instance(), Collections.emptyMap());
LOG.info("[OK] Successfully inserted placeholder object!");
}
} catch (Throwable t) {
LOG.error("[FAIL] Failed to insert placeholder object!");
throw t;
}
LOG.info("FML Loader class patched successfully!");
} catch (Throwable t) {
LOG.error("Failed to patch FML Loader class! Check the log file for debug info!");
throw t;
}
}
}