@@ -31,8 +31,8 @@ public class TimeLoop implements ModInitializer {
3131
3232 // These fields will be initialized from the configuration file.
3333 public int loopIteration ;
34- public int loopTicks ;
35- public long timeOfDay ; // Tracks the time of day
34+ public int loopLengthTicks ;
35+ public long startTimeOfDay ; // The Time the Loop was started
3636 public long timeSetting ;
3737 public boolean trackTimeOfDay ;
3838 public boolean isLooping ;
@@ -84,9 +84,9 @@ public void onInitialize() {
8484 config = TimeLoopConfig .load (worldFolder );
8585
8686 loopIteration = config .loopIteration ;
87- loopTicks = config .loopTicks ;
87+ loopLengthTicks = config .loopLengthTicks ;
8888 isLooping = config .isLooping ;
89- timeOfDay = config .timeOfDay ;
89+ startTimeOfDay = config .startTimeOfDay ;
9090 timeSetting = config .timeSetting ;
9191 trackTimeOfDay = config .trackTimeOfDay ;
9292 ticksLeft = config .ticksLeft ;
@@ -100,7 +100,7 @@ public void onInitialize() {
100100 this .serverWorld = server .getOverworld ();
101101
102102 // Loop boss bar info
103- String loopInfo = (loopType == LoopTypes .TICKS ? "Ticks Left: " + loopTicks : loopType == LoopTypes .TIME_OF_DAY ? "Time left: " + (timeOfDay - timeSetting ) : "" );
103+ String loopInfo = (loopType == LoopTypes .TICKS ? "Ticks Left: " + loopLengthTicks : loopType == LoopTypes .TIME_OF_DAY ? "Time left: " + (startTimeOfDay - timeSetting ) : "" );
104104 loopBossBar .visible (false );
105105 loopBossBar .setBossBarName (loopInfo );
106106
@@ -126,6 +126,7 @@ public void onInitialize() {
126126
127127 // Send message to all ops
128128 for (ServerPlayerEntity player : server .getPlayerManager ().getPlayerList ()) {
129+ LOOP_LOGGER .info ("GRRRRRRRRRRRRRRRRRRRRRRRRRRR" );
129130 if (server .getPlayerManager ().isOperator (player .getGameProfile ())) {
130131 player .sendMessage (Text .literal (("Use '/loop start' to start the Time loop!" )));
131132 }
@@ -178,9 +179,8 @@ public void onInitialize() {
178179
179180 if (isLooping ) {
180181 if (loopType == LoopTypes .TIME_OF_DAY ) {
181- timeOfDay = serverWorld .getTimeOfDay ();
182-
183- long timeLeft = (timeOfDay > timeSetting ) ? Math .abs (serverWorld .getTimeOfDay () - (2 * timeSetting )) : Math .abs (timeOfDay - timeSetting );
182+ long time = serverWorld .getTimeOfDay ();
183+ long timeLeft = (time > timeSetting ) ? Math .abs (serverWorld .getTimeOfDay () - (2 * timeSetting )) : Math .abs (startTimeOfDay - timeSetting );
184184
185185 if (showLoopInfo && isLooping ) {
186186 loopBossBar .setBossBarName ("Time Left: " + timeLeft );
@@ -194,15 +194,15 @@ public void onInitialize() {
194194
195195 else if (loopType == LoopTypes .TICKS ) {
196196 tickCounter ++;
197- ticksLeft = loopTicks - tickCounter ;
197+ ticksLeft = loopLengthTicks - tickCounter ;
198198 if (showLoopInfo && isLooping ) {
199199 loopBossBar .setBossBarName ("Ticks Left: " + ticksLeft );
200- loopBossBar .setBossBarPercentage (loopTicks , tickCounter );
200+ loopBossBar .setBossBarPercentage (loopLengthTicks , tickCounter );
201201 }
202202
203- if (tickCounter >= loopTicks ) {
203+ if (tickCounter >= loopLengthTicks ) {
204204 tickCounter = 0 ; // Reset counter
205- ticksLeft = loopTicks ; // Reset
205+ ticksLeft = loopLengthTicks ; // Reset
206206 runLoopIteration ();
207207 }
208208 }
@@ -223,10 +223,10 @@ public void startLoop() {
223223 if (showLoopInfo ) {loopBossBar .visible (true );}
224224 isLooping = true ;
225225 config .isLooping = true ;
226- timeOfDay = serverWorld .getTimeOfDay ();
227- config .timeOfDay = timeOfDay ;
226+ startTimeOfDay = serverWorld .getTimeOfDay ();
227+ config .startTimeOfDay = startTimeOfDay ;
228228 tickCounter = 0 ;
229- ticksLeft = loopTicks ;
229+ ticksLeft = loopLengthTicks ;
230230 LOOP_LOGGER .info ("Starting Loop" );
231231 startRecordings ();
232232 }
@@ -235,11 +235,11 @@ public void startLoop() {
235235 * Runs the next iteration of the loop.
236236 */
237237 private void runLoopIteration () {
238- LOOP_LOGGER .info ("Starting iteration {} of recording loop" , loopIteration );
238+ LOOP_LOGGER .info ("Starting iteration {} of loop" , loopIteration );
239239 saveRecordings ();
240240 removeOldSceneEntries ();
241241 startRecordings ();
242- if (trackTimeOfDay ) { serverWorld .setTimeOfDay (timeOfDay ); }
242+ if (trackTimeOfDay ) { serverWorld .setTimeOfDay (startTimeOfDay ); }
243243 executeCommand ("mocap playback stop_all including_others" );
244244 executeCommand (String .format ("mocap playback start .%s" , sceneName ));
245245 loopIteration ++;
@@ -287,7 +287,7 @@ public void stopLoop() {
287287 saveRecordings ();
288288 executeCommand ("mocap playback stop_all including_others" );
289289 tickCounter = 0 ;
290- ticksLeft = loopTicks ;
290+ ticksLeft = loopLengthTicks ;
291291 LOOP_LOGGER .info ("Loop stopped!" );
292292 }
293293 }
0 commit comments