Overhauled Tick Sending by CommonTickHandler

Overhauled the way in which CommonTickHandler triggers tick-based
actions such as Limbo decay, spawning Monoliths, and regenerating rifts.
Now CommonTickHandler implements an interface called IRegularTickSender,
which indicates that it will periodically call on classes that implement
IRegulatTickReceiver to perform some task. I added classes for each
regularly scheduled task we were performing: MonolithSpawner and
RiftRegenerator, plus converted LimboDecay to a normal class instead of
a static class.  Modified several classes so that they have access to
the MonolithSpawner instance to request MonolithSpawning when needed.
This improves the structure of our code and gets us away from the way we
did things before, which was accessing a public static list inside
CommonTickHandler from other classes and adding arrays to specify chunk
coordinates. We should not be exposing the internal state of classes
like that! And we should be using clearly defined objects to pass
information.
This commit is contained in:
SenseiKiwi
2013-07-26 05:15:44 -04:00
parent bfc532da1f
commit 687a75f4d5
15 changed files with 461 additions and 366 deletions

View File

@@ -12,6 +12,7 @@ import net.minecraftforge.client.IRenderHandler;
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -23,14 +24,15 @@ public class LimboProvider extends WorldProvider
}
private IRenderHandler skyRenderer;
private DDProperties properties = null;
private DDProperties properties;
private MonolithSpawner spawner;
public LimboProvider()
{
this.hasNoSky = false;
this.skyRenderer = new limboSkyProvider();
if (properties == null)
properties = DDProperties.instance();
this.spawner = mod_pocketDim.spawner;
this.properties = mod_pocketDim.properties;
}
@SideOnly(Side.CLIENT)
@@ -39,12 +41,10 @@ public class LimboProvider extends WorldProvider
return this.skyRenderer;
}
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
//this.dimensionId = ConfigAtum.dimensionID;
}
@Override
@@ -154,7 +154,8 @@ public class LimboProvider extends WorldProvider
@Override
public IChunkProvider createChunkGenerator()
{
return new LimboGenerator(worldObj, 45);
//TODO: ...We're passing the LimboGenerator a fixed seed. We should be passing the world seed! @_@ ~SenseiKiwi
return new LimboGenerator(worldObj, 45, spawner, properties);
}
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)