Compare commits
No commits in common. "af9cc4b54602c6b1da4cc995d7a29fd13612280a" and "1c0824a167c3621dc52fbbed580684670a2fe01c" have entirely different histories.
af9cc4b546
...
1c0824a167
10
README.md
10
README.md
|
@ -6,21 +6,13 @@ Mosfet is able to farm wood by cutting trees, gather sand, gather netherwart,
|
||||||
and trade with villagers to get emeralds. He can eat, sleep, and flee from
|
and trade with villagers to get emeralds. He can eat, sleep, and flee from
|
||||||
threats.
|
threats.
|
||||||
|
|
||||||
## Requirements
|
|
||||||
- Python >= 3.8
|
|
||||||
- pip
|
|
||||||
- virtualenv
|
|
||||||
- git
|
|
||||||
- wget
|
|
||||||
- unzip
|
|
||||||
|
|
||||||
## Linux Setup
|
## Linux Setup
|
||||||
|
|
||||||
Assuming Debian / Ubuntu based distro:
|
Assuming Debian / Ubuntu based distro:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo apt update
|
$ sudo apt update
|
||||||
$ sudo apt install build-essential python3 python3-dev python3-pip python3-virtualenv virtualenv git wget unzip
|
$ sudo apt install build-essential python3 python3-dev python3-pip python3-virtualenv git wget unzip
|
||||||
|
|
||||||
$ git clone https://git.tannercollin.com/tanner/minecraft-bot.git
|
$ git clone https://git.tannercollin.com/tanner/minecraft-bot.git
|
||||||
$ cd minecraft-bot/
|
$ cd minecraft-bot/
|
||||||
|
|
|
@ -3,15 +3,14 @@ if __name__ == '__main__':
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import importlib
|
import importlib
|
||||||
from math import floor, ceil
|
from math import floor, ceil
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
|
||||||
USERNAME = os.getenv('USERNAME')
|
USERNAME = os.environ['USERNAME']
|
||||||
PASSWORD = os.getenv('PASSWORD')
|
PASSWORD = os.environ['PASSWORD']
|
||||||
SERVER = os.getenv('SERVER')
|
SERVER = os.environ['SERVER']
|
||||||
PORT = int(os.environ.get('PORT', 25565))
|
PORT = int(os.environ.get('PORT', 25565))
|
||||||
|
|
||||||
from . import monkey_patch # must be before any possible pyCraft imports
|
from . import monkey_patch # must be before any possible pyCraft imports
|
||||||
|
@ -250,11 +249,7 @@ def bot(global_state):
|
||||||
if not g.mcdata:
|
if not g.mcdata:
|
||||||
g.mcdata = DataManager('./minecraft_data')
|
g.mcdata = DataManager('./minecraft_data')
|
||||||
|
|
||||||
if not SERVER:
|
if not g.connection:
|
||||||
print('You must specify a server to connect to.')
|
|
||||||
sys.exit()
|
|
||||||
elif not g.connection:
|
|
||||||
if USERNAME and PASSWORD:
|
|
||||||
auth_token = authentication.AuthenticationToken()
|
auth_token = authentication.AuthenticationToken()
|
||||||
try:
|
try:
|
||||||
auth_token.authenticate(USERNAME, PASSWORD)
|
auth_token.authenticate(USERNAME, PASSWORD)
|
||||||
|
@ -263,9 +258,6 @@ def bot(global_state):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
print("Logged in as %s..." % auth_token.username)
|
print("Logged in as %s..." % auth_token.username)
|
||||||
g.connection = Connection(SERVER, PORT, auth_token=auth_token)
|
g.connection = Connection(SERVER, PORT, auth_token=auth_token)
|
||||||
elif USERNAME:
|
|
||||||
print('No password provided, attempting to connect in offline mode...')
|
|
||||||
g.connection = Connection(SERVER, PORT, username=USERNAME)
|
|
||||||
|
|
||||||
g.chunks = ChunksManager(g.mcdata)
|
g.chunks = ChunksManager(g.mcdata)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user