@vaitosoi/minejs 0.4.0 → 0.4.2
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/README.md +24 -19
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ This is a Minecraft client package, written entirely in Typescript, using NodeJS
|
|
|
10
10
|
|
|
11
11
|
This package is highly unstable for now, please report if there is any bug, glitch.
|
|
12
12
|
|
|
13
|
+
Also, since there is some problem with authenticating and appId approval, you can not let the bot join "online server yet". [See more here](#iv-about-joining-online-server)
|
|
14
|
+
|
|
13
15
|
## II. Usage
|
|
14
16
|
|
|
15
17
|
Install MineJS using your favorite package manager:
|
|
@@ -22,23 +24,22 @@ Then write a simple code like this:
|
|
|
22
24
|
|
|
23
25
|
```typescript
|
|
24
26
|
// index.ts
|
|
25
|
-
import {
|
|
27
|
+
import { Input, Client } from "@vaitosoi/minejs";
|
|
26
28
|
|
|
27
29
|
const client = new Client({
|
|
28
30
|
playerName: "bot",
|
|
29
31
|
host: "localhost",
|
|
30
32
|
port: 25565,
|
|
31
33
|
version: "26.2",
|
|
32
|
-
// debug: {
|
|
33
|
-
// packetLogger: true
|
|
34
|
-
// },
|
|
35
|
-
isOffline: true,
|
|
36
34
|
loadRegistry: false,
|
|
37
35
|
// auth: {
|
|
38
36
|
// client_id: "d86254d8-edf7-4640-90eb-643c99af188e",
|
|
39
37
|
// method: "loopback",
|
|
40
|
-
// openBrowser: true
|
|
41
|
-
//
|
|
38
|
+
// openBrowser: true,
|
|
39
|
+
// port: 12345
|
|
40
|
+
// },
|
|
41
|
+
shouldVerifyMessageOrder: true,
|
|
42
|
+
shouldVerifyMessageSignature: true
|
|
42
43
|
});
|
|
43
44
|
client.connect();
|
|
44
45
|
client.on("disconnect", (...args) => console.dir({ name: "disconnect", args }, { depth: null }));
|
|
@@ -58,18 +59,22 @@ client.on("message", (message) => {
|
|
|
58
59
|
if (!message.content.startsWith("_")) return;
|
|
59
60
|
const args = message.content.slice(1).split(" ");
|
|
60
61
|
switch (args[0]) {
|
|
61
|
-
case "w": client.hold(
|
|
62
|
-
case "sw": client.release(
|
|
62
|
+
case "w": client.hold(Input.Forward); break;
|
|
63
|
+
case "sw": client.release(Input.Forward); break;
|
|
63
64
|
case "ws":
|
|
64
|
-
client.hold(
|
|
65
|
+
client.hold(Input.Forward);
|
|
65
66
|
setTimeout(() => client.disconnect(), 2000);
|
|
66
67
|
break;
|
|
67
|
-
case "s": client.hold(
|
|
68
|
-
case "ss": client.release(
|
|
69
|
-
case "a": client.hold(
|
|
70
|
-
case "sa": client.release(
|
|
71
|
-
case "d": client.hold(
|
|
72
|
-
case "sd": client.release(
|
|
68
|
+
case "s": client.hold(Input.Backward); break;
|
|
69
|
+
case "ss": client.release(Input.Backward); break;
|
|
70
|
+
case "a": client.hold(Input.Left); break;
|
|
71
|
+
case "sa": client.release(Input.Left); break;
|
|
72
|
+
case "d": client.hold(Input.Right); break;
|
|
73
|
+
case "sd": client.release(Input.Right); break;
|
|
74
|
+
case "j": client.hold(Input.Jump); break;
|
|
75
|
+
case "sj": client.release(Input.Jump); break;
|
|
76
|
+
case "run": client.hold(Input.Sprint); break;
|
|
77
|
+
case "srun": client.release(Input.Sprint); break;
|
|
73
78
|
case "stop": client.stopMoving(); break;
|
|
74
79
|
|
|
75
80
|
case "at": {
|
|
@@ -80,7 +85,7 @@ client.on("message", (message) => {
|
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
case "disconnect":
|
|
83
|
-
case "exit":
|
|
88
|
+
case "exit":
|
|
84
89
|
client.disconnect();
|
|
85
90
|
break;
|
|
86
91
|
}
|
|
@@ -97,6 +102,6 @@ npm tsx index.ts
|
|
|
97
102
|
|
|
98
103
|
See [documentation](https://minejs.vaito.dev)
|
|
99
104
|
|
|
100
|
-
## IV.
|
|
105
|
+
## IV. About joining online server:
|
|
101
106
|
|
|
102
|
-
|
|
107
|
+
In order to join "online server" (the server require an account that have purchased Minecraft, to distinguish with the "offiline server", where you don't have to purchase Minecraft), you have to send some request to Minecraft server, which require an approved Azure App (more info in [here](https://minecraft.wiki/w/Microsoft_authentication#Microsoft_OAuth2_flow) and [here](https://help.minecraft.net/hc/en-us/articles/16254801392141p)), which I don't have at the moment. So I can not fully test the "join online server" feature right now. But still, if you somehow got an approved app and found some bug, please [create a issue](https://github.com/VaitoSoi/minejs/issues/new)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaitosoi/minejs",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "A Minecraft client package",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,9 +24,6 @@
|
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=22"
|
|
26
26
|
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"prepare": "eslint . --fix && tsc --noEmit"
|
|
29
|
-
},
|
|
30
27
|
"devDependencies": {
|
|
31
28
|
"@clean-jsdoc-theme/typedoc": "5.0.5",
|
|
32
29
|
"@eslint/js": "^10.0.1",
|