mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-12 04:57:31 +00:00
IR3 compat (#104)
This commit is contained in:
5 files changed
+94
No files matched your search
@@ -0,0 +1,86 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.ir3;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import jp.plusplus.ir2.IR2;
|
||||
import jp.plusplus.ir2.blocks.BlockCore;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.event.terraingen.OreGenEvent;
|
||||
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mixin(value = IR2.class,
|
||||
priority = 999,
|
||||
remap = false)
|
||||
public abstract class IR2Mixin {
|
||||
@Shadow public static boolean oresAreGenerated;
|
||||
|
||||
@Shadow public static boolean generateTinOre;
|
||||
|
||||
@Shadow public static boolean generateCopperOre;
|
||||
|
||||
@Shadow public static boolean generateSilverOre;
|
||||
|
||||
@Shadow public static boolean generateManganeseCrust;
|
||||
|
||||
@Shadow public static boolean generateCobaltCrust;
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Compat
|
||||
*/
|
||||
@SubscribeEvent
|
||||
@Overwrite
|
||||
public void generateOrePre(OreGenEvent.Pre event) {
|
||||
if (oresAreGenerated) {
|
||||
WorldGenerator genTin = new WorldGenMinable(BlockCore.ore, 0, 8, Blocks.stone);
|
||||
WorldGenerator genCopper = new WorldGenMinable(BlockCore.ore, 1, 8, Blocks.stone);
|
||||
WorldGenerator genSilver = new WorldGenMinable(BlockCore.ore, 2, 8, Blocks.stone);
|
||||
WorldGenerator genManganese = new WorldGenMinable(BlockCore.crust, 0, 16, Blocks.gravel);
|
||||
WorldGenerator genCobalt = new WorldGenMinable(BlockCore.crust, 1, 16, Blocks.gravel);
|
||||
if (generateTinOre && TerrainGen.generateOre(event.world, event.rand, genTin, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||
for(int i = 0; i < 14; ++i) {
|
||||
genTin.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 30 + event.rand.nextInt(20), event.worldZ + event.rand.nextInt(16));
|
||||
}
|
||||
}
|
||||
|
||||
if (generateCopperOre && TerrainGen.generateOre(event.world, event.rand, genCopper, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||
for(int i = 0; i < 10; ++i) {
|
||||
genCopper.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 20 + event.rand.nextInt(20), event.worldZ + event.rand.nextInt(16));
|
||||
}
|
||||
}
|
||||
|
||||
if (generateSilverOre && TerrainGen.generateOre(event.world, event.rand, genSilver, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||
for(int i = 0; i < 4; ++i) {
|
||||
genSilver.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 1 + event.rand.nextInt(29), event.worldZ + event.rand.nextInt(16));
|
||||
}
|
||||
}
|
||||
|
||||
short[] bIds = ((IChunkMixin)event.world.getChunkFromBlockCoords(event.worldX, event.worldZ)).getBiomeShortArray();
|
||||
|
||||
for(int k = 0; k < bIds.length; ++k) {
|
||||
if (bIds[k] == BiomeGenBase.ocean.biomeID || bIds[k] == BiomeGenBase.deepOcean.biomeID) {
|
||||
if (generateManganeseCrust && TerrainGen.generateOre(event.world, event.rand, genSilver, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||
for(int i = 0; i < 7; ++i) {
|
||||
genManganese.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 16 + event.rand.nextInt(48), event.worldZ + event.rand.nextInt(16));
|
||||
}
|
||||
}
|
||||
|
||||
if (generateCobaltCrust && TerrainGen.generateOre(event.world, event.rand, genSilver, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||
for(int i = 0; i < 7; ++i) {
|
||||
genCobalt.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 16 + event.rand.nextInt(48), event.worldZ + event.rand.nextInt(16));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,9 @@ public enum Mixin implements IMixin {
|
||||
//region ICG
|
||||
ICGMysteriumPatchesFixesCaveMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.ICG)), "biome.icg.MysteriumPatchesFixesCaveMixin"),
|
||||
//endregion ICG
|
||||
//region Industrial Revolution by Redstone Rebooted
|
||||
IR3IR2Mixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.IR3)), "biome.ir3.IR2Mixin"),
|
||||
//endregion Industrial Revolution by Redstone Rebooted
|
||||
//region LOTR
|
||||
LOTRBiomeVariantStorageMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.LOTR)), "biome.lotr.LOTRBiomeVariantStorageMixin"),
|
||||
LOTRChunkProviderMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.LOTR)), "biome.lotr.LOTRChunkProviderMixin"),
|
||||
|
||||
@@ -35,6 +35,7 @@ public enum TargetedMod implements ITargetedMod {
|
||||
GALAXYSPACE("GalaxySpace", false, startsWith("galaxyspace-")),
|
||||
HIGHLANDS("Highlands", false, startsWith("highlands")),
|
||||
ICG("Immersive Cavegen", false, startsWith("immersivecavegen")),
|
||||
IR3("Industrial Revolution by Redstone Rebooted", false, startsWith("industrialrevolutionbyredstonerebooted-")),
|
||||
LOTR("LOTR Mod", false, startsWith("lotrmod")),
|
||||
MFQM("More Fun Quicksand Mod", false, startsWith("morefunquicksandmod-")),
|
||||
NATURESCOMPASS("Nature's Compass", false, startsWith("naturescompass")),
|
||||
|
||||
Reference in new issue
Block a user