@vaitosoi/minejs 0.4.3 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +12 -4
  2. package/assets/minecraft/26.2/effects.json +42 -0
  3. package/assets/minecraft/26.2/packets.json +1 -1
  4. package/dist/base/bitset.d.ts +43 -4
  5. package/dist/base/bitset.d.ts.map +1 -1
  6. package/dist/base/bitset.js +251 -30
  7. package/dist/base/bitset.js.map +1 -1
  8. package/dist/base/buffer.d.ts +1 -0
  9. package/dist/base/buffer.d.ts.map +1 -1
  10. package/dist/base/buffer.js +1 -0
  11. package/dist/base/buffer.js.map +1 -1
  12. package/dist/base/cache.d.ts +24 -0
  13. package/dist/base/cache.d.ts.map +1 -0
  14. package/dist/base/cache.js +58 -0
  15. package/dist/base/cache.js.map +1 -0
  16. package/dist/base/error.d.ts +7 -0
  17. package/dist/base/error.d.ts.map +1 -1
  18. package/dist/base/error.js +12 -1
  19. package/dist/base/error.js.map +1 -1
  20. package/dist/base/http.d.ts +1 -0
  21. package/dist/base/http.d.ts.map +1 -1
  22. package/dist/base/http.js +1 -0
  23. package/dist/base/http.js.map +1 -1
  24. package/dist/base/math.d.ts +14 -0
  25. package/dist/base/math.d.ts.map +1 -1
  26. package/dist/base/math.js +41 -0
  27. package/dist/base/math.js.map +1 -1
  28. package/dist/base/typing.d.ts +12 -0
  29. package/dist/base/typing.d.ts.map +1 -1
  30. package/dist/{packet → binary}/decoder.d.ts +4 -0
  31. package/dist/binary/decoder.d.ts.map +1 -0
  32. package/dist/{packet → binary}/decoder.js +4 -0
  33. package/dist/binary/decoder.js.map +1 -0
  34. package/dist/{packet → binary}/encoder.d.ts +6 -2
  35. package/dist/binary/encoder.d.ts.map +1 -0
  36. package/dist/{packet → binary}/encoder.js +10 -2
  37. package/dist/binary/encoder.js.map +1 -0
  38. package/dist/{packet → binary}/static.d.ts.map +1 -1
  39. package/dist/{packet → binary}/static.js.map +1 -1
  40. package/dist/client/client.d.ts +23 -2
  41. package/dist/client/client.d.ts.map +1 -1
  42. package/dist/client/client.js +32 -15
  43. package/dist/client/client.js.map +1 -1
  44. package/dist/index.d.ts +12 -4
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +12 -4
  47. package/dist/index.js.map +1 -1
  48. package/dist/message/link.d.ts +3 -0
  49. package/dist/message/link.d.ts.map +1 -1
  50. package/dist/message/link.js +3 -0
  51. package/dist/message/link.js.map +1 -1
  52. package/dist/message/sigCache.d.ts +5 -0
  53. package/dist/message/sigCache.d.ts.map +1 -1
  54. package/dist/message/sigCache.js +5 -0
  55. package/dist/message/sigCache.js.map +1 -1
  56. package/dist/{client → net}/tcp.d.ts +3 -3
  57. package/dist/net/tcp.d.ts.map +1 -0
  58. package/dist/{client → net}/tcp.js +3 -3
  59. package/dist/net/tcp.js.map +1 -0
  60. package/dist/packet/{dispatcher.d.ts → listener.d.ts} +10 -18
  61. package/dist/packet/listener.d.ts.map +1 -0
  62. package/dist/packet/{dispatcher.js → listener.js} +74 -137
  63. package/dist/packet/listener.js.map +1 -0
  64. package/dist/packet/sender.d.ts +28 -0
  65. package/dist/packet/sender.d.ts.map +1 -0
  66. package/dist/packet/sender.js +147 -0
  67. package/dist/packet/sender.js.map +1 -0
  68. package/dist/physics/aabb.d.ts +3 -0
  69. package/dist/physics/aabb.d.ts.map +1 -1
  70. package/dist/physics/aabb.js +12 -8
  71. package/dist/physics/aabb.js.map +1 -1
  72. package/dist/physics/direction.d.ts +3 -0
  73. package/dist/physics/direction.d.ts.map +1 -1
  74. package/dist/physics/direction.js +3 -0
  75. package/dist/physics/direction.js.map +1 -1
  76. package/dist/physics/player.d.ts +4 -0
  77. package/dist/physics/player.d.ts.map +1 -1
  78. package/dist/physics/player.js +24 -3
  79. package/dist/physics/player.js.map +1 -1
  80. package/dist/version/codec.d.ts +5 -1
  81. package/dist/version/codec.d.ts.map +1 -1
  82. package/dist/version/codec.js +25 -5
  83. package/dist/version/codec.js.map +1 -1
  84. package/dist/version/registry.d.ts +25 -2
  85. package/dist/version/registry.d.ts.map +1 -1
  86. package/dist/version/registry.js +43 -6
  87. package/dist/version/registry.js.map +1 -1
  88. package/dist/world/block.d.ts +5 -0
  89. package/dist/world/block.d.ts.map +1 -1
  90. package/dist/world/block.js +56 -0
  91. package/dist/world/block.js.map +1 -1
  92. package/dist/world/state.d.ts +22 -0
  93. package/dist/world/state.d.ts.map +1 -1
  94. package/dist/world/state.js +19 -0
  95. package/dist/world/state.js.map +1 -1
  96. package/package.json +8 -10
  97. package/src/base/bitset.ts +311 -31
  98. package/src/base/buffer.ts +1 -0
  99. package/src/base/cache.ts +62 -0
  100. package/src/base/error.ts +9 -0
  101. package/src/base/http.ts +1 -0
  102. package/src/base/math.ts +45 -1
  103. package/src/base/typing.ts +11 -0
  104. package/src/{packet → binary}/decoder.ts +4 -0
  105. package/src/{packet → binary}/encoder.ts +10 -2
  106. package/src/client/client.ts +54 -19
  107. package/src/index.ts +12 -4
  108. package/src/message/link.ts +3 -0
  109. package/src/message/sigCache.ts +5 -0
  110. package/src/{client → net}/tcp.ts +4 -8
  111. package/src/packet/{dispatcher.ts → listener.ts} +93 -175
  112. package/src/packet/sender.ts +179 -0
  113. package/src/physics/aabb.ts +12 -8
  114. package/src/physics/direction.ts +3 -0
  115. package/src/physics/player.ts +22 -3
  116. package/src/version/codec.ts +27 -6
  117. package/src/version/registry.ts +59 -3
  118. package/src/world/block.ts +72 -2
  119. package/src/world/state.ts +42 -2
  120. package/test/bitset/index.ts +3 -8
  121. package/test/client/index.ts +12 -2
  122. package/test/state/index.ts +7 -0
  123. package/dist/client/tcp.d.ts.map +0 -1
  124. package/dist/client/tcp.js.map +0 -1
  125. package/dist/packet/decoder.d.ts.map +0 -1
  126. package/dist/packet/decoder.js.map +0 -1
  127. package/dist/packet/dispatcher.d.ts.map +0 -1
  128. package/dist/packet/dispatcher.js.map +0 -1
  129. package/dist/packet/encoder.d.ts.map +0 -1
  130. package/dist/packet/encoder.js.map +0 -1
  131. /package/dist/{packet → binary}/static.d.ts +0 -0
  132. /package/dist/{packet → binary}/static.js +0 -0
  133. /package/src/{packet → binary}/static.ts +0 -0
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The base implementation for the Cache class
3
+ */
4
+ export abstract class CacheImplementation<T = any> {
5
+ public abstract put(key: string, item: T): void;
6
+ public abstract get(key: string): T | undefined;
7
+ public abstract del(key: string): void;
8
+ }
9
+
10
+ /**
11
+ * The LRU cache implementation.
12
+ *
13
+ * @see https://en.wikipedia.org/wiki/Cache_replacement_policies#Time-Aware,_Least_Recently_Used_(TLRU)
14
+ */
15
+ export class LRUCache<T> extends CacheImplementation<T> {
16
+ private hash: Map<string, T> = new Map();
17
+ private list: string[] = [];
18
+
19
+ constructor(private capacity: number) {
20
+ super();
21
+ }
22
+
23
+ public put(key: string, item: T): void {
24
+ if (this.hash.has(key)) {
25
+ const oldIndex = this.list.indexOf(key);
26
+ if (oldIndex > -1)
27
+ this.list.splice(oldIndex, 1);
28
+ }
29
+
30
+ this.hash.set(key, item);
31
+ this.list.push(key);
32
+
33
+ this.truncateHash();
34
+ }
35
+
36
+ public get(key: string) {
37
+ if (!this.hash.has(key)) return undefined;
38
+
39
+ const item = this.hash.get(key);
40
+ const oldIndex = this.list.indexOf(key);
41
+ if (oldIndex > -1)
42
+ this.list.splice(oldIndex, 1);
43
+ this.list.push(key);
44
+
45
+ return item;
46
+ }
47
+
48
+ public del(key: string): void {
49
+ const oldIndex = this.list.indexOf(key);
50
+ if (oldIndex > -1)
51
+ this.list.splice(oldIndex, 1);
52
+ this.hash.delete(key);
53
+ }
54
+
55
+ private truncateHash() {
56
+ while (this.list.length > this.capacity) {
57
+ const popping = this.list.pop();
58
+ if (popping)
59
+ this.hash.delete(popping);
60
+ }
61
+ }
62
+ }
package/src/base/error.ts CHANGED
@@ -211,4 +211,13 @@ export class HaveSignatureButNotIndex extends Error {
211
211
  constructor() {
212
212
  super (`expecting both shouldVerifyMessageOrder set to true when shouldVerifyMessageSignature set to true`);
213
213
  }
214
+ }
215
+
216
+ /**
217
+ * @hidden
218
+ */
219
+ export class MessageTooLong extends Error {
220
+ constructor(public message: string) {
221
+ super(`your message is exceeding the 256 characters long limit, got ${message.length} characters`);
222
+ }
214
223
  }
package/src/base/http.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AuthClientError } from "./error";
2
2
 
3
+ /** @hidden */
3
4
  export async function getJson(res: Response, source: string) {
4
5
  const data = await res.text();
5
6
  try {
package/src/base/math.ts CHANGED
@@ -112,4 +112,48 @@ export function minecraftSha1(
112
112
  function mcHexDigest(digest: Buffer | Uint8Array): string {
113
113
  const bigint = BigInt(`0x${digest.toString('hex')}`);
114
114
  return BigInt.asIntN(digest.length * 8, bigint).toString(16);
115
- }
115
+ }
116
+
117
+ /**
118
+ * Simplified implementation of Java's Long.numberOfTrailingZeros
119
+ * @param n
120
+ * @returns
121
+ * @hidden
122
+ */
123
+ export function numberOfTrailingZeros(n: bigint): number {
124
+ if (n === 0n) {
125
+ return 64;
126
+ }
127
+
128
+ let count = 0;
129
+ while ((n & 1n) === 0n) {
130
+ count++;
131
+ n >>= 1n;
132
+ }
133
+
134
+ return count;
135
+ }
136
+
137
+ /**
138
+ * Simplified implementation of Java's Long.numberOfLeadingZeros
139
+ * @param n
140
+ * @returns
141
+ * @hidden
142
+ */
143
+ export function numberOfLeadingZeros(n: bigint): number {
144
+ if (n === 0n) {
145
+ return 64;
146
+ }
147
+
148
+ let count = 0;
149
+ // Start checking from bit 63 (the most significant bit)
150
+ for (let i = 63; i >= 0; i--) {
151
+ if ((n & (1n << BigInt(i))) === 0n) {
152
+ count++;
153
+ } else {
154
+ break; // Stop at the first 1 bit
155
+ }
156
+ }
157
+
158
+ return count;
159
+ }
@@ -8,3 +8,14 @@ export type If<Condition extends boolean, True, False = null> = Condition extend
8
8
  * @see https://minecraft.wiki/w/Text_component_format
9
9
  */
10
10
  export type TextComponent = Record<string, any>;
11
+
12
+
13
+ /**
14
+ * Representing the data in Registry Data packet
15
+ *
16
+ * @see https://minecraft.wiki/w/Java_Edition_protocol/Packets#Registry_Data
17
+ */
18
+ export interface RegistryData {
19
+ registry_id: string,
20
+ entries: { entry_id: string, data: Record<string, any> | null }[]
21
+ }
@@ -6,6 +6,7 @@ import { unzipSync } from "zlib";
6
6
  import { minBigInt } from "../base/math";
7
7
  import { inspect } from "util";
8
8
 
9
+ /** @hidden */
9
10
  export function getTextFromTextComponent(component: any): string {
10
11
  if (component === null || component === undefined) return "null";
11
12
  switch (typeof component) {
@@ -31,6 +32,9 @@ export function getTextFromTextComponent(component: any): string {
31
32
  }
32
33
  }
33
34
 
35
+ /**
36
+ * Binary decoding helper class
37
+ */
34
38
  export class BinaryDecoder {
35
39
  public buffer: Buffer = Buffer.alloc(0);
36
40
  public offset: number = 0;
@@ -3,6 +3,7 @@ import { CONTINUATION_FLAG, CONTINUE_BIT, isFixedSizeTag, isTag, MAX_QUANTIZED_V
3
3
  import { InvalidValue, NumberTooBig, UnexpectedValue } from "../base/error";
4
4
  import { FixedSizeTag, Tag } from "./static";
5
5
 
6
+ /** @hidden */
6
7
  export function makeMovementFlag(onGround: boolean, pushingWall: boolean) {
7
8
  let flag = 0;
8
9
  if (onGround)
@@ -12,6 +13,9 @@ export function makeMovementFlag(onGround: boolean, pushingWall: boolean) {
12
13
  return flag;
13
14
  }
14
15
 
16
+ /**
17
+ * Binary encoding helper
18
+ */
15
19
  export class BinaryEncoder {
16
20
  private buffer = Buffer.alloc(0);
17
21
 
@@ -62,9 +66,13 @@ export class BinaryEncoder {
62
66
  */
63
67
  public writeInt(val: number) { return this.write(4, val, (buf) => buf.writeInt32BE); }
64
68
  /**
65
- * Write 6 bytes singed integer
69
+ * Write 8 bytes singed integer
66
70
  */
67
- public writeLong(val: bigint) { return this.write(8, val, (buf) => buf.writeBigInt64BE); }
71
+ public writeLong(val: bigint | number) {
72
+ // Cast to BigInt
73
+ const v = typeof val === "bigint" ? val : BigInt(val);
74
+ return this.write(8, v, (buf) => buf.writeBigInt64BE);
75
+ }
68
76
  /**
69
77
  * Write 4 bytes float
70
78
  */
@@ -3,17 +3,19 @@ import { BlockManager, BlockState } from "../world/block";
3
3
  import { EntitiesManager } from "../world/entity";
4
4
  import { Input, Player } from "../physics/player";
5
5
  import { TickLoop } from "../world/tick";
6
- import { Message, TCPClient, TCPClientOption } from "./tcp";
6
+ import { Message, TCPClient, TCPClientOption } from "../net/tcp";
7
7
  import { TypedEmmiter as TypedEmitter } from "../base/event";
8
- import { BlockRegistry, EntityRegistry, PacketRegistry, ProtocolVersionMapping } from "../version/registry";
8
+ import { BlockRegistry, EffectRegistry, EntityRegistry, PacketRegistry, ProtocolVersionMapping } from "../version/registry";
9
9
  import { BaseVec3, Vec3 } from "../physics/direction";
10
- import { TextComponent } from "../base/typing";
10
+ import { RegistryData, TextComponent } from "../base/typing";
11
11
  import { ClientStatus, ConnectionState, EmittedEvent as EmittedEvent, Entity, SharedState } from "../world/state";
12
- import { Dispatcher } from "../packet/dispatcher";
12
+ import { Listener } from "../packet/listener";
13
13
  import { VersionCodec } from "../version/codec";
14
14
  import { AuthClient } from "./auth";
15
15
  import { computeUUID } from "../base/math";
16
16
  import { HaveSignatureButNotIndex } from "../base/error";
17
+ import { Sender } from "../packet/sender";
18
+ import { CacheImplementation } from "../base/cache";
17
19
 
18
20
  export type ClientOption = Omit<TCPClientOption, "protocolVersion"> & {
19
21
  version: string,
@@ -23,12 +25,26 @@ export type ClientOption = Omit<TCPClientOption, "protocolVersion"> & {
23
25
  *
24
26
  * When set this option to true, you HAVE TO set `shouldVerifyMessageOrder` to true
25
27
  */
26
- shouldVerifyMessageSignature?: boolean
28
+ shouldVerifyMessageSignature?: boolean,
27
29
 
28
30
  /**
29
31
  * Should verify the message orders to keep the sync with server.
30
32
  */
31
- shouldVerifyMessageOrder?: boolean
33
+ shouldVerifyMessageOrder?: boolean,
34
+
35
+ /**
36
+ * Whether to load the whole chunk section (16x16x16) and keep them in the cache or just load the needed block.
37
+ *
38
+ * Please consider this carefully since this can consume a lot of resource to calculate the whole chunk section and store it while you may not need that much.
39
+ *
40
+ * This option is useful when you have to constantly access to the world chunk, e.g pathfinding.
41
+ */
42
+ loadAndCacheChunk?: boolean,
43
+
44
+ /**
45
+ * Custom cache class. Default to `LRUCache`
46
+ */
47
+ cacheImplementation?: new () => CacheImplementation<Uint16Array>,
32
48
  }
33
49
 
34
50
  export interface ClientEvents {
@@ -71,6 +87,8 @@ export interface ClientEvents {
71
87
  updateEntity: [entityId: number],
72
88
  /** When an entity go out of client view distance or despawned */
73
89
  removeEntity: [entityId: number],
90
+ /** The registry_data packet */
91
+ registryData: [data: RegistryData],
74
92
 
75
93
  // Chat
76
94
  /** When a chat message got broadcasted */
@@ -101,6 +119,8 @@ export class Client<IsReady extends boolean = boolean> extends (EventEmitter as
101
119
 
102
120
  private tcp: TCPClient;
103
121
  private state: SharedState<IsReady>;
122
+ private packetListener: Listener;
123
+ private packetSender: Sender;
104
124
 
105
125
  constructor(private options: ClientOption) {
106
126
  if (options.shouldVerifyMessageSignature === true && options.shouldVerifyMessageOrder !== true)
@@ -111,7 +131,8 @@ export class Client<IsReady extends boolean = boolean> extends (EventEmitter as
111
131
  // For managing shared data
112
132
  this.state = new SharedState(options);
113
133
  // For handling packet
114
- const dispatcher = new Dispatcher(this.state, this.emit.bind(this));
134
+ this.packetSender = new Sender(this.state, this.emit.bind(this));
135
+ this.packetListener = new Listener(this.state, this.emit.bind(this), this.packetSender);
115
136
  // For reading packet
116
137
  const versionCodec = new VersionCodec(this.state);
117
138
  // For throwing packet through internet
@@ -126,12 +147,12 @@ export class Client<IsReady extends boolean = boolean> extends (EventEmitter as
126
147
  this.tcp.forwardPacket = versionCodec.handlePacket.bind(versionCodec);
127
148
  this.tcp.parsePacket = versionCodec.encodePacket.bind(versionCodec);
128
149
  this.tcp.sendInitPacket = () => {
129
- dispatcher.sendHandshake();
130
- dispatcher.sendLoginStart();
150
+ this.packetSender.sendHandshake();
151
+ this.packetSender.sendLoginStart();
131
152
  };
132
- dispatcher.sendPacket = this.tcp.sendPacket.bind(this.tcp);
133
- dispatcher.disconnect = this.disconnect.bind(this);
134
- versionCodec.consumePacket = dispatcher.handlePacket.bind(dispatcher);
153
+ this.packetSender.sendPacket = this.tcp.sendPacket.bind(this.tcp);
154
+ this.packetListener.disconnect = this.disconnect.bind(this);
155
+ versionCodec.consumePacket = this.packetListener.handlePacket.bind(this.packetListener);
135
156
 
136
157
  // For querying data
137
158
  this.blocks = new BlockManager(this.state);
@@ -143,10 +164,10 @@ export class Client<IsReady extends boolean = boolean> extends (EventEmitter as
143
164
  this.entities,
144
165
  this.blocks,
145
166
  );
146
- this.player.sendPlayerPos = dispatcher.sendPlayerPos;
147
- this.player.sendPlayerPosRot = dispatcher.sendPlayerPosRot;
148
- this.player.sendPlayerRot = dispatcher.sendPlayerRot;
149
- this.player.sendPlayerStatus = dispatcher.sendPlayerStatus;
167
+ this.player.sendPlayerPos = this.packetSender.sendPlayerPos;
168
+ this.player.sendPlayerPosRot = this.packetSender.sendPlayerPosRot;
169
+ this.player.sendPlayerRot = this.packetSender.sendPlayerRot;
170
+ this.player.sendPlayerStatus = this.packetSender.sendPlayerStatus;
150
171
 
151
172
  // For tick-tock tick-tock
152
173
  this.tickLoop = new TickLoop(() => {
@@ -159,6 +180,11 @@ export class Client<IsReady extends boolean = boolean> extends (EventEmitter as
159
180
  // Forward TCP events
160
181
  this.tcp.on("connect", () => this.emit("connect"));
161
182
  this.tcp.on("destroy", () => this.emit("destroy"));
183
+ this.on("loadChunk", (sx, sy, sz) => this.blocks.deleteChunkCache(sx, sy, sz));
184
+ this.on("unloadChunk", (sx, sz) => {
185
+ for (let sy = 0; sy < 16; sy++)
186
+ this.blocks.deleteChunkCache(sx, sy, sz);
187
+ });
162
188
  }
163
189
 
164
190
  private emitEvent(event: EmittedEvent) {
@@ -168,9 +194,11 @@ export class Client<IsReady extends boolean = boolean> extends (EventEmitter as
168
194
  private async loadRegistries() {
169
195
  if (Client.loadRegistry) return;
170
196
  Client.loadRegistry = true;
171
- await BlockRegistry.load(this.options.version);
172
- await EntityRegistry.load(this.options.version);
173
- await PacketRegistry.load(this.options.version);
197
+ const { version } = this.options;
198
+ await BlockRegistry.load(version);
199
+ await EntityRegistry.load(version);
200
+ await PacketRegistry.load(version);
201
+ await EffectRegistry.load(version);
174
202
  }
175
203
 
176
204
  // Start / stop
@@ -239,6 +267,13 @@ export class Client<IsReady extends boolean = boolean> extends (EventEmitter as
239
267
  this.player.releaseAllInputs();
240
268
  }
241
269
 
270
+ /**
271
+ * Send a message
272
+ */
273
+ public chat(message: string) {
274
+ this.packetSender.sendMessage(message);
275
+ }
276
+
242
277
  // World
243
278
  /**
244
279
  * Get the block state at position
package/src/index.ts CHANGED
@@ -1,14 +1,22 @@
1
1
  export * from "./base/bitset";
2
+ export * from "./base/buffer";
3
+ export * from "./base/cache";
2
4
  export * from "./base/error";
3
5
  export * from "./base/event";
6
+ export * from "./base/http";
4
7
  export * from "./base/math";
5
8
  export * from "./base/typing";
9
+ export * from "./binary/decoder";
10
+ export * from "./binary/encoder";
11
+ export * from "./binary/static";
6
12
  export * from "./client/auth";
7
13
  export * from "./client/client";
8
- export * from "./client/tcp";
9
- export * from "./packet/decoder";
10
- export * from "./packet/encoder";
11
- export * from "./packet/dispatcher";
14
+ export * from "./client/static";
15
+ export * from "./message/link";
16
+ export * from "./message/sigCache";
17
+ export * from "./net/tcp";
18
+ export * from "./packet/listener";
19
+ export * from "./packet/sender";
12
20
  export * from "./physics/aabb";
13
21
  export * from "./physics/direction";
14
22
  export * from "./physics/player";
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Represent a node in the linked-list of messages
3
+ */
1
4
  export class MessageLink {
2
5
  constructor (
3
6
  public index: number,
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Used for caching the message signature
3
+ *
4
+ * Not used for now
5
+ */
1
6
  export class SignatureCache {
2
7
  private entries: Buffer[];
3
8
 
@@ -3,18 +3,14 @@ import { EventEmitter } from "node:events";
3
3
  import { deflateSync, inflateSync } from "node:zlib";
4
4
 
5
5
  import { TypedEmmiter } from "../base/event";
6
- import { BinaryDecoder } from "../packet/decoder";
7
- import { BinaryEncoder } from "../packet/encoder";
8
- import { AuthOption } from "./auth";
6
+ import { BinaryDecoder } from "../binary/decoder";
7
+ import { BinaryEncoder } from "../binary/encoder";
8
+ import { AuthOption } from "../client/auth";
9
9
  import { ClientStatus, SharedState } from "../world/state";
10
10
  import { EncodeResult } from "../version/codec";
11
11
  import { TextComponent } from "../base/typing";
12
12
  import { NotImplemented, SockerIsNotWritable, UnexpectedValue } from "../base/error";
13
13
 
14
- // Minecraft related typing
15
-
16
-
17
-
18
14
  // TCP related typing
19
15
  export interface TCPClientOption {
20
16
  /** Server host */
@@ -72,7 +68,7 @@ export interface Message {
72
68
  /**
73
69
  * Low-level client. You SHOULD NOT use this client unless you know what are you doing
74
70
  *
75
- * @see https://minecraft.wiki/w/Java_Edition_protocol/Packets?oldid=3445844
71
+ * @see https://minecraft.wiki/w/Java_Edition_protocol/Packets
76
72
  */
77
73
  export class TCPClient extends (EventEmitter as new () => TypedEmmiter<TCPClientEvents>) {
78
74
  public readonly socket: Socket;