Fix gapple bugs and unload far chunks

This commit is contained in:
2020-09-25 15:51:36 -06:00
parent 25ce916b43
commit fa9d597483
5 changed files with 62 additions and 15 deletions

11
bot.py
View File

@@ -51,12 +51,13 @@ def tick(global_state):
target = None
try:
g.chunks.get_block_at(*utils.pint(p))
except ChunkNotLoadedException:
# make sure current chunks are loaded for physics
if not g.chunks.check_loaded(p, 9):
packet = serverbound.play.PositionAndLookPacket(x=p.x, feet_y=p.y, z=p.z, pitch=0, yaw=0, on_ground=True)
g.connection.write_packet(packet, force=True)
return
#g.jobstate.run()
g.chunks.unload_chunks(p)
if g.path and len(g.path):
target = LPoint3f(g.path[0])
@@ -194,7 +195,7 @@ def bot(global_state):
time.sleep(utils.TICK)
print('Player loaded.')
while not g.chunks.check_loaded(g.pos):
while not g.chunks.check_loaded(g.pos, 529):
time.sleep(utils.TICK)
print('Chunks loaded.')