Skip to content

Commit 4c8379c

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents d7d6fa4 + 68b234c commit 4c8379c

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/main/java/com/vltno/timeloop/Commands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandR
224224
mod.startTimeOfDay = 0;
225225
mod.config.startTimeOfDay = 0;
226226

227-
mod.timeSetting = 0;
227+
mod.timeSetting = 13000;
228228
mod.config.timeSetting = 0;
229229

230230
mod.ticksLeft = mod.loopLengthTicks;

src/main/java/com/vltno/timeloop/TimeLoop.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,19 @@ public void onInitialize() {
188188

189189
if (isLooping) {
190190
if (loopType == LoopTypes.TIME_OF_DAY) {
191-
long time = (serverWorld.getTimeOfDay() % 24000);
192-
long timeFixed = (time > 24000) ? (time % 24000) : time;
193-
//
191+
if (timeSetting <= startTimeOfDay) { // prevent stupid 1 tick loop bug
192+
startTimeOfDay = 0;
193+
config.startTimeOfDay = 0;}
194+
195+
long time = (serverWorld.getTimeOfDay() > 24000 ? serverWorld.getTimeOfDay() % 24000 : serverWorld.getTimeOfDay());
196+
//
194197
// long timeLeft = (timeFixed > timeSetting) ? Math.abs(timeFixed - (2 * timeSetting)) : Math.abs(timeFixed - timeSetting);
195198
// LOOP_LOGGER.info("Time Fixed: " + timeFixed);
196199
// LOOP_LOGGER.info("Time Setting: " + timeSetting);
197200
// LOOP_LOGGER.info("Time Left: " + timeLeft);
198201

199-
long timeLeft = (time > timeSetting) ? Math.abs(serverWorld.getTimeOfDay() - (2 * timeSetting)) : Math.abs(timeFixed - timeSetting);
200-
202+
long timeLeft = (time > timeSetting) ? Math.abs(serverWorld.getTimeOfDay() - (2 * timeSetting)) : Math.abs(time - timeSetting);
203+
201204
updateInfoBar((int)timeSetting, (int)timeLeft);
202205
if (Math.abs(timeSetting - timeLeft) >= timeSetting) {
203206
runLoopIteration();

0 commit comments

Comments
 (0)