mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-19 16:29:42 +00:00
Erebus compat (fixes #13)
This commit is contained in:
6 files changed
+120
No files matched your search
+28
@@ -0,0 +1,28 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.erebus;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||
import erebus.world.ChunkProviderErebus;
|
||||
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 = ChunkProviderErebus.class,
|
||||
remap = false)
|
||||
public abstract class ChunkProviderErebusMixin {
|
||||
@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);
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.erebus;
|
||||
|
||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import erebus.ModBiomes;
|
||||
import lombok.val;
|
||||
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.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
@Mixin(value = ModBiomes.class,
|
||||
remap = false)
|
||||
public abstract class ModBiomesMixin {
|
||||
@Shadow
|
||||
public static int undergroundJungleID;
|
||||
@Shadow
|
||||
public static int volcanicDesertID;
|
||||
@Shadow
|
||||
public static int subterraneanSavannahID;
|
||||
@Shadow
|
||||
public static int elysianFieldsID;
|
||||
@Shadow
|
||||
public static int ulteriorOutbackID;
|
||||
@Shadow
|
||||
public static int fungalForestID;
|
||||
@Shadow
|
||||
public static int submergedSwampID;
|
||||
@Shadow
|
||||
public static int fieldsSubForestID;
|
||||
@Shadow
|
||||
public static int jungleSubLakeID;
|
||||
@Shadow
|
||||
public static int jungleSubAsperGroveID;
|
||||
@Shadow
|
||||
public static int desertSubCharredForestID;
|
||||
@Shadow
|
||||
public static int savannahSubRockyWastelandID;
|
||||
@Shadow
|
||||
public static int savannahSubAsperGroveID;
|
||||
@Shadow
|
||||
public static int savannahSubSteppeID;
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(intValue = 128),
|
||||
require = 1)
|
||||
private static int extendIDs(int constant) {
|
||||
return ExtendedConstants.biomeIDCount - 129;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "init",
|
||||
constant = @Constant(stringValue = "Erebus biome IDs cannot be higher than 127 or smaller than 0!"),
|
||||
require = 1)
|
||||
private static String modifyWarning(String str) {
|
||||
return "Erebus biome IDs cannot be higher than " + (ExtendedConstants.biomeIDCount - 129) + " or smaller than 0!";
|
||||
}
|
||||
|
||||
@Inject(method = "init",
|
||||
at = @At("HEAD"),
|
||||
require = 1)
|
||||
private static void cleanupBiomeArrayForAssignment(CallbackInfo ci) {
|
||||
val bga = BiomeGenBase.getBiomeGenArray();
|
||||
|
||||
int[] biomes = new int[]{undergroundJungleID, volcanicDesertID, subterraneanSavannahID, elysianFieldsID,
|
||||
ulteriorOutbackID, fungalForestID, submergedSwampID, fieldsSubForestID,
|
||||
jungleSubLakeID, jungleSubAsperGroveID, desertSubCharredForestID,
|
||||
savannahSubRockyWastelandID, savannahSubAsperGroveID, savannahSubSteppeID};
|
||||
for (val biome: biomes) {
|
||||
if (biome <= 0 || biome >= ExtendedConstants.biomeIDCount - 129) {
|
||||
continue;
|
||||
}
|
||||
if (bga[biome] instanceof PlaceholderBiome) {
|
||||
bga[biome] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,10 @@ public enum Mixin implements IMixin {
|
||||
DragonAPIBlockPropertiesMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.BlockPropertiesMixin"),
|
||||
DragonAPIIDTypeMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.IDTypeMixin"),
|
||||
//endregion DragonAPI->common
|
||||
//region Erebus->common
|
||||
ChunkProviderErebusMixin(Side.COMMON, require(TargetedMod.EREBUS), "erebus.ChunkProviderErebusMixin"),
|
||||
ErebusModBiomesMixin(Side.COMMON, require(TargetedMod.EREBUS), "erebus.ModBiomesMixin"),
|
||||
//endregion Erebus->common
|
||||
//region ExtraUtilities->common
|
||||
ChunkProviderEndOfTimeMixin(Side.COMMON, require(TargetedMod.EXTRAUTILITIES), "extrautilities.ChunkProviderEndOfTimeMixin"),
|
||||
ChunkProviderUnderdarkMixin(Side.COMMON, require(TargetedMod.EXTRAUTILITIES), "extrautilities.ChunkProviderUnderdarkMixin"),
|
||||
|
||||
@@ -19,6 +19,7 @@ public enum TargetedMod implements ITargetedMod {
|
||||
BIOMEWAND("Biome Wand", true, startsWith("1.7.10-biome-wand-").or(startsWith("biome-wand"))),
|
||||
COFHLIB("CoFH Lib", true, startsWith("cofhlib-")),
|
||||
DRAGONAPI("DragonAPI", false, startsWith("dragonapi")),
|
||||
EREBUS("The Erebus", true, startsWith("theerebus")),
|
||||
EXTRAUTILITIES("Extra Utilities", true, startsWith("extrautilities-")),
|
||||
GALACTICRAFTCORE("GalactiCraftCore", false, startsWith("galacticraftcore")),
|
||||
ICG("Immersive Cavegen", true, startsWith("immersivecavegen")),
|
||||
|
||||
Reference in new issue
Block a user