mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 08:44:50 +00:00
Contain failed placements and let engine failures end the chunk
Placement code caught Throwable and logged it, so a closed session, a stopping executor or an OOM inside a placement left a half-built chunk that was then persisted. A classifier in the api separates those failures from content failures: the first are rethrown, the second are skipped with one rate-limited warning per kind, subject and failure type. Upstream:54f3595baebe4aa1e47b38f7584f4f7e92a48cf9e01d9
This commit is contained in:
1 parent
fc5c6ce0ab
commit
de1c6e887f
13 files changed
+318
-22
No files matched your search
@@ -0,0 +1,7 @@
|
||||
package com.volmit.generation;
|
||||
|
||||
/** Marks an exception that says the engine, not one piece of content, failed: a closed session, a stopping runtime. The
|
||||
* placement code that skips a failed piece lets it through instead; see {@link GenerationFailures}.
|
||||
*/
|
||||
public interface EngineFailure {
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.volmit.generation;
|
||||
|
||||
import com.volmit.ModuleLog;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/** Tells failures of the engine, its executors or the JVM from failures of one piece of content. Code that places a
|
||||
* list of objects or decorations may skip a piece that fails, because every rebuild skips it the same way. An engine
|
||||
* failure is transient, so skipping it would leave a half-built chunk that a healthy engine never produces: it must
|
||||
* end the chunk instead.
|
||||
*/
|
||||
public final class GenerationFailures {
|
||||
private static final int MAXIMUM_CAUSE_DEPTH = 32;
|
||||
private static final int MAXIMUM_SKIP_KEYS = 512;
|
||||
private static final String OVERFLOW_SKIP_KEY = "overflow";
|
||||
private static final String PACKAGE_PREFIX = "art.arcane.";
|
||||
static final long SKIP_WARNING_INTERVAL_NANOS = 60_000_000_000L;
|
||||
private static final ConcurrentHashMap<String, SkipWarning> SKIP_WARNINGS = new ConcurrentHashMap<>();
|
||||
|
||||
private GenerationFailures() {
|
||||
}
|
||||
|
||||
/** Whether {@code failure} or one of its causes is an {@link Error}, an {@link EngineFailure}, an I/O or timeout
|
||||
* failure, or a stopping executor or thread; any failure on an interrupted thread counts too.
|
||||
*/
|
||||
public static boolean isEngineFailure(Throwable failure) {
|
||||
return Thread.currentThread().isInterrupted() || hasCause(failure, cause -> cause instanceof Error
|
||||
|| cause instanceof EngineFailure
|
||||
|| cause instanceof IOException
|
||||
|| cause instanceof UncheckedIOException
|
||||
|| cause instanceof TimeoutException
|
||||
|| cause instanceof InterruptedException
|
||||
|| cause instanceof RejectedExecutionException
|
||||
|| cause instanceof CancellationException);
|
||||
}
|
||||
|
||||
/** Throws {@code failure} when it is an engine failure, so a catch block can call it first and then handle the
|
||||
* content failures that remain. A checked failure is wrapped in an {@link IllegalStateException}.
|
||||
*/
|
||||
public static void rethrowEngineFailure(Throwable failure) {
|
||||
if (!isEngineFailure(failure)) {
|
||||
return;
|
||||
}
|
||||
if (failure instanceof RuntimeException runtimeFailure) {
|
||||
throw runtimeFailure;
|
||||
}
|
||||
if (failure instanceof Error error) {
|
||||
throw error;
|
||||
}
|
||||
if (failure instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
throw new IllegalStateException("Iris generation stopped: " + failure, failure);
|
||||
}
|
||||
|
||||
/** Ends one failed placement: an engine failure leaves through {@link #rethrowEngineFailure}, anything else is one
|
||||
* warning on {@code log} per minute for each {@code kind}, {@code subject} and failure type, counting the ones
|
||||
* skipped meanwhile, and the caller moves on. The limit only decides what is logged, never what is placed.
|
||||
*
|
||||
* @param kind what was being placed, such as {@code decoration}
|
||||
* @param subject the pack content that failed, such as a block or an object name; it keys the warning, so it must
|
||||
* not hold a coordinate
|
||||
* @param where where it failed, such as {@code at 1,2,3}; it is only printed
|
||||
*/
|
||||
public static void skipPlacement(ModuleLog log, Throwable failure, String kind, String subject, String where) {
|
||||
rethrowEngineFailure(failure);
|
||||
long suppressed = claimSkipWarning(kind + '|' + subject + '|' + failure.getClass().getName(), System.nanoTime());
|
||||
if (suppressed >= 0L) {
|
||||
log.warn(skipWarning(kind, subject, where, failure, suppressed));
|
||||
}
|
||||
}
|
||||
|
||||
static long claimSkipWarning(String key, long now) {
|
||||
SkipWarning warning = SKIP_WARNINGS.get(key);
|
||||
if (warning == null) {
|
||||
String resolved = SKIP_WARNINGS.size() >= MAXIMUM_SKIP_KEYS ? OVERFLOW_SKIP_KEY : key;
|
||||
warning = SKIP_WARNINGS.computeIfAbsent(resolved, ignored -> new SkipWarning(now - SKIP_WARNING_INTERVAL_NANOS));
|
||||
}
|
||||
return warning.claim(now);
|
||||
}
|
||||
|
||||
static String skipWarning(String kind, String subject, String where, Throwable failure, long suppressed) {
|
||||
String message = failure.getMessage() == null ? "" : ": " + failure.getMessage().replaceAll("\\s+", " ");
|
||||
StringBuilder line = new StringBuilder("Skipped ").append(kind).append(' ').append(subject)
|
||||
.append(' ').append(where).append(": ").append(failure.getClass().getSimpleName()).append(message);
|
||||
StackTraceElement origin = origin(failure);
|
||||
if (origin != null) {
|
||||
String className = origin.getClassName();
|
||||
line.append(" (").append(className.substring(className.lastIndexOf('.') + 1)).append('.')
|
||||
.append(origin.getMethodName()).append(')');
|
||||
}
|
||||
if (suppressed > 0L) {
|
||||
line.append(", ").append(suppressed).append(" more");
|
||||
}
|
||||
return line.toString();
|
||||
}
|
||||
|
||||
private static StackTraceElement origin(Throwable failure) {
|
||||
StackTraceElement[] frames = failure.getStackTrace();
|
||||
for (StackTraceElement frame : frames) {
|
||||
if (frame.getClassName().startsWith(PACKAGE_PREFIX)) {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
return frames.length == 0 ? null : frames[0];
|
||||
}
|
||||
|
||||
private static boolean hasCause(Throwable failure, Predicate<Throwable> match) {
|
||||
Throwable current = failure;
|
||||
for (int depth = 0; current != null && depth < MAXIMUM_CAUSE_DEPTH; depth++, current = current.getCause()) {
|
||||
if (match.test(current)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final class SkipWarning {
|
||||
private final AtomicLong last;
|
||||
private final AtomicLong suppressed = new AtomicLong();
|
||||
|
||||
private SkipWarning(long start) {
|
||||
last = new AtomicLong(start);
|
||||
}
|
||||
|
||||
private long claim(long now) {
|
||||
long previous = last.get();
|
||||
if (now - previous >= SKIP_WARNING_INTERVAL_NANOS && last.compareAndSet(previous, now)) {
|
||||
return suppressed.getAndSet(0L);
|
||||
}
|
||||
suppressed.incrementAndGet();
|
||||
return -1L;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.volmit.generation;
|
||||
|
||||
import com.volmit.ModuleLog;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class GenerationFailuresTest {
|
||||
private static final long START_NANOS = 1_000_000_000L;
|
||||
|
||||
private static final class ClosedSession extends Exception implements EngineFailure {
|
||||
ClosedSession(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
private static ModuleLog logInto(List<String> warnings) {
|
||||
return (ModuleLog) Proxy.newProxyInstance(ModuleLog.class.getClassLoader(), new Class<?>[] {ModuleLog.class},
|
||||
(proxy, method, arguments) -> {
|
||||
if (method.getName().equals("warn")) {
|
||||
warnings.add((String) arguments[0]);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void engineFailuresAreRecognizedThroughWrappers() {
|
||||
assertTrue(GenerationFailures.isEngineFailure(new ClosedSession("sealed")));
|
||||
assertTrue(GenerationFailures.isEngineFailure(new RejectedExecutionException("pool shut down")));
|
||||
assertTrue(GenerationFailures.isEngineFailure(new OutOfMemoryError()));
|
||||
assertTrue(GenerationFailures.isEngineFailure(new UncheckedIOException(new IOException("plate read"))));
|
||||
assertTrue(GenerationFailures.isEngineFailure(new CompletionException(
|
||||
new IllegalStateException("placement failed", new ClosedSession("sealed")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
void contentFailuresAreNotEngineFailures() {
|
||||
assertFalse(GenerationFailures.isEngineFailure(new IllegalArgumentException("malformed object")));
|
||||
assertFalse(GenerationFailures.isEngineFailure(new NullPointerException("missing block")));
|
||||
assertFalse(GenerationFailures.isEngineFailure(new IllegalStateException("unrelated")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void anyFailureOnAnInterruptedThreadIsAnEngineFailure() {
|
||||
Thread.currentThread().interrupt();
|
||||
try {
|
||||
assertTrue(GenerationFailures.isEngineFailure(new IllegalArgumentException("malformed object")));
|
||||
} finally {
|
||||
Thread.interrupted();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void rethrowPropagatesEngineFailuresAndReturnsForContentFailures() {
|
||||
var closed = new IllegalStateException("closed", new RejectedExecutionException());
|
||||
assertSame(closed, assertThrows(IllegalStateException.class, () -> GenerationFailures.rethrowEngineFailure(closed)));
|
||||
|
||||
var checked = new ClosedSession("sealed");
|
||||
var wrapped = assertThrows(IllegalStateException.class, () -> GenerationFailures.rethrowEngineFailure(checked));
|
||||
assertSame(checked, wrapped.getCause());
|
||||
|
||||
var error = new OutOfMemoryError();
|
||||
assertSame(error, assertThrows(OutOfMemoryError.class, () -> GenerationFailures.rethrowEngineFailure(error)));
|
||||
|
||||
GenerationFailures.rethrowEngineFailure(new IllegalArgumentException("malformed object"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void skippedPlacementRethrowsEngineFailuresAndWarnsOnContentFailures() {
|
||||
var warnings = new ArrayList<String>();
|
||||
var log = logInto(warnings);
|
||||
GenerationFailures.skipPlacement(log, new IllegalArgumentException("Invalid\nblockFace"),
|
||||
"decoration", "minecraft:vine", "at 1,2,3");
|
||||
assertEquals(1, warnings.size());
|
||||
assertTrue(warnings.get(0).startsWith(
|
||||
"Skipped decoration minecraft:vine at 1,2,3: IllegalArgumentException: Invalid blockFace ("), warnings.get(0));
|
||||
assertTrue(warnings.get(0).contains("GenerationFailuresTest."), warnings.get(0));
|
||||
|
||||
var closed = new ClosedSession("sealed");
|
||||
var thrown = assertThrows(IllegalStateException.class,
|
||||
() -> GenerationFailures.skipPlacement(log, closed, "decoration", "minecraft:vine", "at 1,2,3"));
|
||||
assertSame(closed, thrown.getCause());
|
||||
assertEquals(1, warnings.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void repeatedSkipsAreLimitedPerKeyAndCountedOnTheNextLine() {
|
||||
assertEquals(0L, GenerationFailures.claimSkipWarning("limit-test", START_NANOS));
|
||||
assertEquals(-1L, GenerationFailures.claimSkipWarning("limit-test", START_NANOS + 1L));
|
||||
assertEquals(-1L, GenerationFailures.claimSkipWarning("limit-test", START_NANOS + 2L));
|
||||
assertEquals(0L, GenerationFailures.claimSkipWarning("limit-test-other", START_NANOS + 2L));
|
||||
assertEquals(2L, GenerationFailures.claimSkipWarning("limit-test",
|
||||
START_NANOS + GenerationFailures.SKIP_WARNING_INTERVAL_NANOS + 1L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theSkipWarningNamesTheFirstIrisFrameAndTheSuppressedCount() {
|
||||
var failure = new IllegalArgumentException("bad");
|
||||
failure.setStackTrace(new StackTraceElement[] {
|
||||
new StackTraceElement("java.util.HashMap", "get", "HashMap.java", 1),
|
||||
new StackTraceElement("art.arcane.iris.engine.decorator.DecoratorCore", "place", "DecoratorCore.java", 2)});
|
||||
assertEquals("Skipped decoration minecraft:vine at 1,2,3: IllegalArgumentException: bad (DecoratorCore.place), 4 more",
|
||||
GenerationFailures.skipWarning("decoration", "minecraft:vine", "at 1,2,3", failure, 4L));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package art.arcane.iris.engine.framework;
|
||||
|
||||
public class GenerationSessionException extends WrongEngineBroException {
|
||||
import com.volmit.generation.EngineFailure;
|
||||
|
||||
public class GenerationSessionException extends WrongEngineBroException implements EngineFailure {
|
||||
private final boolean expectedTeardown;
|
||||
|
||||
public GenerationSessionException(String message) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.util.project.matter.TileWrapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import art.arcane.iris.core.IrisSettings;
|
||||
import art.arcane.iris.core.link.Identifier;
|
||||
import art.arcane.iris.core.tools.WorldMaintenance;
|
||||
@@ -963,6 +964,7 @@ public class MantleWriter implements IObjectPlacer, AutoCloseable {
|
||||
try {
|
||||
setData(pos.getX(), pos.getY(), pos.getZ(), data);
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
// Reached per position while an object writes past the edge of the writer window, which is
|
||||
// how a large object is clipped. Nothing here is actionable from outside the engine.
|
||||
IrisLogging.debug("No set? " + data.toString() + " for " + pos.toString());
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@@ -20,6 +21,7 @@ import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.anyDouble;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -83,6 +85,27 @@ public class DecoratorCoreTest {
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pickDecorator_contentFailure_skipsThatDecorator() {
|
||||
ResolvedDecorator broken = mock(ResolvedDecorator.class);
|
||||
when(broken.passesChanceGate(anyDouble(), anyDouble())).thenThrow(new IllegalArgumentException("malformed decorator"));
|
||||
ResolvedDecorator healthy = mock(ResolvedDecorator.class);
|
||||
when(healthy.passesChanceGate(anyDouble(), anyDouble())).thenReturn(true);
|
||||
|
||||
ResolvedDecorator result = DecoratorCore.pickDecorator(new ResolvedDecorator[]{broken, healthy}, new RNG(2L), 0.0, 0.0, ModuleLogs.discarding());
|
||||
assertSame(healthy, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pickDecorator_engineFailure_endsTheChunk() {
|
||||
ResolvedDecorator closed = mock(ResolvedDecorator.class);
|
||||
RejectedExecutionException failure = new RejectedExecutionException("pool shut down");
|
||||
when(closed.passesChanceGate(anyDouble(), anyDouble())).thenThrow(failure);
|
||||
|
||||
assertSame(failure, assertThrows(RejectedExecutionException.class, () ->
|
||||
DecoratorCore.pickDecorator(new ResolvedDecorator[]{closed}, new RNG(2L), 0.0, 0.0, ModuleLogs.discarding())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pickDecorator_singleCandidate_alwaysReturnsThat() {
|
||||
ResolvedDecorator d = mock(ResolvedDecorator.class);
|
||||
|
||||
@@ -20,6 +20,7 @@ package art.arcane.iris.engine.decorator;
|
||||
import art.arcane.iris.builtin.decorant.DecorationPart;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.ModuleLog;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.geometry.BlockFace;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.block.BlockTrait;
|
||||
@@ -90,7 +91,7 @@ final class DecoratorCore {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error("A decorator failed to pick for the column", e);
|
||||
GenerationFailures.skipPlacement(log, e, "decorator", "chance gate", "at " + realX + "," + realZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ final class DecoratorCore {
|
||||
data.set(x, lowerY, z, lower);
|
||||
data.set(x, upperY, z, upper);
|
||||
} catch (Throwable e) {
|
||||
scene.log().error("Failed to place a two-block plant", e);
|
||||
GenerationFailures.skipPlacement(scene.log(), e, "decoration", bd.toString(), "at " + realX + "," + lowerY + "," + realZ);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -318,7 +319,7 @@ final class DecoratorCore {
|
||||
data.set(xf, lowerY, zf, lower);
|
||||
data.set(xf, upperY, zf, upper);
|
||||
} catch (Throwable e) {
|
||||
scene.log().error("Failed to place a two-block plant", e);
|
||||
GenerationFailures.skipPlacement(scene.log(), e, "decoration", bd.toString(), "at " + xf + "," + lowerY + "," + zf);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+10
-12
@@ -41,6 +41,7 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.config.SettingsStack;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.object.PlaceableObject;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.stage.MantleStageContext;
|
||||
@@ -245,8 +246,8 @@ final class ChunkObjectPlacing {
|
||||
tally.triggered(scope);
|
||||
placeObject(tally, placement, scope);
|
||||
} catch (Throwable failure) {
|
||||
skipObjectPlacement("object", "in " + ownerKind(scope) + " " + ownerName, placement, failure);
|
||||
tally.errors++;
|
||||
logPlacementFailure("Failed to place objects in the following " + ownerKind(scope) + ": " + ownerName, placement, failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,8 +284,8 @@ final class ChunkObjectPlacing {
|
||||
try {
|
||||
placeCaveObject(tally, placement, profile, scope, expectedCaveBiome, anchors);
|
||||
} catch (Throwable failure) {
|
||||
skipObjectPlacement("cave object", "in " + ownerKind(scope) + " " + ownerName, placement, failure);
|
||||
tally.errors++;
|
||||
logPlacementFailure("Failed to place cave objects in the following " + ownerKind(scope) + ": " + ownerName, placement, failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,10 +294,8 @@ final class ChunkObjectPlacing {
|
||||
return scope.startsWith("biome") ? "biome" : "region";
|
||||
}
|
||||
|
||||
private void logPlacementFailure(String message, ObjectPlacement placement, Throwable failure) {
|
||||
log.error(message, failure);
|
||||
log.error("Object(s) " + String.join(", ", placement.place()) + " (" + failure.getClass().getSimpleName() + ").", null);
|
||||
log.error("Are these objects missing?", null);
|
||||
private void skipObjectPlacement(String kind, String where, ObjectPlacement placement, Throwable failure) {
|
||||
GenerationFailures.skipPlacement(log, failure, kind, String.join(", ", placement.place()), where);
|
||||
}
|
||||
|
||||
private void placeObject(Tally tally, ObjectPlacement placement, String scope) {
|
||||
@@ -337,9 +336,9 @@ final class ChunkObjectPlacing {
|
||||
}
|
||||
traceObjectResult(scope, object, result, x, z, densityIndex, density);
|
||||
} catch (Throwable failure) {
|
||||
GenerationFailures.skipPlacement(log, failure, "object", object.name(),
|
||||
"in chunk " + chunkX + "," + chunkZ + " scope " + scope + " attempt " + densityIndex + "/" + density);
|
||||
tally.errors++;
|
||||
log.error("Regen object placement exception: chunk=" + chunkX + "," + chunkZ + " scope=" + scope + " object=" + object.name()
|
||||
+ " densityIndex=" + densityIndex + " density=" + density + " error=" + failure.getClass().getSimpleName() + ":" + failure.getMessage(), failure);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,9 +372,9 @@ final class ChunkObjectPlacing {
|
||||
search.minDepthBelowSurface(), tags, null);
|
||||
tallyCave(tally, contained, scope, object, placement, i, density, search, anchor);
|
||||
} catch (Throwable failure) {
|
||||
GenerationFailures.skipPlacement(log, failure, "cave object", object.name(),
|
||||
"in chunk " + chunkX + "," + chunkZ + " scope " + scope + " attempt " + i + "/" + density);
|
||||
tally.errors++;
|
||||
log.error("Regen cave object placement exception: chunk=" + chunkX + "," + chunkZ + " scope=" + scope + " object=" + object.name()
|
||||
+ " densityIndex=" + i + " density=" + density + " error=" + failure.getClass().getSimpleName() + ":" + failure.getMessage(), failure);
|
||||
CaveRejects.log(log,scope, "EXCEPTION", chunkX, chunkZ, placement, object, i, density, search, anchor.y(), failure);
|
||||
}
|
||||
}
|
||||
@@ -430,8 +429,7 @@ final class ChunkObjectPlacing {
|
||||
try {
|
||||
placeUpperObject(placement, forcePlace, scope);
|
||||
} catch (Throwable failure) {
|
||||
log.error("Failed to place upper-dimension objects in " + kind + " " + ownerKey + ": " + String.join(", ", placement.place())
|
||||
+ " (" + failure.getClass().getSimpleName() + ")", failure);
|
||||
skipObjectPlacement("upper-dimension object", "in " + kind + " " + ownerKey, placement, failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -40,6 +40,7 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.config.PackSettings;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.geometry.BlockBox;
|
||||
import com.volmit.geometry.BlockPosition;
|
||||
import com.volmit.resource.ResourceId;
|
||||
@@ -402,6 +403,7 @@ public final class FloatingObjectPlacing {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to work out the reach of the floating biomes' objects", e);
|
||||
}
|
||||
return maxObjectExtent;
|
||||
@@ -462,6 +464,7 @@ public final class FloatingObjectPlacing {
|
||||
reach = Math.max(reach, placementRadius(ResolvedFloatingChild.topObjects(child, surface)));
|
||||
reach = Math.max(reach, placementRadius(ResolvedFloatingChild.bottomObjects(child)));
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to work out the reach of a floating biome's objects", e);
|
||||
}
|
||||
return reach;
|
||||
@@ -492,6 +495,7 @@ public final class FloatingObjectPlacing {
|
||||
}
|
||||
return reach;
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to size a floating object", e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.block.BlockTrait;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.geometry.BlockPosition;
|
||||
import com.volmit.object.BlockEntityData;
|
||||
import com.volmit.object.ObjectBlock;
|
||||
@@ -112,7 +113,7 @@ final class FloatingPlacer {
|
||||
try {
|
||||
place(ObjectRun.of(object, floating, worldX, SAMPLED_HEIGHT, worldZ), context.placementTerrain(), object, id);
|
||||
} catch (Throwable failure) {
|
||||
log.error("Failed to place a floating object", failure);
|
||||
GenerationFailures.skipPlacement(log, failure, "floating object", object.name(), "at " + worldX + "," + worldZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ final class FloatingPlacer {
|
||||
}
|
||||
} catch (Throwable failure) {
|
||||
transaction.discard();
|
||||
log.error("Failed to place an " + kind + " floating object", failure);
|
||||
GenerationFailures.skipPlacement(log, failure, kind + " floating object", object.name(), "at " + worldX + "," + y + "," + worldZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import art.arcane.iris.modules.objects.ObjectSize;
|
||||
import com.volmit.ModuleLog;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.config.PackSettings;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.geometry.BlockBox;
|
||||
import com.volmit.resource.PackResources;
|
||||
|
||||
@@ -93,6 +94,7 @@ final class PlacementReach {
|
||||
}
|
||||
return reach;
|
||||
} catch (Throwable failure) {
|
||||
GenerationFailures.rethrowEngineFailure(failure);
|
||||
log.error("Failed to work out the reach of an object placement", failure);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.hunk.Hunk;
|
||||
import com.volmit.mantle.Mantle;
|
||||
import com.volmit.resource.ResourceId;
|
||||
@@ -229,7 +230,7 @@ final class FloatingIslands {
|
||||
RNG colRng = rng.nextParallelRNG((int) FloatingIslandSample.columnSeed(world.baseSeed(), wx, wz));
|
||||
FloatingDecorator.decorateColumn(scene, decorated, DecorationPart.NONE, xf, zf, wx, wz, topY, max, colRng, NOOP_DECORATION_MISS);
|
||||
} catch (Throwable e) {
|
||||
log.error("Failed to decorate the top of a floating island", e);
|
||||
GenerationFailures.skipPlacement(log, e, "decoration", "floating island top", "at " + wx + "," + topY + "," + wz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +264,7 @@ final class FloatingIslands {
|
||||
try {
|
||||
new IrisSeaSurfaceDecorator(scene).decorate(xf, zf, wx, wx + 1, wx - 1, wz, wz + 1, wz - 1, decorated, fluidTopY, chunk.height);
|
||||
} catch (Throwable e) {
|
||||
log.error("Failed to decorate the sea surface of a floating island", e);
|
||||
GenerationFailures.skipPlacement(log, e, "decoration", "floating island sea surface", "at " + wx + "," + fluidTopY + "," + wz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +331,7 @@ final class FloatingIslands {
|
||||
try {
|
||||
generated.add(layer.get(random.nextParallelRNG(i + j), (wx + j) / layer.zoom(), j, (wz - j) / layer.zoom()));
|
||||
} catch (Throwable e) {
|
||||
log.error("Failed to pick a block of a floating island's palette", e);
|
||||
GenerationFailures.skipPlacement(log, e, "palette block", "floating island", "at " + wx + "," + wz + " depth " + j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,6 +428,7 @@ final class FloatingIslands {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to write the sky biomes of a floating island", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.ModuleLog;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.noise.NoiseFactory;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.world.PackWorld;
|
||||
@@ -301,7 +302,7 @@ public final class BiomeLayers {
|
||||
try {
|
||||
blocks.add(layer.get(random, index + j, (wx + j) / blocksPerSample, j, (wz - j) / blocksPerSample));
|
||||
} catch (Throwable e) {
|
||||
log.error("A biome layer failed to pick a block", e);
|
||||
GenerationFailures.skipPlacement(log, e, "layer block", "biome layer " + index, "at " + (long) wx + "," + (long) wz + " depth " + j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user