Add a tick counter that updates on every World pulse

This commit is contained in:
Gary Tierney
2017-12-31 07:09:23 +00:00
parent 5bd663f505
commit f18305a3c4
@@ -66,6 +66,11 @@ public final class World {
}
/**
* A counter for the number of ticks ran.
*/
private long tickCounter = 0;
/**
* The logger for this class.
*/
@@ -208,6 +213,15 @@ public final class World {
return releaseNumber;
}
/**
* Get the current value of the {@link #tickCounter} (the number of ticks since the game started).
*
* @return The current value of the tick counter;
*/
public long tick() {
return tickCounter;
}
/**
* Initialises the world by loading definitions from the specified file
* system.
@@ -277,6 +291,7 @@ public final class World {
unregisterNpcs();
registerNpcs();
scheduler.pulse();
tickCounter++;
}
/**