3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-08 10:50:11 +02:00

SetTimeTranslator: cast from long on the entire modulus

This should fix some inaccuracies with time on older worlds.
Dieser Commit ist enthalten in:
Camotoy 2022-04-12 19:42:41 -04:00
Ursprung 98db9c6948
Commit 0803c5d9af
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -45,7 +45,7 @@ public class JavaSetTimeTranslator extends PacketTranslator<ClientboundSetTimePa
// We use modulus to prevent an integer overflow
// 24000 is the range of ticks that a Minecraft day can be; we times by 8 so all moon phases are visible
// (Last verified behavior: Bedrock 1.18.12 / Java 1.18.2)
setTimePacket.setTime((int) Math.abs(time) % (24000 * 8));
setTimePacket.setTime((int) (Math.abs(time) % (24000 * 8)));
session.sendUpstreamPacket(setTimePacket);
if (!session.isDaylightCycle() && time >= 0) {
// Client thinks there is no daylight cycle but there is