mineflayer 4.32.0 → 4.33.0
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/.github/helper/package.json +5 -0
- package/.github/helper/updator.js +85 -0
- package/.github/workflows/handle-update.yml +54 -0
- package/README.md +1 -1
- package/docs/README.md +1 -1
- package/docs/history.md +4 -0
- package/lib/version.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Updator script triggered from minecraft-data repository to auto generate PR
|
|
4
|
+
*/
|
|
5
|
+
const fs = require('fs')
|
|
6
|
+
const cp = require('child_process')
|
|
7
|
+
const assert = require('assert')
|
|
8
|
+
const github = require('gh-helpers')()
|
|
9
|
+
const { join } = require('path')
|
|
10
|
+
const exec = (cmd) => github.mock ? console.log('> ', cmd) : (console.log('> ', cmd), cp.execSync(cmd, { stdio: 'inherit' }))
|
|
11
|
+
|
|
12
|
+
console.log('Starting update process...')
|
|
13
|
+
// Sanitize and validate environment variables all non alpha numeric / underscore / dot
|
|
14
|
+
const newVersion = process.env.NEW_MC_VERSION?.replace(/[^a-zA-Z0-9_.]/g, '_')
|
|
15
|
+
const triggerBranch = process.env.MCDATA_BRANCH?.replace(/[^a-zA-Z0-9_.]/g, '_')
|
|
16
|
+
const mcdataPrURL = process.env.MCDATA_PR_URL
|
|
17
|
+
console.log({ newVersion, triggerBranch, mcdataPrURL })
|
|
18
|
+
|
|
19
|
+
assert(newVersion)
|
|
20
|
+
assert(triggerBranch)
|
|
21
|
+
|
|
22
|
+
async function main () {
|
|
23
|
+
const currentSupportedPath = require.resolve('../../lib/version.js')
|
|
24
|
+
const readmePath = join(__dirname, '../../docs/README.md')
|
|
25
|
+
const ciPath = join(__dirname, '../../.github/workflows/ci.yml')
|
|
26
|
+
|
|
27
|
+
// Update the version.js
|
|
28
|
+
const currentSupportedVersion = require('../../lib/version.js')
|
|
29
|
+
const currentContents = fs.readFileSync(currentSupportedPath, 'utf8')
|
|
30
|
+
console.log('Current supported version:', currentContents)
|
|
31
|
+
const latestV = currentSupportedVersion.testedVersions.at(-1)
|
|
32
|
+
const newContents = currentContents.includes(newVersion)
|
|
33
|
+
? currentContents
|
|
34
|
+
: currentContents
|
|
35
|
+
.replace(`, '${latestV}'`, `, '${latestV}', '${newVersion}'`)
|
|
36
|
+
|
|
37
|
+
// Update the README.md
|
|
38
|
+
const currentContentsReadme = fs.readFileSync(readmePath, 'utf8')
|
|
39
|
+
if (!currentContentsReadme.includes(newVersion)) {
|
|
40
|
+
const newReadmeContents = currentContentsReadme
|
|
41
|
+
.replace(/Minecraft 1\.8 to [0-9A-Za-z._-]+ \(/, `Minecraft 1.8 to ${newVersion} (`)
|
|
42
|
+
.replace(') <!--version-->', `, ${newVersion}) <!--version-->`)
|
|
43
|
+
fs.writeFileSync(readmePath, newReadmeContents)
|
|
44
|
+
console.log('Updated README with new version:', newVersion)
|
|
45
|
+
}
|
|
46
|
+
fs.writeFileSync(currentSupportedPath, newContents)
|
|
47
|
+
|
|
48
|
+
// Update the CI workflow
|
|
49
|
+
const currentContentsCI = fs.readFileSync(ciPath, 'utf8')
|
|
50
|
+
if (!currentContentsCI.includes(newVersion)) {
|
|
51
|
+
const newCIContents = currentContentsCI.replace(
|
|
52
|
+
'run: npm install', `run: npm install
|
|
53
|
+
- run: cd node_modules && cd minecraft-data && mv minecraft-data minecraft-data-old && git clone -b ${triggerBranch} https://github.com/PrismarineJS/minecraft-data --depth 1 && node bin/generate_data.js
|
|
54
|
+
- run: curl -o node_modules/protodef/src/serializer.js https://raw.githubusercontent.com/extremeheat/node-protodef/refs/heads/dlog/src/serializer.js && curl -o node_modules/protodef/src/compiler.js https://raw.githubusercontent.com/extremeheat/node-protodef/refs/heads/dlog/src/compiler.js
|
|
55
|
+
`)
|
|
56
|
+
fs.writeFileSync(ciPath, newCIContents)
|
|
57
|
+
console.log('Updated CI workflow with new version:', newVersion)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const branchName = 'pc' + newVersion.replace(/[^a-zA-Z0-9_]/g, '_')
|
|
61
|
+
exec(`git checkout -b ${branchName}`)
|
|
62
|
+
exec('git config user.name "github-actions[bot]"')
|
|
63
|
+
exec('git config user.email "41898282+github-actions[bot]@users.noreply.github.com"')
|
|
64
|
+
exec('git add --all')
|
|
65
|
+
exec(`git commit -m "Update to version ${newVersion}"`)
|
|
66
|
+
exec(`git push origin ${branchName} --force`)
|
|
67
|
+
// createPullRequest(title: string, body: string, fromBranch: string, intoBranch?: string): Promise<{ number: number, url: string }>;
|
|
68
|
+
const pr = await github.createPullRequest(
|
|
69
|
+
`🎈 ${newVersion}`,
|
|
70
|
+
`This automated PR sets up the relevant boilerplate for Minecraft version ${newVersion}.
|
|
71
|
+
|
|
72
|
+
Ref: ${mcdataPrURL}
|
|
73
|
+
|
|
74
|
+
* You can help contribute to this PR by opening a PR against this <code branch>${branchName}</code> branch instead of <code>master</code>.
|
|
75
|
+
`,
|
|
76
|
+
branchName,
|
|
77
|
+
'master'
|
|
78
|
+
)
|
|
79
|
+
console.log(`Pull request created`, pr)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
main().catch(err => {
|
|
83
|
+
console.error('Error during update process:', err)
|
|
84
|
+
process.exit(1)
|
|
85
|
+
})
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Update from minecraft-data
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
new_mc_version:
|
|
7
|
+
description: New minecraft version number
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
mcdata_branch:
|
|
11
|
+
description: minecraft-data branch for this version
|
|
12
|
+
required: true
|
|
13
|
+
type: string
|
|
14
|
+
mcdata_pr_url:
|
|
15
|
+
description: minecraft-data PR number to open a PR here against
|
|
16
|
+
required: false
|
|
17
|
+
default: ''
|
|
18
|
+
type: string
|
|
19
|
+
nmp_branch:
|
|
20
|
+
description: minecraft-protocol branch for this version
|
|
21
|
+
required: true
|
|
22
|
+
type: string
|
|
23
|
+
nmp_pr_url:
|
|
24
|
+
description: minecraft-protocol PR number to open a PR here against
|
|
25
|
+
required: false
|
|
26
|
+
default: ''
|
|
27
|
+
type: string
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
update:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
- name: Checkout repository
|
|
35
|
+
uses: actions/checkout@v4
|
|
36
|
+
with:
|
|
37
|
+
token: ${{ secrets.PAT_PASSWORD }}
|
|
38
|
+
|
|
39
|
+
- name: Use Node.js 22.x
|
|
40
|
+
uses: actions/setup-node@v1.4.4
|
|
41
|
+
with:
|
|
42
|
+
node-version: 22.x
|
|
43
|
+
|
|
44
|
+
- run: npm install PrismarineJS/node-minecraft-protocol#${{ github.event.inputs.nmp_branch }}
|
|
45
|
+
|
|
46
|
+
- name: Run updator script
|
|
47
|
+
run: cd .github/helper && npm install && node updator.js
|
|
48
|
+
env:
|
|
49
|
+
GITHUB_TOKEN: ${{ secrets.PAT_PASSWORD }}
|
|
50
|
+
NEW_MC_VERSION: ${{ github.event.inputs.new_mc_version }}
|
|
51
|
+
MCDATA_BRANCH: ${{ github.event.inputs.mcdata_branch }}
|
|
52
|
+
MCDATA_PR_URL: ${{ github.event.inputs.mcdata_pr_url }}
|
|
53
|
+
NMP_BRANCH: ${{ github.event.inputs.nmp_branch }}
|
|
54
|
+
NMP_PR_URL: ${{ github.event.inputs.nmp_pr_url }}
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ First time using Node.js? You may want to start with the [tutorial](tutorial.md)
|
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
* Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20,
|
|
20
|
+
* Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21) <!--version-->
|
|
21
21
|
* Entity knowledge and tracking.
|
|
22
22
|
* Block knowledge. You can query the world around you. Milliseconds to find any block.
|
|
23
23
|
* Physics and movement - handle all bounding boxes
|
package/docs/README.md
CHANGED
|
@@ -17,7 +17,7 @@ First time using Node.js? You may want to start with the [tutorial](tutorial.md)
|
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
* Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20,
|
|
20
|
+
* Supports Minecraft 1.8 to 1.21 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21) <!--version-->
|
|
21
21
|
* Entity knowledge and tracking.
|
|
22
22
|
* Block knowledge. You can query the world around you. Milliseconds to find any block.
|
|
23
23
|
* Physics and movement - handle all bounding boxes
|
package/docs/history.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 4.33.0
|
|
2
|
+
* [Add update workflow (#3727)](https://github.com/PrismarineJS/mineflayer/commit/9c335366d435b58cfe45bbfbbc534b99ee669dc2) (thanks @extremeheat)
|
|
3
|
+
* [Add support for Minecraft 1.21.8 (#3732)](https://github.com/PrismarineJS/mineflayer/commit/ec8220d7c63b72acb4bf16f30cdf4ba346b83f98) (thanks @rom1504)
|
|
4
|
+
|
|
1
5
|
## 4.32.0
|
|
2
6
|
* [1.21.6 (#3713)](https://github.com/PrismarineJS/mineflayer/commit/01f537c394fc78bf2e765b28a8b24a30c1d1fd2e) (thanks @extremeheat)
|
|
3
7
|
* [Fix knockback physics crash (#3715)](https://github.com/PrismarineJS/mineflayer/commit/e3f89d17418ece9e9fac4b111d8243dfe1a5d376) (thanks @Omena0)
|
package/lib/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21.1', '1.21.3', '1.21.4', '1.21.5', '1.21.6']
|
|
1
|
+
const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21.1', '1.21.3', '1.21.4', '1.21.5', '1.21.6', '1.21.8']
|
|
2
2
|
module.exports = {
|
|
3
3
|
|
|
4
4
|
testedVersions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mineflayer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.33.0",
|
|
4
4
|
"description": "create minecraft bots with a stable, high level API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"minecraft-data": "^3.
|
|
25
|
-
"minecraft-protocol": "^1.
|
|
24
|
+
"minecraft-data": "^3.98.0",
|
|
25
|
+
"minecraft-protocol": "^1.61.0",
|
|
26
26
|
"prismarine-biome": "^1.1.1",
|
|
27
27
|
"prismarine-block": "^1.22.0",
|
|
28
28
|
"prismarine-chat": "^1.7.1",
|