Clear leaves when low on saplings

This commit is contained in:
2020-10-17 23:35:43 -06:00
parent 69b0c057d6
commit 90388cf110
3 changed files with 134 additions and 50 deletions

5
bot.py
View File

@@ -61,6 +61,7 @@ def tick(global_state):
g.chunks.unload_chunks(p)
########## object physics ##########
# note: it's possible the chunk data is out of date when this runs
for eid, obj in copy(g.objects).items():
if obj.velocity_x:
@@ -84,8 +85,8 @@ def tick(global_state):
obj.velocity_z *= 0.5
# float object back up in case it clipped through multiple blocks
while g.chunks.get_block_at(floor(obj.x), floor(obj.y), floor(obj.z)) not in blocks.NON_SOLID_IDS:
obj.y += 1
if g.chunks.get_block_at(floor(obj.x), floor(obj.y), floor(obj.z)) not in blocks.NON_SOLID_IDS:
obj.y += 0.05
if abs(obj.velocity_x) < 1: obj.velocity_x = 0
if abs(obj.velocity_z) < 1: obj.velocity_z = 0