diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/ClientInformationPacket.h | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/ClientInformationPacket.h')
| -rw-r--r-- | Minecraft.World/ClientInformationPacket.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/Minecraft.World/ClientInformationPacket.h b/Minecraft.World/ClientInformationPacket.h new file mode 100644 index 00000000..e5e2cc42 --- /dev/null +++ b/Minecraft.World/ClientInformationPacket.h @@ -0,0 +1,94 @@ +#pragma once + +#include "stdafx.h" + +class ClientInformationPacket : public Packet +{ +#if 0 + private String language; + private int viewDistance; + private int chatVisibility; + private boolean chatColors; + private int difficulty; + + public ClientInformationPacket() { + } + + public ClientInformationPacket(String language, int viewDistance, int chatVisibility, boolean chatColors, int difficulty) { + this.language = language; + this.viewDistance = viewDistance; + this.chatVisibility = chatVisibility; + this.chatColors = chatColors; + this.difficulty = difficulty; + } + + @Override + public void read(DataInputStream dis) throws IOException { + language = readUtf(dis, 7); + viewDistance = dis.readByte(); + + int chat = dis.readByte(); + chatVisibility = chat & 0x7; + chatColors = (chat & 0x8) == 0x8; + + difficulty = dis.readByte(); + } + + @Override + public void write(DataOutputStream dos) throws IOException { + writeUtf(language, dos); + dos.writeByte(viewDistance); + dos.writeByte(chatVisibility | (chatColors ? 1 : 0) << 3); + dos.writeByte(difficulty); + } + + @Override + public void handle(PacketListener listener) { + listener.handleClientInformation(this); + } + + @Override + public int getEstimatedSize() { + return 0; + } + + public String getLanguage() { + return language; + } + + public int getViewDistance() { + return viewDistance; + } + + public int getChatVisibility() { + return chatVisibility; + } + + public boolean getChatColors() { + return chatColors; + } + + public int getDifficulty() { + return difficulty; + } + + public void setDifficulty(int difficulty) { + this.difficulty = difficulty; + } + + @Override + public String getDebugInfo() { + return String.format("lang='%s', view=%d, chat=%d, col=%b, difficulty=%d", language, viewDistance, chatVisibility, chatColors, difficulty); + } + + @Override + public boolean canBeInvalidated() { + return true; + } + + @Override + public boolean isInvalidatedBy(Packet packet) { + return true; + } +#endif +};
\ No newline at end of file |
