Port and tune 26.3 wood farming

This commit is contained in:
Tanner
2026-11-05 16:36:10 +00:00
parent b89f0f6ed2
commit 4c27f5058e
15 changed files with 412 additions and 40 deletions
+14 -3
View File
@@ -17,6 +17,8 @@ from mosfet.info import mcdata
from mosfet.info import mobs
class ClearLeavesStates:
LEAF_BREAK_INTERVAL = 0.6
def idle(self):
return None
@@ -26,9 +28,13 @@ class ClearLeavesStates:
self.state = self.cleanup
return
sapling_type = self.g.chopped_tree + '_sapling'
sapling_item = items.get_id(sapling_type)
sapling_item = items.get_sapling_id(self.g.chopped_tree)
if sapling_item is None:
print('No sapling for chopped tree, skipping leaf cleanup')
self.state = self.cleanup
return
num_saplings = self.g.game.count_items([sapling_item])
sapling_type = items.get_name(sapling_item)
print('Have', num_saplings, sapling_type, 'in inventory')
if num_saplings > 8:
@@ -57,9 +63,13 @@ class ClearLeavesStates:
def break_leaves(self):
if not self.g.breaking:
if self.leaves:
now = time.monotonic()
if now < self.next_break_at:
return
leaf = self.leaves.pop(0)
self.g.look_at = leaf
self.g.game.break_block(leaf)
if self.g.game.break_block(leaf):
self.next_break_at = now + self.LEAF_BREAK_INTERVAL
print('Breaking leaf', leaf)
else:
self.wait_time = 1
@@ -86,6 +96,7 @@ class ClearLeavesStates:
self.leaves = []
self.wait_time = 0
self.next_break_at = 0.0
def run(self):
self.state()