mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Merge upstream port lane b
This commit is contained in:
commit
c448da1155
82 files changed
+2029
-881
No files matched your search
@@ -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;
|
||||
@@ -94,7 +95,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +153,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;
|
||||
}
|
||||
@@ -322,7 +323,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-8
@@ -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;
|
||||
@@ -57,7 +58,8 @@ import java.util.Set;
|
||||
/**
|
||||
* Places the objects of floating child biomes on and under their islands into the mantle for
|
||||
* {@link art.arcane.iris.engine.modifier.FloatingModule}. One per world. Its reach is the largest placement reach of any
|
||||
* floating object the dimension's biomes can place, at least 16 blocks.
|
||||
* floating object the dimension's biomes can place, at least 16 blocks once any of them places objects, and none when
|
||||
* no floating biome places objects.
|
||||
*/
|
||||
public final class FloatingObjectPlacing {
|
||||
private static final int INVERTED_PICK_ATTEMPTS = 8;
|
||||
@@ -76,13 +78,15 @@ public final class FloatingObjectPlacing {
|
||||
private final ObjectPool objects;
|
||||
private final FloatingPlacer placer;
|
||||
private final long mantleSeed;
|
||||
private final int reachBlocks;
|
||||
private final ModuleLog log;
|
||||
|
||||
FloatingObjectPlacing(FloatingWorld world, ObjectPool objects, FloatingPlacer placer, long mantleSeed, ModuleLog log) {
|
||||
FloatingObjectPlacing(FloatingWorld world, ObjectPool objects, FloatingPlacer placer, long mantleSeed, int reachBlocks, ModuleLog log) {
|
||||
this.world = world;
|
||||
this.objects = objects;
|
||||
this.placer = placer;
|
||||
this.mantleSeed = mantleSeed;
|
||||
this.reachBlocks = reachBlocks;
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
@@ -90,11 +94,15 @@ public final class FloatingObjectPlacing {
|
||||
public static FloatingObjectPlacing of(PackWorld world, ModuleLog log) {
|
||||
return world.state(FloatingObjectPlacing.class,
|
||||
generating -> new FloatingObjectPlacing(FloatingWorld.of(generating), ObjectPool.of(generating),
|
||||
new FloatingPlacer(generating, log), generating.seed(IrisSeedPurposes.MANTLE), log));
|
||||
new FloatingPlacer(generating, log), generating.seed(IrisSeedPurposes.MANTLE),
|
||||
reach(generating.settings(), log), log));
|
||||
}
|
||||
|
||||
/** Places what originates in the chunk of {@code context} into the mantle. */
|
||||
public void place(MantleStageContext context) {
|
||||
if (reachBlocks == 0) {
|
||||
return;
|
||||
}
|
||||
int minX = context.originX();
|
||||
int minZ = context.originZ();
|
||||
BlockBox bounds = context.terrain().bounds();
|
||||
@@ -389,9 +397,9 @@ public final class FloatingObjectPlacing {
|
||||
|
||||
/** How far, in blocks along X and Z, the floating objects of the pack {@code settings} describe may write beyond their chunk. */
|
||||
public static int reach(PackSettings settings, ModuleLog log) {
|
||||
Reach reach = new Reach(settings.resources(), biomeObjectsOf(settings), log);
|
||||
int maxObjectExtent = MIN_REACH_BLOCKS;
|
||||
int maxObjectExtent = 0;
|
||||
try {
|
||||
Reach reach = new Reach(settings.resources(), biomeObjectsOf(settings), log);
|
||||
for (Entry<FloatingChildSettings> declared : settings.declared(FloatingChildSettings.class)) {
|
||||
if (declared.level() != Level.BIOME) {
|
||||
continue;
|
||||
@@ -402,7 +410,9 @@ public final class FloatingObjectPlacing {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to work out the reach of the floating biomes' objects", e);
|
||||
maxObjectExtent = Math.max(maxObjectExtent, MIN_REACH_BLOCKS);
|
||||
}
|
||||
return maxObjectExtent;
|
||||
}
|
||||
@@ -452,8 +462,7 @@ public final class FloatingObjectPlacing {
|
||||
}
|
||||
|
||||
int of(FloatingChildBiome child, ResourceId parent) {
|
||||
int reach = 0;
|
||||
reach = Math.max(reach, placementRadius(child.floatingObjects()));
|
||||
int reach = placementRadius(child.floatingObjects());
|
||||
reach = Math.max(reach, placementRadius(child.extraObjects()));
|
||||
reach = Math.max(reach, placementRadius(child.topObjectOverrides()));
|
||||
reach = Math.max(reach, placementRadius(child.bottomObjectOverrides()));
|
||||
@@ -462,13 +471,18 @@ 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);
|
||||
reach = Math.max(reach, MIN_REACH_BLOCKS);
|
||||
}
|
||||
return reach;
|
||||
}
|
||||
|
||||
private int placementRadius(List<ObjectPlacement> placements) {
|
||||
int radius = 0;
|
||||
if (placements.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int radius = MIN_REACH_BLOCKS;
|
||||
for (ObjectPlacement placement : placements) {
|
||||
if (placement == null) {
|
||||
continue;
|
||||
@@ -492,6 +506,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