687a75f4d5
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.
16 lines
422 B
Java
16 lines
422 B
Java
package StevenDimDoors.mod_pocketDim.ticking;
|
|
|
|
public class RegularTickReceiverInfo {
|
|
|
|
public IRegularTickReceiver RegularTickReceiver;
|
|
public int Interval;
|
|
public boolean OnTickStart;
|
|
|
|
public RegularTickReceiverInfo(IRegularTickReceiver regularTickReceiver, int interval, boolean onTickStart)
|
|
{
|
|
this.RegularTickReceiver = regularTickReceiver;
|
|
this.Interval = interval;
|
|
this.OnTickStart = onTickStart;
|
|
}
|
|
|
|
}
|