From 4fc5b4f6c9b691278f89b047e97220478f9a141e Mon Sep 17 00:00:00 2001 From: MrGazdag <44264503+MrGazdag@users.noreply.github.com> Date: Wed, 11 Aug 2021 03:41:17 +0200 Subject: [PATCH] fix time 0 --- .../java/net/minestom/server/instance/Instance.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/instance/Instance.java b/src/main/java/net/minestom/server/instance/Instance.java index eaa06050f..439928ca1 100644 --- a/src/main/java/net/minestom/server/instance/Instance.java +++ b/src/main/java/net/minestom/server/instance/Instance.java @@ -416,7 +416,15 @@ 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 timeOfDay; + if (timeRate == 0) { + //Negative values make the sun and moon stop moving + //0 as a long cannot be negative + timeOfDay = time == 0 ? -24000L : -Math.abs(time); + } else { + timeOfDay = time; + } + return new TimeUpdatePacket(worldAge, timeOfDay); } /**