Skip to content

Commit e8a967d

Browse files
authored
Update Jupyter notebook to install node 18, update the server in example (#3176)
* Update Jupyter notebook to install node 18, update the server in example * revert unintended metadata changes
1 parent d4db399 commit e8a967d

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

docs/mineflayer.ipynb

+21-18
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"source": [
3737
"# Using mineflayer in Python\n",
3838
"\n",
39-
"This is a tutorial on how to use mineflayer in Python. This example will connect you to the PrismarineJS test server. You can join it with prismarine-viewer or your Minecraft client at server IP **95.111.249.143:10000**.\n",
39+
"This is a tutorial on how to use mineflayer in Python. This example will connect you to the PrismarineJS test server. You can join it with prismarine-viewer or your Minecraft client at server IP **pjs.deptofcraft.com:25565**.\n",
4040
"\n",
4141
"If you're new to Jupyter Notebooks, you can press the \"Play\" button at the left of each code block to run it. Make sure that you run the blocks in a correct order."
4242
]
@@ -56,32 +56,35 @@
5656
"id": "K2ol06QOhL6s"
5757
},
5858
"source": [
59-
"First, make sure you have Python version 3.7 and Node.js version 14 or newer installed"
59+
"First, make sure you have Python version 3.10 and Node.js version 18 or newer installed. You can get Node.js 18 it from https://nodejs.org/en/download or use [Node.js version managers](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#using-a-node-version-manager-to-install-nodejs-and-npm) like [`nvm`](https://github.com/creationix/nvm) or [`n`](https://github.com/tj/n) to install via the command line. Here we'll use `n` to install Node.js v18, then check our Node and Python versions:"
6060
]
6161
},
6262
{
6363
"cell_type": "code",
64+
"execution_count": 1,
6465
"metadata": {
6566
"colab": {
6667
"base_uri": "https://localhost:8080/"
6768
},
6869
"id": "8zCSpx8Bif5m",
69-
"outputId": "f8888a33-03e7-4497-9776-ef6c34d9d337"
70+
"outputId": "90ebac14-fc75-4136-f81d-34c5b2033da0"
7071
},
71-
"source": [
72-
"!python --version\n",
73-
"!node --version"
74-
],
75-
"execution_count": null,
7672
"outputs": [
7773
{
74+
"name": "stdout",
7875
"output_type": "stream",
7976
"text": [
80-
"Python 3.7.11\n",
81-
"v14.16.0\n"
82-
],
83-
"name": "stdout"
77+
"v18.17.1\n",
78+
"Python 3.10.12\n"
79+
]
8480
}
81+
],
82+
"source": [
83+
"# Use `n` to install nodejs 18, if it's not already installed:\n",
84+
"!curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts > /dev/null\n",
85+
"# Now write the Node.js and Python version to the console\n",
86+
"!node --version\n",
87+
"!python --version"
8588
]
8689
},
8790
{
@@ -121,7 +124,7 @@
121124
"source": [
122125
"If all is well, we can import the `javascript` library. We can then import the `require` function which works similarly to the `require` function in Node.js, but does the dependency management for us.\n",
123126
"\n",
124-
"You may notice the extra imports : On, Once, off and AsyncTask. These will be discussed later on. \n",
127+
"You may notice the extra imports : On, Once, off and AsyncTask. These will be discussed later on.\n",
125128
"\n",
126129
"\n"
127130
]
@@ -170,21 +173,21 @@
170173
},
171174
{
172175
"cell_type": "code",
176+
"execution_count": null,
173177
"metadata": {
174178
"id": "1gfZSAUCDVMg"
175179
},
180+
"outputs": [],
176181
"source": [
177182
"random_number = id([]) % 1000 # Give us a random number upto 1000\n",
178183
"BOT_USERNAME = f'colab_{random_number}'\n",
179184
"\n",
180-
"bot = mineflayer.createBot({ 'host': '95.111.249.143', 'port': 10000, 'username': BOT_USERNAME, 'hideErrors': False })\n",
185+
"bot = mineflayer.createBot({ 'host': 'pjs.deptofcraft.com', 'port': 25565, 'username': BOT_USERNAME, 'hideErrors': False })\n",
181186
"\n",
182-
"# The spawn event \n",
187+
"# The spawn event\n",
183188
"once(bot, 'login')\n",
184189
"bot.chat('I spawned')"
185-
],
186-
"execution_count": null,
187-
"outputs": []
190+
]
188191
},
189192
{
190193
"cell_type": "markdown",

0 commit comments

Comments
 (0)