2015-03-22 17:38:04 +00:00
|
|
|
--- ../src-base/minecraft/cpw/mods/fml/common/registry/GameRegistry.java
|
|
|
|
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/GameRegistry.java
|
2015-04-14 10:49:32 +00:00
|
|
|
@@ -24,6 +24,7 @@
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Random;
|
|
|
|
import java.util.Set;
|
2015-03-22 17:38:04 +00:00
|
|
|
+import java.util.HashMap; // Cauldron
|
|
|
|
|
2015-04-14 10:49:32 +00:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.item.Item;
|
2015-06-01 09:13:46 +00:00
|
|
|
@@ -67,6 +68,11 @@
|
2015-03-22 17:38:04 +00:00
|
|
|
private static List<IFuelHandler> fuelHandlers = Lists.newArrayList();
|
|
|
|
private static List<IWorldGenerator> sortedGeneratorList;
|
2015-04-14 10:49:32 +00:00
|
|
|
|
2015-03-22 17:38:04 +00:00
|
|
|
+ // Cauldron start
|
|
|
|
+ private static Map<String, Boolean> configWorldGenCache = new HashMap<String, Boolean>();
|
|
|
|
+ private static Map<String, String> worldGenMap = new HashMap<String, String>();
|
|
|
|
+ // Cauldron end
|
2015-04-14 10:49:32 +00:00
|
|
|
+
|
2015-03-22 17:38:04 +00:00
|
|
|
/**
|
|
|
|
* Register a world generator - something that inserts new block types into the world
|
2015-04-14 10:49:32 +00:00
|
|
|
*
|
2015-06-01 09:13:46 +00:00
|
|
|
@@ -76,12 +82,18 @@
|
2015-03-22 17:38:04 +00:00
|
|
|
*/
|
|
|
|
public static void registerWorldGenerator(IWorldGenerator generator, int modGenerationWeight)
|
|
|
|
{
|
|
|
|
+ // Cauldron start - mod id's are not available during generateWorld so we must capture them here
|
|
|
|
+ String modId = Loader.instance().activeModContainer().getModId();
|
|
|
|
+ modId = modId.replaceAll("[^A-Za-z0-9]", ""); // remove all non-digits/alphanumeric
|
2015-04-24 12:40:52 +00:00
|
|
|
+ modId = modId.replace(" ", "_");
|
2015-03-22 17:38:04 +00:00
|
|
|
worldGenerators.add(generator);
|
|
|
|
worldGeneratorIndex.put(generator, modGenerationWeight);
|
|
|
|
if (sortedGeneratorList != null)
|
|
|
|
{
|
|
|
|
sortedGeneratorList = null;
|
|
|
|
}
|
|
|
|
+ worldGenMap.put(generator.getClass().getName(), modId);
|
|
|
|
+ // Cauldron end
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-06-01 09:13:46 +00:00
|
|
|
@@ -106,11 +118,27 @@
|
2015-03-22 17:38:04 +00:00
|
|
|
long zSeed = fmlRandom.nextLong() >> 2 + 1L;
|
|
|
|
long chunkSeed = (xSeed * chunkX + zSeed * chunkZ) ^ worldSeed;
|
|
|
|
|
|
|
|
- for (IWorldGenerator generator : sortedGeneratorList)
|
|
|
|
+ boolean before = ((net.minecraft.world.WorldServer) world).theChunkProviderServer.loadChunkOnProvideRequest; // Cauldron store value
|
|
|
|
+ ((net.minecraft.world.WorldServer) world).theChunkProviderServer.loadChunkOnProvideRequest = true; // Cauldron load chunks on provide requests
|
|
|
|
+ for (IWorldGenerator generator : worldGenerators)
|
|
|
|
{
|
|
|
|
- fmlRandom.setSeed(chunkSeed);
|
|
|
|
- generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
|
|
|
|
+ // Cauldron start
|
|
|
|
+ if (!configWorldGenCache.containsKey(generator.getClass().getName()))
|
|
|
|
+ {
|
|
|
|
+ String modId = worldGenMap.get(generator.getClass().getName());
|
|
|
|
+ String generatorName = "";
|
|
|
|
+ generatorName = modId + "-" + generator.getClass().getSimpleName();
|
|
|
|
+ boolean generatorEnabled = world.cauldronConfig.getBoolean("worldgen-" + generatorName, true);
|
|
|
|
+ configWorldGenCache.put(generator.getClass().getName(), generatorEnabled);
|
|
|
|
+ }
|
|
|
|
+ if (configWorldGenCache.get(generator.getClass().getName()))
|
|
|
|
+ {
|
|
|
|
+ fmlRandom.setSeed(chunkSeed);
|
|
|
|
+ generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
+ ((net.minecraft.world.WorldServer)world).theChunkProviderServer.loadChunkOnProvideRequest = before; // reset
|
|
|
|
+ // Cauldron end
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void computeSortedGeneratorList()
|