mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-27 06:20:02 +00:00
Validated terrain samples
- Terrain sampling rejects non-finite active bounds and noise before caching heights - Validation tests cover invalid samples and unchanged finite arithmetic - Bukkit packaging uses the existing 8 MB artifact limit
This commit is contained in:
1 parent
965606bbcc
commit
5a5e8a8dc8
3 files changed
+54
-7
No files matched your search
@@ -1401,15 +1401,25 @@ public class IrisComplex implements DataProvider {
|
||||
if (generators.length == 0) {
|
||||
return 0D;
|
||||
}
|
||||
if (!Double.isFinite(low) || !Double.isFinite(high)) {
|
||||
throw new IllegalStateException("Terrain generator bounds were not finite at " + x + "," + z
|
||||
+ " (generator=" + generators[0].getLoadKey() + ", bounds=" + low + ".." + high + ").");
|
||||
}
|
||||
double height = 0D;
|
||||
if (low == high && Double.isFinite(low)) {
|
||||
if (low == high) {
|
||||
for (int i = 0; i < generators.length; i++) {
|
||||
height += low;
|
||||
}
|
||||
return height / generators.length;
|
||||
}
|
||||
for (IrisGenerator generator : generators) {
|
||||
height += M.lerp(low, high, generator.getHeight(x, z, seed));
|
||||
double noise = generator.getHeight(x, z, seed);
|
||||
if (!Double.isFinite(noise)) {
|
||||
throw new IllegalStateException("Terrain generator noise was not finite at " + x + "," + z
|
||||
+ " (generator=" + generator.getLoadKey() + ", noise=" + noise
|
||||
+ ", bounds=" + low + ".." + high + ").");
|
||||
}
|
||||
height += M.lerp(low, high, noise);
|
||||
}
|
||||
return height / generators.length;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user