Skip to content

Commit

Permalink
Fix: prioritise directly adjacent blocks when scanning flag layers
Browse files Browse the repository at this point in the history
  • Loading branch information
Gegy committed Nov 16, 2024
1 parent 488984f commit c8ab966
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.GlobalPos;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
Expand Down Expand Up @@ -157,7 +158,17 @@ private List<LayeredMonument.Layer> scanForLayers(ServerLevel level, BlockPos sc
}
}

private static final Direction[] DIRECTIONS = Direction.values();

private static void enqueueNeighbors(BlockPos.MutableBlockPos mutablePos, long originPos, LongArrayFIFOQueue queue, LongSet visitedBlocks) {
// TODO: This is a terrible hack to ensure that the immediately adjacent layers get picked first
for (Direction direction : DIRECTIONS) {
mutablePos.set(originPos).move(direction);
long neighborPos = mutablePos.asLong();
if (visitedBlocks.add(neighborPos)) {
queue.enqueue(neighborPos);
}
}
for (int z = -1; z <= 1; z++) {
for (int y = -1; y <= 1; y++) {
for (int x = -1; x <= 1; x++) {
Expand Down

0 comments on commit c8ab966

Please sign in to comment.