Support harvesting and caching red sand

This commit is contained in:
Tanner committed 2026-11-17 19:29:13 +00:00
1 parent 9918baefdc
commit ebf325f48b
7 files changed
+48 -31

No files matched your search

+19 -18
View File
@@ -47,26 +47,27 @@ class IndexedSearchTests(unittest.TestCase):
world_blocks[(1, 63, 0)] = blocks.SAND
self.assertTrue(world.sand_safety(sand)[0])
def test_sand_search_targets_safe_blocks_in_3x3_slice_only(self):
sand_position = (1, 64, 1)
def test_sand_search_targets_safe_sand_types_in_3x3_slice_only(self):
for sand_state in blocks.SAND_IDS:
sand_position = (1, 64, 1)
class SandChunks:
def get_block_at(self, x, y, z):
position = (x, y, z)
if position == sand_position:
return blocks.SAND
if y < sand_position[1]:
return blocks.STONE
return blocks.AIR
class SandChunks:
def get_block_at(self, x, y, z):
position = (x, y, z)
if position == sand_position:
return sand_state
if y < sand_position[1]:
return blocks.STONE
return blocks.AIR
world = World(Munch(chunks=SandChunks()))
self.assertTrue(world.check_sand_slice((0, 64, 0)))
self.assertEqual(
world.find_sand((0, 64, 0), 2, (0, 64, 0)),
[sand_position])
sand_position = (2, 64, 0)
self.assertFalse(world.check_sand_slice((0, 64, 0)))
with self.subTest(sand_state=sand_state):
world = World(Munch(chunks=SandChunks()))
self.assertTrue(world.check_sand_slice((0, 64, 0)))
self.assertEqual(
world.find_sand((0, 64, 0), 2, (0, 64, 0)),
[sand_position])
sand_position = (2, 64, 0)
self.assertFalse(world.check_sand_slice((0, 64, 0)))
def test_index_deduplication_is_linear_and_sort_is_optional(self):
far = (10, 64, 0)
+5
View File
@@ -11,7 +11,12 @@ class StorageLabelTests(unittest.TestCase):
wheat = items.storage_item_ids_for_label('Wheat')
logs = items.storage_item_ids_for_label('Logs')
saplings = items.storage_item_ids_for_label('Saplings')
sand = items.storage_item_ids_for_label('Sand')
red_sand = items.storage_item_ids_for_label('Red Sand')
self.assertEqual(sand, {items.SAND_ID})
self.assertEqual(red_sand, {items.RED_SAND_ID})
self.assertNotEqual(sand, red_sand)
self.assertEqual(seeds, items.get_set({
'beetroot_seeds', 'melon_seeds', 'pitcher_pod', 'pumpkin_seeds',
'torchflower_seeds', 'wheat_seeds',