File tree 2 files changed +16
-13
lines changed
src/main/java/net/wisenoodle/inrealtime
2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 4
4
import org .slf4j .Logger ;
5
5
import org .slf4j .LoggerFactory ;
6
6
7
+
7
8
public class InRealTime implements ModInitializer {
8
9
public static boolean timeSyncToggle = true ;
9
10
public static final String MOD_ID = "inrealtime" ;
10
11
public static final Logger LOGGER = LoggerFactory .getLogger (MOD_ID );
11
12
@ Override
12
13
public void onInitialize () {
13
14
LOGGER .info ("In Real-Time 1.0.0 Loaded Successfully!" );
15
+
14
16
}
15
17
}
Original file line number Diff line number Diff line change 23
23
24
24
@ Mixin (ServerWorld .class )
25
25
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 ();
39
39
}
40
40
}
41
41
42
+
You can’t perform that action at this time.
0 commit comments