BlueGit

timfa copperfarmer

Include diagonally connected logs when detecting a tree.

Co-authored-by: Cursor <cursoragent@cursor.com>

timfa Tim Falken · pushed by timfa

Authored 2026-08-22 · 2 months ago

Hash
7c789feaf05f1992006a20eb3effc7b77e688308
Parent
b678dffa
1 file changed +9 −4
src/main/java/nl/timfalken/copperfarmer/TreeIndex.java +9 −4
@@ -279,10 +279,15 @@ final class TreeIndex {
279 279 found.add(BlockRef.of(start));
280 280 while (!queue.isEmpty() && found.size() <= limit) {
281 281 Block current = queue.pollFirst();
282 for (BlockFace face : ALL_SIX) {
283 Block next = current.getRelative(face);
284 if (!isChunkLoaded(next) || next.getType() != logType) continue;
285 if (found.add(BlockRef.of(next))) queue.addLast(next);
282 for (int dx = -1; dx <= 1; dx++) {
283 for (int dy = -1; dy <= 1; dy++) {
284 for (int dz = -1; dz <= 1; dz++) {
285 if (dx == 0 && dy == 0 && dz == 0) continue;
286 Block next = current.getRelative(dx, dy, dz);
287 if (!isChunkLoaded(next) || next.getType() != logType) continue;
288 if (found.add(BlockRef.of(next))) queue.addLast(next);
289 }
290 }
286 291 }
287 292 }
288 293 return found;
@@ -279,10 +279,15 @@ final class TreeIndex {
279 found.add(BlockRef.of(start));
279 found.add(BlockRef.of(start));
280 while (!queue.isEmpty() && found.size() <= limit) {
280 while (!queue.isEmpty() && found.size() <= limit) {
281 Block current = queue.pollFirst();
281 Block current = queue.pollFirst();
282 for (BlockFace face : ALL_SIX) {
282 for (int dx = -1; dx <= 1; dx++) {
283 Block next = current.getRelative(face);
283 for (int dy = -1; dy <= 1; dy++) {
284 if (!isChunkLoaded(next) || next.getType() != logType) continue;
284 for (int dz = -1; dz <= 1; dz++) {
285 if (found.add(BlockRef.of(next))) queue.addLast(next);
285 if (dx == 0 && dy == 0 && dz == 0) continue;
286 Block next = current.getRelative(dx, dy, dz);
287 if (!isChunkLoaded(next) || next.getType() != logType) continue;
288 if (found.add(BlockRef.of(next))) queue.addLast(next);
289 }
290 }
286 }
291 }
287 }
292 }
288 return found;
293 return found;