generated from matshou/forge-1.15.2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #4
- Loading branch information
Showing
11 changed files
with
233 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ out | |
# gradle | ||
build | ||
.gradle | ||
.composite* | ||
|
||
# other | ||
eclipse | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
rootProject.name = "odyssey" | ||
|
||
// Special .composite file enables composite builds and contains path data | ||
// run 'enableCompositeBuild' to create and 'disableCompositeBuild' to remove it | ||
File file = new File('.composite') | ||
if (file.exists()) { | ||
includeBuild (file.readLines().get(0)) | ||
} |
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
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,59 @@ | ||
package io.yooksi.odyssey.core; | ||
|
||
public class TimeCycle { | ||
|
||
/** | ||
* The maximum speed of the day/night cycle. | ||
* | ||
* This value also represents the maximum proportional length of days to vanilla. | ||
* For example if we wanted the limit the days to be maximally {@code 3} times longer | ||
* or shorter we would set this value to be {@code 3}. | ||
*/ | ||
public static final long MAX_SPEED = 72; | ||
|
||
/** | ||
* The default speed of the day/night cycle. | ||
* <p>This value also represents the default proportional length of days to vanilla. | ||
*/ | ||
public static final long DEFAULT_SPEED = 1; | ||
|
||
/** | ||
* The speed of day/night cycle representing the proportional length of days to vanilla. | ||
* <ul> | ||
* <li>Positive values speed up the cycle.</li> | ||
* <li>Negative values slow down the cycle.</li> | ||
* <li>Value of {@code 0} disables the cycle.</li> | ||
* </ul> | ||
* For example, setting this value to {@code 3} would make days {@code 3} times longer, | ||
* while setting it a value of {@code -3} would make them {@code 3} times shorter. | ||
*/ | ||
private static long speed = DEFAULT_SPEED; | ||
|
||
/** | ||
* Game time of last cycle update in {@code World#advanceTime()}.<br> | ||
* This should be the last recorded time of updating {@code dayTime}. | ||
*/ | ||
public static long lastGameTime; | ||
|
||
/** | ||
* Sets the time cycle speed to it's default value | ||
*/ | ||
public static void resetSpeed() { | ||
setSpeed(DEFAULT_SPEED); | ||
} | ||
|
||
/** | ||
* Set the day/night cycle speed to a desired value between | ||
* positive and negative {@link #MAX_SPEED} value. | ||
*/ | ||
public static void setSpeed(long value) { | ||
speed = Math.min(Math.max(value, -MAX_SPEED), MAX_SPEED); | ||
} | ||
|
||
/** | ||
* @return current day/night cycle speed as defined by Odyssey. | ||
*/ | ||
public static long getSpeed() { | ||
return speed; | ||
} | ||
} |
Oops, something went wrong.