Categories
Programare Minecraft in Python

Programare Minecraft Python: Creare Bot

First step: install Visual Studio Code; Search for it in google, download it and install it for free

Second step : node.js; again, search, download and install

Start Visual Studio Code; click “Open folder…” and select the the place where we put our coding files

Create a new folder, name it and select it; open a new Terminal window; write the command “npm install mineflayer” and press “Enter”

mineflayer is the module used for creating minecraft bots and this is the way to install it

next command , “npm init -y” , prepares the created folder for coding; create the first program, new file, and save it with the name: index.js

Write the first line of code : tell to minecraft that the next program will require mineflayer module

Coose a proper word in the left side of “=”, we will use this word later for a lot of bot actions
first bot action is it’s creation, using “createBot” command; like any other player he needs a minecraft server address (host) and a username

this is our first program for the minecraft bot; run it using the command from the terminal window “node index.js”

the program has something wrong in it, because we don’t see the bot creation

“mineflayer” word must be replaced with the word chosen in the first line, now with “minecraft1″Save the modifications with CTRL-S or File-Save and run again the command in the terminal window
in Minecraft our first bot, gigi, is ready for action !