Skip to content

Commit

Permalink
Filter ungenerated chunks on volume streams
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Nov 1, 2023
1 parent 64b5d1f commit d035bb1
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ private static <R extends Volume, API, MC, Section, KeyReference> SpongeVolumeSt
if (options.loadingStyle().immediateLoading()) {
final Set<KeyReference> availableTileEntityPositions = new LinkedHashSet<>();
sectionStream
.filter(Objects::nonNull)
.map(entityAccessor)
.forEach((map) -> map.forEach(entry -> entryConsumer.accept(entry, availableTileEntityPositions)));
filteredPosStream = availableTileEntityPositions.stream();
Expand All @@ -641,6 +642,7 @@ private static <R extends Volume, API, MC, Section, KeyReference> SpongeVolumeSt
// Since we're operating on the chunk positions, we generate the Stream of keys
// for each position, which in turn generate their filtered lists on demand.
filteredPosStream = sectionStream
.filter(Objects::nonNull)
.flatMap(chunk -> {
final Set<KeyReference> blockEntityPoses = new LinkedHashSet<>();
entityAccessor.apply(chunk)
Expand Down

0 comments on commit d035bb1

Please sign in to comment.