Use absolute day time value

This commit is contained in:
Nassim Jahnke 2024-09-26 12:15:03 +02:00
parent e4e8297a82
commit ce655d0679
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -113,8 +113,14 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol<ClientboundPack
registerClientbound(ClientboundPackets1_21.SET_TIME, wrapper -> {
wrapper.passthrough(Types.LONG); // Game time
final long dayTime = wrapper.passthrough(Types.LONG);
wrapper.write(Types.BOOLEAN, dayTime < 0); // Do daylight cycle
long dayTime = wrapper.read(Types.LONG);
boolean doDaylightCycle = true;
if (dayTime < 0) {
dayTime = -dayTime;
doDaylightCycle = false;
}
wrapper.write(Types.LONG, dayTime);
wrapper.write(Types.BOOLEAN, doDaylightCycle);
});
}