diff --git a/docs/mineflayer.ipynb b/docs/mineflayer.ipynb index 095536bfb..d4be09d7e 100644 --- a/docs/mineflayer.ipynb +++ b/docs/mineflayer.ipynb @@ -36,7 +36,7 @@ "source": [ "# Using mineflayer in Python\n", "\n", - "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", + "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", "\n", "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." ] @@ -56,32 +56,35 @@ "id": "K2ol06QOhL6s" }, "source": [ - "First, make sure you have Python version 3.7 and Node.js version 14 or newer installed" + "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:" ] }, { "cell_type": "code", + "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "8zCSpx8Bif5m", - "outputId": "f8888a33-03e7-4497-9776-ef6c34d9d337" + "outputId": "90ebac14-fc75-4136-f81d-34c5b2033da0" }, - "source": [ - "!python --version\n", - "!node --version" - ], - "execution_count": null, "outputs": [ { + "name": "stdout", "output_type": "stream", "text": [ - "Python 3.7.11\n", - "v14.16.0\n" - ], - "name": "stdout" + "v18.17.1\n", + "Python 3.10.12\n" + ] } + ], + "source": [ + "# Use `n` to install nodejs 18, if it's not already installed:\n", + "!curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts > /dev/null\n", + "# Now write the Node.js and Python version to the console\n", + "!node --version\n", + "!python --version" ] }, { @@ -121,7 +124,7 @@ "source": [ "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", "\n", - "You may notice the extra imports : On, Once, off and AsyncTask. These will be discussed later on. \n", + "You may notice the extra imports : On, Once, off and AsyncTask. These will be discussed later on.\n", "\n", "\n" ] @@ -170,21 +173,21 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": { "id": "1gfZSAUCDVMg" }, + "outputs": [], "source": [ "random_number = id([]) % 1000 # Give us a random number upto 1000\n", "BOT_USERNAME = f'colab_{random_number}'\n", "\n", - "bot = mineflayer.createBot({ 'host': '95.111.249.143', 'port': 10000, 'username': BOT_USERNAME, 'hideErrors': False })\n", + "bot = mineflayer.createBot({ 'host': 'pjs.deptofcraft.com', 'port': 25565, 'username': BOT_USERNAME, 'hideErrors': False })\n", "\n", - "# The spawn event \n", + "# The spawn event\n", "once(bot, 'login')\n", "bot.chat('I spawned')" - ], - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "markdown",