Skip to content

Commit c9a10b2

Browse files
author
WiseNoodle
committed
General updates
1 parent 859fbef commit c9a10b2

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/main/java/net/wisenoodle/inrealtime/InRealTime.java

+2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
import org.slf4j.Logger;
55
import org.slf4j.LoggerFactory;
66

7+
78
public class InRealTime implements ModInitializer {
89
public static boolean timeSyncToggle = true;
910
public static final String MOD_ID = "inrealtime";
1011
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
1112
@Override
1213
public void onInitialize() {
1314
LOGGER.info("In Real-Time 1.0.0 Loaded Successfully!");
15+
1416
}
1517
}

src/main/java/net/wisenoodle/inrealtime/mixin/MainMixin.java

+14-13
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,20 @@
2323

2424
@Mixin(ServerWorld.class)
2525
public abstract class MainMixin {
26-
@Shadow
27-
@Final
28-
private ServerWorldProperties worldProperties;
29-
@Unique
30-
private static final double CONSTANT_OF_MULTIPLICATION = (double)SharedConstants.TICKS_PER_SECOND/72d;
31-
@Inject(method = "setTimeOfDay(J)V", at = @At(value = "HEAD"), cancellable = true)
32-
public void setTimeOfDayCallback(long timeOfDay, CallbackInfo ci) {
33-
long equivalentTime = Math.round(((LocalTime.now().toSecondOfDay() * CONSTANT_OF_MULTIPLICATION) - 6000));
34-
if (equivalentTime < 0) equivalentTime = SharedConstants.TICKS_PER_IN_GAME_DAY + equivalentTime ;
35-
if(InRealTime.timeSyncToggle) {
36-
this.worldProperties.setTimeOfDay(equivalentTime);
37-
}
38-
ci.cancel();
26+
@Shadow
27+
@Final
28+
private ServerWorldProperties worldProperties;
29+
@Unique
30+
private static final double CONSTANT_OF_MULTIPLICATION = (double)SharedConstants.TICKS_PER_SECOND/72d;
31+
@Inject(method = "setTimeOfDay(J)V", at = @At(value = "HEAD"), cancellable = true)
32+
public void setTimeOfDayCallback(long timeOfDay, CallbackInfo ci) {
33+
long equivalentTime = Math.round(((LocalTime.now().toSecondOfDay() * CONSTANT_OF_MULTIPLICATION) - 6000));
34+
if (equivalentTime < 0) equivalentTime = SharedConstants.TICKS_PER_IN_GAME_DAY + equivalentTime ;
35+
if(InRealTime.timeSyncToggle) {
36+
this.worldProperties.setTimeOfDay(equivalentTime);
37+
}
38+
ci.cancel();
3939
}
4040
}
4141

42+

0 commit comments

Comments
 (0)