From eb7df4093a136122503b03275378bfc0b2048c07 Mon Sep 17 00:00:00 2001 From: austin Date: Sun, 4 May 2025 19:35:30 -0400 Subject: [PATCH] block pathing work --- docs/src/progress/renderertodo.md | 1 + .../server/pathfinding/voxel/VoxelPathfinder.java | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index f127336b..ca7c65a4 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1676,6 +1676,7 @@ Digging produces terrain item form Terrain items can be placed to place terrain Recipe adjustment + voxel work Recursive recipe item sourcing solver that keeps searching if a recipe fails to source +Block pathing work diff --git a/src/main/java/electrosphere/server/pathfinding/voxel/VoxelPathfinder.java b/src/main/java/electrosphere/server/pathfinding/voxel/VoxelPathfinder.java index e7917ec4..eec21246 100644 --- a/src/main/java/electrosphere/server/pathfinding/voxel/VoxelPathfinder.java +++ b/src/main/java/electrosphere/server/pathfinding/voxel/VoxelPathfinder.java @@ -32,6 +32,11 @@ public class VoxelPathfinder { */ public static final int DEFAULT_MAX_COST = 12000; + /** + * Maximum number of blocks for a walkable position + */ + static final int MAX_BLOCKS_FOR_WALKABLE = 0; + /** * Maximum distance to scan for a walkable position */ @@ -905,9 +910,9 @@ public class VoxelPathfinder { Vector3i currChunk = new Vector3i(chunkPos); Vector3i offsets = new Vector3i(); int numBlocks = 0; - for(int x = 0; x < 4; x++){ - for(int y = 0; y < 4; y++){ - for(int z = 0; z < 4; z++){ + for(int x = -1; x < 4; x++){ + for(int y = -2; y < 4; y++){ + for(int z = -1; z < 3; z++){ blockPos.set(voxelPos).mul(BlockChunkData.BLOCKS_PER_UNIT_DISTANCE); currChunk.set(chunkPos); offsets.set( @@ -927,7 +932,7 @@ public class VoxelPathfinder { } } } - boolean blocksChestHeight = numBlocks > 10; + boolean blocksChestHeight = numBlocks > MAX_BLOCKS_FOR_WALKABLE; return standingOnGround && aboveIsAir && !blocksChestHeight; }