3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 15:50:14 +01:00

Add time translator

Dieser Commit ist enthalten in:
RednedEpic 2019-07-21 17:36:45 -05:00
Ursprung 82f56a7c34
Commit a01a07aee3

Datei anzeigen

@ -32,6 +32,7 @@ import com.github.steveice10.mc.protocol.data.message.TranslationMessage;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTitlePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
import com.nukkitx.nbt.CompoundTagBuilder;
import com.nukkitx.nbt.NbtUtils;
import com.nukkitx.nbt.stream.NBTOutputStream;
@ -68,6 +69,7 @@ public class TranslatorsInit {
addLoginPackets();
addChatPackets();
addTitlePackets();
addTimePackets();
}
private static void addLoginPackets() {
@ -212,4 +214,13 @@ public class TranslatorsInit {
session.getUpstream().sendPacket(titlePacket);
});
}
public static void addTimePackets() {
Registry.add(ServerUpdateTimePacket.class, (packet, session) -> {
SetTimePacket setTimePacket = new SetTimePacket();
setTimePacket.setTime((int) Math.abs(packet.getTime()));
session.getUpstream().sendPacket(setTimePacket);
});
}
}