mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Add time translator
This commit is contained in:
parent
82f56a7c34
commit
a01a07aee3
1 changed files with 11 additions and 0 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue