Merge pull request #402 from MrGazdag/patch-9

Fix timeRate 0 when time is 0
This commit is contained in:
TheMode 2021-08-11 13:42:18 +02:00 committed by GitHub
commit 1fdf1d62f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -416,7 +416,13 @@ public abstract class Instance implements BlockGetter, BlockSetter, Tickable, Ta
* @return the {@link TimeUpdatePacket} with this instance data
*/
private @NotNull TimeUpdatePacket createTimePacket() {
return new TimeUpdatePacket(worldAge, timeRate == 0 ? -Math.abs(time) : time);
long time = this.time;
if (timeRate == 0) {
//Negative values stop the sun and moon from moving
//0 as a long cannot be negative
time = time == 0 ? -24000L : -Math.abs(time);
}
return new TimeUpdatePacket(worldAge, time);
}
/**