Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82e4a40
commit 12371ef
Showing
10 changed files
with
87 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/org/auioc/mcmod/arnicalib/game/world/MCTimeUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.auioc.mcmod.arnicalib.game.world; | ||
|
||
import net.minecraft.world.level.Level; | ||
|
||
public class MCTimeUtils { | ||
|
||
public static final int SUNRISE = 23000; | ||
public static final int DAY_BEGIN = 0; | ||
public static final int DAY = 1000; | ||
public static final int NOON = 6000; | ||
public static final int SUNSET = 12000; | ||
public static final int NIGHT = 13000; | ||
public static final int MIDNIGHT = 18000; | ||
public static final int DAY_END = 24000; | ||
|
||
public static final int TICKS_PER_DAY = 24000; | ||
public static final int TICKS_PER_HOUR = 1000; | ||
public static final double TICKS_PER_MINUTE = 1000D / 60D; | ||
public static final double TICKS_PER_SECOND = TICKS_PER_MINUTE / 60D; | ||
public static final double TICKS_PER_MILLISECOND = TICKS_PER_SECOND / 1000D; | ||
|
||
public static long[] getTime(Level level) { | ||
return new long[] {level.getDayTime(), level.getGameTime(), System.currentTimeMillis()}; | ||
} | ||
|
||
public static int getDayTime(Level level) { | ||
return (int) (level.getDayTime() % 24000L); | ||
} | ||
|
||
public static int[] formatDayTime(long rawDayTime) { | ||
int dayTime = (int) (rawDayTime % 2147483647L); | ||
|
||
int day = dayTime / TICKS_PER_DAY; | ||
|
||
int ticks = dayTime - day * TICKS_PER_DAY; | ||
int hour = (int) (ticks / TICKS_PER_HOUR + 6) % 24; | ||
int min = (int) (ticks / TICKS_PER_MINUTE) % 60; | ||
int sec = (int) (ticks / TICKS_PER_SECOND) % 60; | ||
int msec = (int) (ticks / TICKS_PER_MILLISECOND) % 1000; | ||
|
||
return new int[] {day, hour, min, sec, msec}; | ||
} | ||
|
||
public static int getDay(long dayTime) { | ||
return ((int) (dayTime % 2147483647L)) / TICKS_PER_DAY; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...d/arnicalib/utils/game/RayTraceUtils.java → ...icalib/game/world/phys/RayTraceUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...rnicalib/utils/game/RandomTeleporter.java → ...game/world/position/RandomTeleporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
src/main/java/org/auioc/mcmod/arnicalib/utils/game/MCTimeUtils.java
This file was deleted.
Oops, something went wrong.