Process chunks in order when regenerating all roads

This commit is contained in:
dordsor21 2022-01-27 13:18:54 +00:00 committed by Jordan
parent b9f6f9b2b8
commit 026e3fc17e
2 changed files with 6 additions and 4 deletions

View File

@ -49,6 +49,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -207,7 +208,7 @@ public class DebugExec extends SubCommand {
} }
boolean result; boolean result;
if (HybridUtils.regions != null) { if (HybridUtils.regions != null) {
result = this.hybridUtils.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>()); result = this.hybridUtils.scheduleRoadUpdate(area, HybridUtils.regions, 0, new LinkedHashSet<>());
} else { } else {
result = this.hybridUtils.scheduleRoadUpdate(area, 0); result = this.hybridUtils.scheduleRoadUpdate(area, 0);
} }

View File

@ -74,6 +74,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@ -86,7 +87,7 @@ public class HybridUtils {
public static HybridUtils manager; public static HybridUtils manager;
public static Set<BlockVector2> regions; public static Set<BlockVector2> regions;
public static int height; public static int height;
public static Set<BlockVector2> chunks = new HashSet<>(); public static Set<BlockVector2> chunks = new LinkedHashSet<>();
public static PlotArea area; public static PlotArea area;
public static boolean UPDATE = false; public static boolean UPDATE = false;
@ -412,7 +413,7 @@ public class HybridUtils {
} }
HybridUtils.UPDATE = true; HybridUtils.UPDATE = true;
Set<BlockVector2> regions = this.worldUtil.getChunkChunks(area.getWorldName()); Set<BlockVector2> regions = this.worldUtil.getChunkChunks(area.getWorldName());
return scheduleRoadUpdate(area, regions, extend, new HashSet<>()); return scheduleRoadUpdate(area, regions, extend, new LinkedHashSet<>());
} }
public boolean scheduleSingleRegionRoadUpdate(Plot plot, int extend) { public boolean scheduleSingleRegionRoadUpdate(Plot plot, int extend) {
@ -422,7 +423,7 @@ public class HybridUtils {
HybridUtils.UPDATE = true; HybridUtils.UPDATE = true;
Set<BlockVector2> regions = new HashSet<>(); Set<BlockVector2> regions = new HashSet<>();
regions.add(RegionManager.getRegion(plot.getCenterSynchronous())); regions.add(RegionManager.getRegion(plot.getCenterSynchronous()));
return scheduleRoadUpdate(plot.getArea(), regions, extend, new HashSet<>()); return scheduleRoadUpdate(plot.getArea(), regions, extend, new LinkedHashSet<>());
} }
public boolean scheduleRoadUpdate( public boolean scheduleRoadUpdate(