Removed old default world hackery in favour of the new Forge 1110 biome system. In turn, the mod now requires 1110+

This commit is contained in:
Adubbz 2014-06-04 17:32:30 +10:00
parent 61df48b3db
commit e8d90642ed
10 changed files with 20 additions and 166 deletions

View File

@ -1,5 +1,3 @@
minecraft_version=1.7.2
forge_version=10.12.1.1074
forge_version=10.12.1.1110
mod_version=2.0.0
worldcore_version=1.1.0.17
fmp_version=1.0.0.182

View File

@ -5,6 +5,7 @@ import java.util.List;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import biomesoplenty.common.configuration.BOPConfigurationBiomeGen;
import biomesoplenty.common.configuration.BOPConfigurationBiomeWeights;
import biomesoplenty.common.configuration.BOPConfigurationIDs;
@ -95,15 +96,4 @@ public class BOPBiomeManager
public static final int COOL = 2;
public static final int ICY = 3;
}
public static class BiomeEntry extends WeightedRandom.Item
{
public BiomeGenBase biome;
public BiomeEntry(BiomeGenBase biome, int weight)
{
super(weight);
this.biome = biome;
}
}
}

View File

@ -6,12 +6,12 @@ import java.util.List;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.Level;
import biomesoplenty.api.BOPBiomeManager;
import biomesoplenty.api.BOPBiomeManager.BiomeEntry;
import biomesoplenty.api.content.BOPCBiomes;
import cpw.mods.fml.common.FMLLog;

View File

@ -6,12 +6,12 @@ import java.util.List;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.Level;
import biomesoplenty.api.BOPBiomeManager;
import biomesoplenty.api.BOPBiomeManager.BiomeEntry;
import biomesoplenty.api.content.BOPCBiomes;
import cpw.mods.fml.common.FMLLog;

View File

@ -10,11 +10,11 @@ import net.minecraft.world.biome.WorldChunkManager;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import org.apache.logging.log4j.Level;
import biomesoplenty.api.BOPBiomeManager;
import biomesoplenty.api.BOPBiomeManager.BiomeEntry;
import biomesoplenty.api.BOPBiomeManager.TemperatureType;
import biomesoplenty.api.content.BOPCBiomes;
import biomesoplenty.common.biomes.nether.BiomeGenBoneyard;

View File

@ -14,7 +14,6 @@ import biomesoplenty.common.eventhandler.potions.PotionParalysisEventHandler;
import biomesoplenty.common.eventhandler.potions.PotionPossessionEventHandler;
import biomesoplenty.common.eventhandler.world.BiomeSizeEventHandler;
import biomesoplenty.common.eventhandler.world.DecorationModificationEventHandler;
import biomesoplenty.common.eventhandler.world.DefaultWorldEventHandler;
import biomesoplenty.common.eventhandler.world.MapGenEventHandler;
import biomesoplenty.common.eventhandler.world.VillageMaterialEventHandler;
import cpw.mods.fml.common.FMLCommonHandler;
@ -38,7 +37,6 @@ public class BOPEventHandlers
private static void registerWorldEventHandlers()
{
MinecraftForge.TERRAIN_GEN_BUS.register(new DefaultWorldEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new DecorationModificationEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeSizeEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterialEventHandler());

View File

@ -1,142 +0,0 @@
package biomesoplenty.common.eventhandler.world;
import org.apache.logging.log4j.Level;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerBiome;
import net.minecraft.world.gen.layer.GenLayerRiverMix;
import net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens;
import biomesoplenty.api.BOPBiomeManager.BiomeEntry;
import biomesoplenty.common.configuration.BOPConfigurationBiomeGen;
import biomesoplenty.common.configuration.BOPConfigurationIDs;
import biomesoplenty.common.configuration.BOPConfigurationMain;
import biomesoplenty.common.core.BOPBiomes;
import biomesoplenty.common.utils.BOPLogger;
import biomesoplenty.common.world.layer.GenLayerBiomeBOP;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class DefaultWorldEventHandler
{
@SubscribeEvent(priority=EventPriority.LOWEST)
public void onInitBiomeGens(InitBiomeGens event)
{
if (event.worldType == BOPBiomes.worldTypeBOP)
{
GenLayer[] originalBiomeGens = event.originalBiomeGens;
GenLayer parent = originalBiomeGens[0];
GenLayerBiomeBOP genLayerBiome = null;
if (parent instanceof GenLayerRiverMix)
{
GenLayerRiverMix genLayerRiverMix = (GenLayerRiverMix)parent;
GenLayer biomePatternGeneratorChain = ObfuscationReflectionHelper.getPrivateValue(GenLayerRiverMix.class, genLayerRiverMix, "biomePatternGeneratorChain", "field_75910_b");
if (biomePatternGeneratorChain != null) parent = biomePatternGeneratorChain;
}
while (genLayerBiome == null)
{
if (parent instanceof GenLayerBiomeBOP)
{
genLayerBiome = (GenLayerBiomeBOP)parent;
}
GenLayer newParent = ObfuscationReflectionHelper.getPrivateValue(GenLayer.class, parent, "parent", "field_75909_a");
if (newParent == null)
{
throw new RuntimeException("Failed to find GenLayerBiome in chain");
}
else
{
parent = newParent;
}
}
if (genLayerBiome != null)
{
try
{
BOPConfigurationBiomeGen.config.load();
BiomeGenBase[] vanillaDesertBiomes = (BiomeGenBase[])ObfuscationReflectionHelper.getPrivateValue(GenLayerBiome.class, genLayerBiome, "field_151623_c");
BiomeGenBase[] vanillaWarmBiomes = (BiomeGenBase[])ObfuscationReflectionHelper.getPrivateValue(GenLayerBiome.class, genLayerBiome, "field_151621_d");
BiomeGenBase[] vanillaCoolBiomes = (BiomeGenBase[])ObfuscationReflectionHelper.getPrivateValue(GenLayerBiome.class, genLayerBiome, "field_151622_e");
BiomeGenBase[] vanillaIcyBiomes = (BiomeGenBase[])ObfuscationReflectionHelper.getPrivateValue(GenLayerBiome.class, genLayerBiome, "field_151620_f");
for (BiomeGenBase biome : vanillaDesertBiomes)
{
if (biome != null)
{
if (BOPConfigurationMain.debugMode) BOPLogger.info("Adding biome " + biome.biomeName + " from the default world.");
BiomeEntry entry = new BiomeEntry(biome, 10);
if (BOPConfigurationBiomeGen.config.get("Default World" + " Biomes To Generate", biome.biomeName, true).getBoolean(false))
{
genLayerBiome.biomeLists[0].add(entry);
}
}
}
for (BiomeGenBase biome : vanillaWarmBiomes)
{
if (biome != null)
{
if (BOPConfigurationMain.debugMode) BOPLogger.info("Adding biome " + biome.biomeName + " from the default world.");
BiomeEntry entry = new BiomeEntry(biome, 10);
if (BOPConfigurationBiomeGen.config.get("Default World" + " Biomes To Generate", biome.biomeName, true).getBoolean(false))
{
genLayerBiome.biomeLists[1].add(entry);
}
}
}
for (BiomeGenBase biome : vanillaCoolBiomes)
{
if (biome != null)
{
if (BOPConfigurationMain.debugMode) BOPLogger.info("Adding biome " + biome.biomeName + " from the default world.");
BiomeEntry entry = new BiomeEntry(biome, 10);
if (BOPConfigurationBiomeGen.config.get("Default World" + " Biomes To Generate", biome.biomeName, true).getBoolean(false))
{
genLayerBiome.biomeLists[2].add(entry);
}
}
}
for (BiomeGenBase biome : vanillaIcyBiomes)
{
if (biome != null)
{
if (BOPConfigurationMain.debugMode) BOPLogger.info("Adding biome " + biome.biomeName + " from the default world.");
BiomeEntry entry = new BiomeEntry(biome, 10);
if (BOPConfigurationBiomeGen.config.get("Default World" + " Biomes To Generate", biome.biomeName, true).getBoolean(false))
{
genLayerBiome.biomeLists[3].add(entry);
}
}
}
}
catch (Exception e)
{
BOPLogger.log(Level.ERROR, "Biomes O Plenty has had a problem loading its configuration", e);
}
finally
{
if (BOPConfigurationBiomeGen.config.hasChanged()) BOPConfigurationBiomeGen.config.save();
}
}
}
}
}

View File

@ -10,8 +10,9 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerBiome;
import net.minecraft.world.gen.layer.IntCache;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import biomesoplenty.api.BOPBiomeManager;
import biomesoplenty.api.BOPBiomeManager.BiomeEntry;
import biomesoplenty.common.configuration.BOPConfigurationBiomeGen;
import biomesoplenty.common.core.BOPBiomes;
@ -28,6 +29,15 @@ public class GenLayerBiomeBOP extends GenLayerBiome
this.biomeLists[1].addAll(BOPBiomeManager.overworldBiomes[1]);
this.biomeLists[2].addAll(BOPBiomeManager.overworldBiomes[2]);
this.biomeLists[3].addAll(BOPBiomeManager.overworldBiomes[3]);
this.biomeLists[0].addAll(BiomeManager.desertBiomes);
this.biomeLists[1].addAll(BiomeManager.warmBiomes);
this.biomeLists[2].addAll(BiomeManager.coolBiomes);
this.biomeLists[3].addAll(BiomeManager.icyBiomes);
this.biomeLists[0].add(new BiomeEntry(BiomeGenBase.desert, 30));
this.biomeLists[0].add(new BiomeEntry(BiomeGenBase.savanna, 20));
this.biomeLists[0].add(new BiomeEntry(BiomeGenBase.plains, 10));
}
@ -157,7 +167,7 @@ public class GenLayerBiomeBOP extends GenLayerBiome
private int getWeightedBiomeFromList(List<BiomeEntry> biomeList)
{
return ((BiomeEntry)WeightedRandom.getItem(biomeList, this.nextInt(WeightedRandom.getTotalWeight(biomeList)))).biome.biomeID;
return ((BiomeEntry)WeightedRandom.getItem(biomeList, (int)this.nextLong(WeightedRandom.getTotalWeight(biomeList) / 10) * 10)).biome.biomeID;
}
private boolean isBiomeOceanicAndEnabled(int biomeId)

View File

@ -5,11 +5,11 @@ import java.util.List;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import org.apache.commons.lang3.tuple.Pair;
import biomesoplenty.api.BOPBiomeManager;
import biomesoplenty.api.BOPBiomeManager.BiomeEntry;
import biomesoplenty.common.biomes.BOPSubBiome;
import biomesoplenty.common.world.noise.SimplexNoise;

View File

@ -6,8 +6,8 @@ import java.util.List;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.IntCache;
import net.minecraftforge.common.BiomeManager.BiomeEntry;
import biomesoplenty.api.BOPBiomeManager;
import biomesoplenty.api.BOPBiomeManager.BiomeEntry;
public class BiomeLayerHellBiomes extends BiomeLayerHell
{
@ -43,6 +43,6 @@ public class BiomeLayerHellBiomes extends BiomeLayerHell
private int getWeightedBiomeFromList(List<BiomeEntry> biomeList)
{
return ((BiomeEntry)WeightedRandom.getItem(biomeList, this.nextInt(WeightedRandom.getTotalWeight(biomeList)))).biome.biomeID;
return ((BiomeEntry)WeightedRandom.getItem(biomeList, (int)this.nextLong(WeightedRandom.getTotalWeight(biomeList) / 10) * 10)).biome.biomeID;
}
}