From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/ClientInformationPacket.h | 94 +++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Minecraft.World/ClientInformationPacket.h (limited to 'Minecraft.World/ClientInformationPacket.h') 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 -- cgit v1.2.3