the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2
3#include "stdafx.h"
4
5class ClientInformationPacket : public Packet
6{
7#if 0
8 private String language;
9 private int viewDistance;
10 private int chatVisibility;
11 private boolean chatColors;
12 private int difficulty;
13
14 public ClientInformationPacket() {
15 }
16
17 public ClientInformationPacket(String language, int viewDistance, int chatVisibility, boolean chatColors, int difficulty, boolean showCape) {
18 this.language = language;
19 this.viewDistance = viewDistance;
20 this.chatVisibility = chatVisibility;
21 this.chatColors = chatColors;
22 this.difficulty = difficulty;
23 this.showCape = showCape;
24 }
25
26 @Override
27 public void read(DataInputStream dis) throws IOException {
28 language = readUtf(dis, 7);
29 viewDistance = dis.readByte();
30
31 int chat = dis.readByte();
32 chatVisibility = chat & 0x7;
33 chatColors = (chat & 0x8) == 0x8;
34
35 difficulty = dis.readByte();
36 showCape = dis.readBoolean();
37 }
38
39 @Override
40 public void write(DataOutputStream dos) throws IOException {
41 writeUtf(language, dos);
42 dos.writeByte(viewDistance);
43 dos.writeByte(chatVisibility | (chatColors ? 1 : 0) << 3);
44 dos.writeByte(difficulty);
45 dos.writeBoolean(showCape);
46 }
47
48 @Override
49 public void handle(PacketListener listener) {
50 listener.handleClientInformation(this);
51 }
52
53 @Override
54 public int getEstimatedSize() {
55 return 7;
56 }
57
58 public String getLanguage() {
59 return language;
60 }
61
62 public int getViewDistance() {
63 return viewDistance;
64 }
65
66 public int getChatVisibility() {
67 return chatVisibility;
68 }
69
70 public boolean getChatColors() {
71 return chatColors;
72 }
73
74 public int getDifficulty() {
75 return difficulty;
76 }
77
78 public boolean getShowCape() {
79 return showCape;
80 }
81
82 public void setDifficulty(int difficulty) {
83 this.difficulty = difficulty;
84 }
85
86 @Override
87 public String getDebugInfo() {
88 return String.format("lang='%s', view=%d, chat=%d, col=%b, difficulty=%d", language, viewDistance, chatVisibility, chatColors, difficulty);
89 }
90
91 @Override
92 public boolean canBeInvalidated() {
93 return true;
94 }
95
96 @Override
97 public boolean isInvalidatedBy(Packet packet) {
98 return true;
99 }
100#endif
101};