|
|
|
@ -14,6 +14,7 @@ SERVER = os.environ['SERVER'] |
|
|
|
|
import monkey_patch # must be before any possible pyCraft imports |
|
|
|
|
|
|
|
|
|
from custom.managers import DataManager, ChunksManager, ChatManager |
|
|
|
|
from custom.managers.chunks import ChunkNotLoadedException |
|
|
|
|
|
|
|
|
|
from minecraft import authentication |
|
|
|
|
from minecraft.exceptions import YggdrasilError |
|
|
|
@ -53,7 +54,7 @@ def tick(global_state): |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
g.chunks.get_block_at(*utils.pint(p)) |
|
|
|
|
except chunks.ChunkNotLoadedException: |
|
|
|
|
except ChunkNotLoadedException: |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
#l.jobstate.run() |
|
|
|
@ -161,7 +162,7 @@ def bot(global_state): |
|
|
|
|
g = global_state |
|
|
|
|
g.local_state = Bunch() |
|
|
|
|
|
|
|
|
|
if 'mcdata' not in g: |
|
|
|
|
if not g.mcdata: |
|
|
|
|
g.mcdata = DataManager('./mcdata') |
|
|
|
|
|
|
|
|
|
if not g.connection: |
|
|
|
@ -175,7 +176,6 @@ def bot(global_state): |
|
|
|
|
g.connection = Connection(SERVER, 25565, auth_token=auth_token) |
|
|
|
|
|
|
|
|
|
g.chunks = ChunksManager(g.mcdata) |
|
|
|
|
g.chunks.register(g.connection) |
|
|
|
|
|
|
|
|
|
g.connection.connect() |
|
|
|
|
|
|
|
|
@ -184,6 +184,8 @@ def bot(global_state): |
|
|
|
|
handler(packet, g) |
|
|
|
|
return wrapper |
|
|
|
|
|
|
|
|
|
g.chunks.register(g.connection) |
|
|
|
|
|
|
|
|
|
h1 = packet_wrapper(packet_handlers.handle_join_game) |
|
|
|
|
g.connection.register_packet_listener(h1, clientbound.play.JoinGamePacket) |
|
|
|
|
|
|
|
|
|