Various Updates #144

Merged
SenseiKiwi merged 28 commits from master into master 2014-03-24 18:45:47 +00:00
Showing only changes of commit ac8874f96a - Show all commits

View File

@@ -37,6 +37,8 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
@Override
public void notifyTick() {
World limboWorld = null;
// Check if any new spawning requests have come in
if (!locations.isEmpty())
{
@@ -50,11 +52,21 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
if (location.DimensionID == properties.LimboDimensionID)
{
// Limbo chunk
placeMonolithsInLimbo(location.DimensionID, location.ChunkX, location.ChunkZ);
World world = DimensionManager.getWorld(location.DimensionID);
// SenseiKiwi: Check if we haven't loaded Limbo for another request in this request
// cycle. If so, try to load Limbo up. This solves a strange issue with ChickenChunks
// where CC somehow forces chunks to generate in Limbo if LimboProvider.canRespawnHere()
// is true, yet when execution reaches this point, Limbo isn't loaded anymore! My theory
// is that CC force-loads a chunk for some reason, but since there are no players around,
// Limbo immediately unloads after standard world gen runs, and before this code can run.
mod_pocketDim.instance.gatewayGenerator.generate(world.rand, location.ChunkX, location.ChunkZ,world, world.getChunkProvider(), world.getChunkProvider());
if (limboWorld == null)
{
limboWorld = PocketManager.loadDimension(properties.LimboDimensionID);
}
placeMonolithsInLimbo(limboWorld, location.ChunkX, location.ChunkZ);
mod_pocketDim.instance.gatewayGenerator.generate(limboWorld.rand, location.ChunkX, location.ChunkZ,
limboWorld, limboWorld.getChunkProvider(), limboWorld.getChunkProvider());
}
else
{
@@ -145,15 +157,8 @@ public class CustomLimboPopulator implements IRegularTickReceiver {
while (sanity < 5 && !didSpawn);
}
private void placeMonolithsInLimbo(int dimensionID, int chunkX, int chunkZ)
private void placeMonolithsInLimbo(World limbo, int chunkX, int chunkZ)
{
World limbo = DimensionManager.getWorld(dimensionID);
if (limbo == null)
{
return;
}
//The following initialization code is based on code from ChunkProviderGenerate.
//It makes our generation depend on the world seed.
Random random = new Random(limbo.getSeed() ^ 0xB5130C4ACC71A822L);