From 11c1bad0c43941a795d3436212642931fe9d6f9f Mon Sep 17 00:00:00 2001 From: Tanner Date: Sat, 14 Nov 2026 22:23:41 +0000 Subject: [PATCH] Re-enable wood farming, add sapling label --- mosfet/commands.py | 13 +++++++------ mosfet/info/items.py | 1 + tests/test_storage_labels.py | 6 ++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/mosfet/commands.py b/mosfet/commands.py index de42a23..a59f2dd 100644 --- a/mosfet/commands.py +++ b/mosfet/commands.py @@ -65,6 +65,7 @@ class Commands: if data.startswith('[') and data.endswith(']'): command = 'nosquarebrackets' + farm_target = data.casefold().strip() unsupported = { 'trade', 'gapple', 'fill', 'break', 'open', 'click', 'use', 'interact', @@ -72,8 +73,8 @@ class Commands: if ((command == 'gather' and data.lower().strip() != 'wood') or command in unsupported or (command == 'farm' and - not data.lower().startswith('crop') and - data.lower().strip() not in ('wood', 'wart'))): + not farm_target.startswith('crop') and + farm_target not in ('wood', 'logs', 'wart'))): reply = 'not migrated to Minecraft 26.3 yet' print('Reply:', reply) self._send_reply(reply, private, reply_target) @@ -475,12 +476,12 @@ class Commands: else: reply += ', I need a bed' - ## 1farm wood - farms wood from a certain area + ## 1farm logs (or wood) - farms trees and caches their logs ## 1farm sand - farms sand from a certain area ## 1farm wart - farms netherwart from a certain area ## 1farm crop - farms mature crops from a certain area if command == 'farm' and data: - if data == 'wood': + if farm_target in ('wood', 'logs'): self.g.job.state = self.g.job.farm_wood reply = 'ok' elif data == 'sand': @@ -488,10 +489,10 @@ class Commands: self.g.sand_origin = utils.pint(self.g.pos) self.g.job.state = self.g.job.farm_sand reply = 'ok' - elif data == 'wart': + elif farm_target == 'wart': self.g.job.state = self.g.job.farm_wart reply = 'ok' - elif data.startswith('crop'): + elif farm_target.startswith('crop'): mode = self.g.get('game_mode') if mode is not None and mode != 0: reply = 'crop farming needs Survival mode' diff --git a/mosfet/info/items.py b/mosfet/info/items.py index 623148f..606f832 100644 --- a/mosfet/info/items.py +++ b/mosfet/info/items.py @@ -91,6 +91,7 @@ _LABEL_ITEM_IDS = { }), 'wheat': {WHEAT_ID}, 'log': LOG_IDS, + 'sapling': SAPLING_IDS, } diff --git a/tests/test_storage_labels.py b/tests/test_storage_labels.py index fe2ad8b..53f2973 100644 --- a/tests/test_storage_labels.py +++ b/tests/test_storage_labels.py @@ -10,6 +10,7 @@ class StorageLabelTests(unittest.TestCase): seeds = items.storage_item_ids_for_label('Seeds') wheat = items.storage_item_ids_for_label('Wheat') logs = items.storage_item_ids_for_label('Logs') + saplings = items.storage_item_ids_for_label('Saplings') self.assertEqual(seeds, items.get_set({ 'beetroot_seeds', 'melon_seeds', 'pitcher_pod', 'pumpkin_seeds', @@ -30,6 +31,11 @@ class StorageLabelTests(unittest.TestCase): 'stripped_warped_hyphae', 'mushroom_stem', }) <= logs) self.assertNotIn(items.WHEAT_ID, logs) + self.assertEqual(saplings, items.SAPLING_IDS) + self.assertTrue(items.get_set({ + 'oak_sapling', 'pale_oak_sapling', 'mangrove_propagule', + }) <= saplings) + self.assertFalse(saplings & items.LOG_IDS) def test_sign_label_associates_with_adjacent_double_chest(self): sign_pos = (0, 64, 0)