Port sand gathering to 26.3

This commit is contained in:
Tanner committed 2026-11-16 22:55:06 +00:00
1 parent f28269f71c
commit 3e8b95c895
9 files changed
+424 -158

No files matched your search

+21
View File
@@ -6,6 +6,27 @@ from mosfet.world import World
class IndexedSearchTests(unittest.TestCase):
def test_sand_search_targets_safe_blocks_in_3x3_slice_only(self):
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
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)
near = (1, 64, 0)