Support harvesting and caching red sand
This commit is contained in:
1 parent
9918baefdc
commit
ebf325f48b
7 files changed
+48
-31
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user