baltica 0.1.28 → 0.1.30
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.
package/dist/client/client.js
CHANGED
|
@@ -36,11 +36,13 @@ class Client extends shared_1.Emitter {
|
|
|
36
36
|
address: this.options.address,
|
|
37
37
|
port: this.options.port,
|
|
38
38
|
proxy: this.options.proxy,
|
|
39
|
+
debug: this.options.debug,
|
|
39
40
|
})
|
|
40
41
|
: new raknet_1.Client({
|
|
41
42
|
address: this.options.address,
|
|
42
43
|
port: this.options.port,
|
|
43
44
|
proxy: this.options.proxy,
|
|
45
|
+
debug: this.options.debug,
|
|
44
46
|
});
|
|
45
47
|
/** Create ClientData to store and handle auth data */
|
|
46
48
|
this.data = new types_2.ClientData(this);
|
|
@@ -68,6 +70,7 @@ class Client extends shared_1.Emitter {
|
|
|
68
70
|
this.packetCompressor = new shared_1.PacketCompressor(this);
|
|
69
71
|
this.handleGamePackets();
|
|
70
72
|
this.raknet.on("encapsulated", this.handleEncapsulated.bind(this));
|
|
73
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
71
74
|
const request = new protocol_1.RequestNetworkSettingsPacket();
|
|
72
75
|
request.protocol = types_1.ProtocolList[types_1.CurrentVersionConst];
|
|
73
76
|
this.send(request);
|
|
@@ -194,6 +197,50 @@ class Client extends shared_1.Emitter {
|
|
|
194
197
|
this.on("DisconnectPacket", (packet) => {
|
|
195
198
|
this.disconnect(packet.message.message ?? undefined);
|
|
196
199
|
});
|
|
200
|
+
// Respawn handling
|
|
201
|
+
this.on("ActorEventPacket", async (packet) => {
|
|
202
|
+
if (packet.actorRuntimeId !== this.startGameData.runtimeEntityId ||
|
|
203
|
+
packet.event !== protocol_1.ActorEvent.Death)
|
|
204
|
+
return;
|
|
205
|
+
// Wait a bit before requesting respawn
|
|
206
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
207
|
+
const respawn = new protocol_1.RespawnPacket();
|
|
208
|
+
respawn.state = protocol_1.RespawnState.ClientReadyToSpawn;
|
|
209
|
+
respawn.position = new protocol_1.Vector3f(0, 0, 0);
|
|
210
|
+
respawn.runtimeEntityId = packet.actorRuntimeId;
|
|
211
|
+
this.send(respawn);
|
|
212
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
213
|
+
const action = new protocol_1.PlayerActionPacket();
|
|
214
|
+
action.action = protocol_1.PlayerActionType.Respawn;
|
|
215
|
+
action.blockPosition = new protocol_1.Vector3f(0, 0, 0);
|
|
216
|
+
action.resultPosition = new protocol_1.Vector3f(0, 0, 0);
|
|
217
|
+
action.face = -1;
|
|
218
|
+
action.entityRuntimeId = this.startGameData.runtimeEntityId;
|
|
219
|
+
this.send(action);
|
|
220
|
+
});
|
|
221
|
+
this.on("RespawnPacket", (packet) => {
|
|
222
|
+
if (packet.state !== protocol_1.RespawnState.ServerReadyToSpawn)
|
|
223
|
+
return;
|
|
224
|
+
const request = new protocol_1.RequestChunkRadiusPacket();
|
|
225
|
+
request.maxRadius = this.options.viewDistance;
|
|
226
|
+
request.radius = this.options.viewDistance;
|
|
227
|
+
this.send(request);
|
|
228
|
+
const screen1 = new protocol_1.ServerboundLoadingScreenPacketPacket();
|
|
229
|
+
screen1.hasScreenId = false;
|
|
230
|
+
screen1.type = protocol_1.ServerboundLoadingScreenType.StartLoadingScreen;
|
|
231
|
+
this.send(screen1);
|
|
232
|
+
const action = new protocol_1.PlayerActionPacket();
|
|
233
|
+
action.action = protocol_1.PlayerActionType.Respawn;
|
|
234
|
+
action.entityRuntimeId = this.startGameData.runtimeEntityId;
|
|
235
|
+
action.blockPosition = new protocol_1.Vector3f(0, 0, 0);
|
|
236
|
+
action.resultPosition = new protocol_1.Vector3f(0, 0, 0);
|
|
237
|
+
action.face = -1;
|
|
238
|
+
this.send(action);
|
|
239
|
+
const screen2 = new protocol_1.ServerboundLoadingScreenPacketPacket();
|
|
240
|
+
screen2.hasScreenId = false;
|
|
241
|
+
screen2.type = protocol_1.ServerboundLoadingScreenType.EndLoadingScreen;
|
|
242
|
+
this.send(screen2);
|
|
243
|
+
});
|
|
197
244
|
}
|
|
198
245
|
disconnect(reason) {
|
|
199
246
|
if (this.status === raknet_1.ConnectionStatus.Disconnected)
|
|
@@ -45,6 +45,7 @@ const login_data_1 = require("./login-data");
|
|
|
45
45
|
const skin_loader_1 = require("../skin-loader");
|
|
46
46
|
const PUBLIC_KEY = "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAECRXueJeTDqNRRgJi/vlRufByu/2G0i2Ebt6YMar5QX/R0DIIyrJMcUpruK4QveTfJSTp3Shlq4Gk34cD/4GUWwkv0DVuzeuB+tXija7HBxii03NHDbPAD0AKnLr2wdAp";
|
|
47
47
|
const algorithm = "ES384";
|
|
48
|
+
const UUID_NAMESPACE = (0, node_crypto_1.randomUUID)();
|
|
48
49
|
class ClientData {
|
|
49
50
|
constructor(client) {
|
|
50
51
|
/** This tells the jwt to use legacy auth */
|
|
@@ -184,7 +185,7 @@ class ClientData {
|
|
|
184
185
|
}
|
|
185
186
|
static nextUUID(username) {
|
|
186
187
|
return (0, uuid_1345_1.v3)({
|
|
187
|
-
namespace:
|
|
188
|
+
namespace: UUID_NAMESPACE,
|
|
188
189
|
name: username,
|
|
189
190
|
});
|
|
190
191
|
}
|
|
@@ -45,6 +45,8 @@ export type ClientOptions = {
|
|
|
45
45
|
compressionMethod: CompressionMethod;
|
|
46
46
|
/** Whether to emit unknown packets as buffer */
|
|
47
47
|
emitUnknownPackets: boolean;
|
|
48
|
+
/** Enable debug logging */
|
|
49
|
+
debug?: boolean;
|
|
48
50
|
/** Email for direct email/password authentication (requires 2FA disabled) */
|
|
49
51
|
email?: string;
|
|
50
52
|
/** Password for direct email/password authentication (requires 2FA disabled) */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baltica",
|
|
3
3
|
"description": "Library for Minecraft Bedrock Edition community developers.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.30",
|
|
5
5
|
"minecraft": "1.21.130",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"license": "MIT",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@sanctumterra/raknet": "
|
|
24
|
+
"@sanctumterra/raknet": "^1.4.17",
|
|
25
25
|
"@serenityjs/binarystream": "^3.1.0",
|
|
26
26
|
"@serenityjs/protocol": "^0.8.17",
|
|
27
27
|
"fetch-socks": "^1.3.2",
|
|
28
28
|
"jose": "^5.10.0",
|
|
29
29
|
"prismarine-auth": "^2.7.0",
|
|
30
|
-
"undici": "^7.
|
|
30
|
+
"undici": "^7.21.0",
|
|
31
31
|
"uuid-1345": "^1.0.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@biomejs/biome": "1.9.4",
|
|
35
|
-
"@types/node": "^22.19.
|
|
35
|
+
"@types/node": "^22.19.10",
|
|
36
36
|
"@types/pngjs": "^6.0.5",
|
|
37
37
|
"@types/uuid-1345": "^0.99.25",
|
|
38
38
|
"pngjs": "^7.0.0",
|