mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Bound planned search by recorded
- nearestRiver limits the planned search to the recorded water's distance, rounded up, when generated chunks hold a match - Explored areas end with a confirmed Found instead of waiting out the 30 s timeout; nearer planned water inside the bound still wins - Tests cover the bounded radius in queries and a bounded search that finishes under a short timeout when nothing near is eligible
This commit is contained in:
1 parent
9afd70e69f
commit
c0169d6dcd
3 files changed
+68
-3
No files matched your search
@@ -215,9 +215,10 @@ public final class GenerationSemanticQueries {
|
||||
return new RiverSearch.Missing(unavailable.map(reason -> riverUnavailableMessage(requiredType, reason))
|
||||
.orElseGet(() -> riverNotFoundMessage(requiredType, maximumDistance)));
|
||||
}
|
||||
int activeDistance = recorded == null ? maximumDistance : Math.min(maximumDistance, distanceCeiling(blockX, blockZ, recorded));
|
||||
RiverResult active;
|
||||
try {
|
||||
active = activeRiver(requiredEngine, history, requiredType, blockX, blockZ, maximumDistance, running);
|
||||
active = activeRiver(requiredEngine, history, requiredType, blockX, blockZ, activeDistance, running);
|
||||
} catch (HydrologySearchTimeoutException timedOut) {
|
||||
RiverResult planned = timedOut.nearestSoFar().map(feature -> activeResult(requiredEngine, history, feature)).orElse(null);
|
||||
return stoppedSearch(requiredType, nearer(blockX, blockZ, recorded, planned));
|
||||
@@ -247,6 +248,12 @@ public final class GenerationSemanticQueries {
|
||||
}
|
||||
}
|
||||
|
||||
private static int distanceCeiling(int blockX, int blockZ, RiverResult feature) {
|
||||
BigInteger squared = horizontalDistanceSquared(blockX, blockZ, feature.x(), feature.z());
|
||||
BigInteger root = squared.sqrt();
|
||||
return (root.multiply(root).equals(squared) ? root : root.add(BigInteger.ONE)).intValueExact();
|
||||
}
|
||||
|
||||
private static RiverResult nearer(int blockX, int blockZ, RiverResult recorded, RiverResult active) {
|
||||
if (recorded == null) {
|
||||
return active;
|
||||
|
||||
Reference in new issue
Block a user