Implement item cachine for 26.3

This commit is contained in:
Tanner
2026-11-04 18:54:04 +00:00
parent 459e288407
commit 9fd565c3c9
10 changed files with 228 additions and 37 deletions
+19 -1
View File
@@ -182,7 +182,25 @@ class World:
yield a
def find_cache_areas(self, center, distance):
return self.find_bed_areas(center, distance)
"""Yield nearby, supported air blocks suitable for placing a chest."""
center = tuple(center)
for offset in utils.search_2d(distance):
if utils.hypot(offset[0], offset[2]) > distance:
continue
for dy in (0, 1, -1, 2, -2):
area = (center[0] + offset[0], center[1] + dy,
center[2] + offset[2])
if area == center:
continue
if self.block_at(*area) != blocks.AIR:
continue
if self.block_at(*utils.padd(area, path.BLOCK_ABOVE)) != blocks.AIR:
continue
support = self.block_at(*utils.padd(area, path.BLOCK_BELOW))
if (support is None or support in blocks.NON_SOLID_IDS or
support in blocks.AVOID_IDS):
continue
yield area
def sand_adjacent_safe(self, sand):
for direction in path.CHECK_DIRECTIONS: