diff --git a/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/commands/CommandStructure.java b/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/commands/CommandStructure.java index 9d848a8b0..dc2753cab 100644 --- a/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/commands/CommandStructure.java +++ b/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/commands/CommandStructure.java @@ -18,6 +18,7 @@ package art.arcane.iris.core.commands; +import art.arcane.iris.core.modules.StructureAssemblies; import art.arcane.iris.engine.framework.structure.StructureResources; import art.arcane.iris.engine.object.placement.IrisObjectPlacement; import art.arcane.iris.Iris; @@ -305,7 +306,7 @@ public class CommandStructure implements DirectorExecutor { sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STRUCTURE_NO_IRIS_STRUCTURE_THIS_PACK, MessageArgument.untrusted("structure", structure))); return; } - StructureAssembler assembler = StructureAssembler.forData( + StructureAssembler assembler = StructureAssemblies.forData( data, s, new IrisPosition(0, 64, 0)); StructureAssemblyResult assembly = assembler.assemble(new RNG(1234)); List pieces = assembly.pieces(); @@ -344,7 +345,7 @@ public class CommandStructure implements DirectorExecutor { return; } Location loc = player().getLocation(); - StructureAssembler assembler = StructureAssembler.forData( + StructureAssembler assembler = StructureAssemblies.forData( data, s, new IrisPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); RNG rng = new RNG((long) loc.getBlockX() * 341873128712L + loc.getBlockZ()); StructureAssemblyResult assembly = assembler.assemble(rng); diff --git a/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedStructureCommands.java b/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedStructureCommands.java index 6f0255a6e..568d1aa34 100644 --- a/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedStructureCommands.java +++ b/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedStructureCommands.java @@ -18,6 +18,7 @@ package art.arcane.iris.modded.command; +import art.arcane.iris.core.modules.StructureAssemblies; import art.arcane.iris.engine.framework.structure.StructureResources; import art.arcane.iris.engine.object.placement.IrisObjectPlacement; import art.arcane.iris.modded.ModdedIrisLog; @@ -145,7 +146,7 @@ public final class ModdedStructureCommands { IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STRUCTURE_COMMANDS_NO_IRIS_STRUCTURE_THIS_PACK, MessageArgument.untrusted("key", key))); return 0; } - StructureAssembler assembler = StructureAssembler.forData( + StructureAssembler assembler = StructureAssemblies.forData( data, structure, new IrisPosition(0, 64, 0)); StructureAssemblyResult assembly = assembler.assemble(new RNG(1234)); List pieces = assembly.pieces(); @@ -188,7 +189,7 @@ public final class ModdedStructureCommands { int originX = player.blockPosition().getX(); int originY = player.blockPosition().getY(); int originZ = player.blockPosition().getZ(); - StructureAssembler assembler = StructureAssembler.forData( + StructureAssembler assembler = StructureAssemblies.forData( data, structure, new IrisPosition(originX, originY, originZ)); RNG rng = new RNG((long) originX * 341873128712L + originZ); StructureAssemblyResult assembly = assembler.assemble(rng); diff --git a/core/src/main/java/art/arcane/iris/core/modules/IrisApiLogger.java b/core/src/main/java/art/arcane/iris/core/modules/IrisApiLogger.java index 099c4248b..f1db2fe7f 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/IrisApiLogger.java +++ b/core/src/main/java/art/arcane/iris/core/modules/IrisApiLogger.java @@ -18,7 +18,11 @@ package art.arcane.iris.core.modules; +import art.arcane.iris.core.IrisSettings; import art.arcane.iris.spi.IrisLogging; +import art.arcane.iris.spi.IrisPlatforms; +import com.volmit.ModuleLog; +import com.volmit.host.ModuleLogs; import java.text.MessageFormat; import java.util.ResourceBundle; @@ -29,20 +33,40 @@ import java.util.ResourceBundle; * looks up on the system class loader, where a plugin's classes are not. */ final class IrisApiLogger implements System.Logger { + private static final String HOST_MODULE_LABEL = "iris"; + private static final ModuleLog HOST_LOG = ModuleLogs.labelled(HOST_MODULE_LABEL, new IrisApiLogger(HOST_MODULE_LABEL)); + private final String name; IrisApiLogger(String name) { this.name = name; } + /** The log of Iris itself, for the world code that is not any module's. */ + static ModuleLog hostLog() { + return HOST_LOG; + } + @Override public String getName() { return name; } + /** Modules' debug lines follow Iris's debug setting, as Iris's own debug lines do. */ @Override public boolean isLoggable(Level level) { - return level != Level.OFF; + if (level == Level.OFF) { + return false; + } + if (level == Level.DEBUG || level == Level.TRACE) { + return isDebugEnabled(); + } + return true; + } + + private static boolean isDebugEnabled() { + boolean settingsAvailable = IrisSettings.settings != null || IrisPlatforms.isBound(); + return settingsAvailable && IrisSettings.get().getGeneral().isDebug(); } @Override diff --git a/core/src/main/java/art/arcane/iris/core/modules/IrisModuleHost.java b/core/src/main/java/art/arcane/iris/core/modules/IrisModuleHost.java index 6af3dbcbb..69ee86791 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/IrisModuleHost.java +++ b/core/src/main/java/art/arcane/iris/core/modules/IrisModuleHost.java @@ -33,6 +33,7 @@ import art.arcane.iris.engine.modifier.FloatingModule; import art.arcane.iris.engine.object.placement.PlacementModules; import art.arcane.iris.spi.IrisPlatforms; import com.volmit.IrisModule; +import com.volmit.ModuleLog; import com.volmit.host.ModuleHost; import com.volmit.host.PackModules; @@ -81,6 +82,11 @@ public final class IrisModuleHost { new FloatingModule(), new DepositModule(), new DecorantModule(), new CustomModule(), new LootModule(), new SpawnModule()); } + /** Iris's own log, labelled {@code [iris]}, for host code that calls module classes outside any module's stage, service or hook. */ + public static ModuleLog hostLog() { + return IrisApiLogger.hostLog(); + } + /** Whether {@code type} is one of Iris's own classes that built-in settings may hold. */ public static boolean isHostType(Class type) { return type.getName().startsWith(HOST_TYPE_PACKAGE + "."); diff --git a/core/src/main/java/art/arcane/iris/core/modules/IrisPackWorld.java b/core/src/main/java/art/arcane/iris/core/modules/IrisPackWorld.java index 51b358361..eee4832ee 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/IrisPackWorld.java +++ b/core/src/main/java/art/arcane/iris/core/modules/IrisPackWorld.java @@ -21,9 +21,12 @@ package art.arcane.iris.core.modules; import art.arcane.iris.builtin.IrisSeed; import art.arcane.iris.engine.framework.Engine; import art.arcane.iris.engine.framework.SeedManager; +import com.volmit.ModuleLog; import com.volmit.config.PackSettings; import com.volmit.host.WorldStates; import com.volmit.world.PackWorld; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; /** @@ -35,11 +38,21 @@ import java.util.function.Function; public final class IrisPackWorld implements PackWorld, IrisSeed.Source { private final Engine engine; private final IrisPackResources resources; - private final WorldStates states = new WorldStates(); + private final WorldStates states; + private final ModuleLog log; + private final Map viewsByLog; IrisPackWorld(Engine engine) { + this(engine, engine.getData().getPackResources(), new WorldStates(), IrisApiLogger.hostLog(), new ConcurrentHashMap<>()); + } + + private IrisPackWorld(Engine engine, IrisPackResources resources, WorldStates states, ModuleLog log, + Map viewsByLog) { this.engine = engine; - this.resources = engine.getData().getPackResources(); + this.resources = resources; + this.states = states; + this.log = log; + this.viewsByLog = viewsByLog; } /** Iris's own view of {@code world}, which Iris hands to every stage, service and lifecycle hook. */ @@ -75,6 +88,17 @@ public final class IrisPackWorld implements PackWorld, IrisSeed.Source { return states.state(type, () -> create.apply(this)); } + @Override + public ModuleLog log() { + return log; + } + + /** One view per log, since the services ask for a module's view on every call. */ + @Override + public IrisPackWorld withLog(ModuleLog log) { + return viewsByLog.computeIfAbsent(log, moduleLog -> new IrisPackWorld(engine, resources, states, moduleLog, viewsByLog)); + } + @Override public long seed(IrisSeed seed) { SeedManager seeds = engine.getSeedManager(); diff --git a/core/src/main/java/art/arcane/iris/core/modules/ModuleServices.java b/core/src/main/java/art/arcane/iris/core/modules/ModuleServices.java index d186fb042..0e585ab12 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/ModuleServices.java +++ b/core/src/main/java/art/arcane/iris/core/modules/ModuleServices.java @@ -21,6 +21,7 @@ package art.arcane.iris.core.modules; import art.arcane.iris.core.loader.IrisData; import art.arcane.iris.engine.framework.Engine; import com.volmit.host.FeatureCatalog; +import com.volmit.host.ServiceRegistration; import com.volmit.entity.EntitySpec; import com.volmit.item.ItemDrop; import com.volmit.service.AmbientEffects; @@ -50,36 +51,60 @@ public final class ModuleServices { private ModuleServices() { } + /** One provider of a service and the world as its module sees it, whose log is the module's own. */ + private record Provider(S service, PackWorld world) { + } + + /** Every provider of {@code service}, in the catalog's order, each with {@code world} scoped to its module. */ + private static List> providers(IrisData data, Class service, PackWorld world) { + List> providers = new ArrayList<>(); + for (ServiceRegistration registration : catalog(data).registrations(service)) { + providers.add(new Provider<>(service.cast(registration.provider()), registration.scope(world))); + } + return providers; + } + + private static List> providers(Engine engine, Class service) { + return providers(engine.getData(), service, engine.getGeneration().world()); + } + + private static Optional> firstProvider(Engine engine, Class service) { + List registrations = catalog(engine.getData()).registrations(service); + if (registrations.isEmpty()) { + return Optional.empty(); + } + ServiceRegistration first = registrations.get(0); + return Optional.of(new Provider<>(service.cast(first.provider()), first.scope(engine.getGeneration().world()))); + } + /** The pack biome key the module that decides cave biomes puts at the position, whatever the regions say; empty where it overrides nothing. {@code y} is the height above the dimension's bottom. */ public static Optional overriddenCaveBiome(Engine engine, int x, int y, int z) { - return catalog(engine.getData()).service(CaveBiomes.class) - .flatMap(provider -> provider.overriddenBiome(engine.getGeneration().world(), x, y, z)); + return firstProvider(engine, CaveBiomes.class) + .flatMap(provider -> provider.service().overriddenBiome(provider.world(), x, y, z)); } /** How many blocks below the surface the caves of the pack biome {@code biomeKey} begin; 0 where nothing limits them. */ public static int caveMinDepthBelowSurface(Engine engine, String biomeKey) { - return catalog(engine.getData()).service(CaveBiomes.class) - .map(provider -> provider.minDepthBelowSurface(engine.getGeneration().world(), biomeKey)) + return firstProvider(engine, CaveBiomes.class) + .map(provider -> provider.service().minDepthBelowSurface(provider.world(), biomeKey)) .orElse(0); } /** The objects every module would place in the chunk at {@code chunkX}, {@code chunkZ}, guessed without generating it. */ public static Set objectsAt(Engine engine, int chunkX, int chunkZ) { - PackWorld world = engine.getGeneration().world(); Set keys = new LinkedHashSet<>(); - for (ObjectsAt provider : catalog(engine.getData()).services(ObjectsAt.class)) { - keys.addAll(provider.objectsAt(world, chunkX, chunkZ)); + for (Provider provider : providers(engine, ObjectsAt.class)) { + keys.addAll(provider.service().objectsAt(provider.world(), chunkX, chunkZ)); } return keys; } /** The biomes and regions of the engine's layout that every module says place the object {@code objectKey}. */ public static ObjectsAt.PlacedBy objectPlacers(Engine engine, String objectKey) { - PackWorld world = engine.getGeneration().world(); Set biomes = new LinkedHashSet<>(); Set regions = new LinkedHashSet<>(); - for (ObjectsAt provider : catalog(engine.getData()).services(ObjectsAt.class)) { - ObjectsAt.PlacedBy placedBy = provider.placedBy(world, objectKey); + for (Provider provider : providers(engine, ObjectsAt.class)) { + ObjectsAt.PlacedBy placedBy = provider.service().placedBy(provider.world(), objectKey); biomes.addAll(placedBy.biomes()); regions.addAll(placedBy.regions()); } @@ -88,31 +113,28 @@ public final class ModuleServices { /** The loot tables the modules say the container at {@code site} draws from, in module order. */ public static List lootTables(Engine engine, Loot.Site site) { - PackWorld world = engine.getGeneration().world(); List tables = new ArrayList<>(); - for (Loot provider : catalog(engine.getData()).services(Loot.class)) { - tables.addAll(provider.tables(world, site)); + for (Provider provider : providers(engine, Loot.class)) { + tables.addAll(provider.service().tables(provider.world(), site)); } return tables; } /** The items loot table {@code key} gives at {@code site}, from the module that knows the table. */ public static List lootItems(Engine engine, Loot.Site site, String key) { - PackWorld world = engine.getGeneration().world(); List items = new ArrayList<>(); - for (Loot provider : catalog(engine.getData()).services(Loot.class)) { - items.addAll(provider.items(world, site, key)); + for (Provider provider : providers(engine, Loot.class)) { + items.addAll(provider.service().items(provider.world(), site, key)); } return items; } /** What the modules drop for the broken block, put together. */ public static BlockDrops.Result blockDrops(Engine engine, BlockDrops.Broken broken) { - PackWorld world = engine.getGeneration().world(); List drops = new ArrayList<>(); boolean replacesVanillaDrops = false; - for (BlockDrops provider : catalog(engine.getData()).services(BlockDrops.class)) { - BlockDrops.Result result = provider.drops(world, broken); + for (Provider provider : providers(engine, BlockDrops.class)) { + BlockDrops.Result result = provider.service().drops(provider.world(), broken); drops.addAll(result.drops()); replacesVanillaDrops |= result.replacesVanillaDrops(); } @@ -121,9 +143,8 @@ public final class ModuleServices { /** The tree grown by the first module that grows one for {@code sapling}; empty leaves the growth to the platform. */ public static Optional growSapling(Engine engine, SaplingGrowth.Sapling sapling, SaplingGrowth.Surroundings surroundings) { - PackWorld world = engine.getGeneration().world(); - for (SaplingGrowth provider : catalog(engine.getData()).services(SaplingGrowth.class)) { - Optional growth = provider.grow(world, sapling, surroundings); + for (Provider provider : providers(engine, SaplingGrowth.class)) { + Optional growth = provider.service().grow(provider.world(), sapling, surroundings); if (growth.isPresent()) { return growth; } @@ -133,11 +154,10 @@ public final class ModuleServices { /** The objects every module places as trees. */ public static SaplingGrowth.TreeObjects treeObjects(Engine engine) { - PackWorld world = engine.getGeneration().world(); Set objects = new LinkedHashSet<>(); Set procedural = new LinkedHashSet<>(); - for (SaplingGrowth provider : catalog(engine.getData()).services(SaplingGrowth.class)) { - SaplingGrowth.TreeObjects trees = provider.treeObjects(world); + for (Provider provider : providers(engine, SaplingGrowth.class)) { + SaplingGrowth.TreeObjects trees = provider.service().treeObjects(provider.world()); objects.addAll(trees.objects()); procedural.addAll(trees.procedural()); } @@ -146,11 +166,10 @@ public final class ModuleServices { /** What the first module with something to spawn at {@code site} plans; empty when none does. */ public static Optional planSpawn(Engine engine, EntitySpawns.Site site) { - PackWorld world = engine.getGeneration().world(); - for (EntitySpawns provider : catalog(engine.getData()).services(EntitySpawns.class)) { - Optional plan = provider.plan(world, site); + for (Provider provider : providers(engine, EntitySpawns.class)) { + Optional plan = provider.service().plan(provider.world(), site); if (plan.isPresent()) { - return Optional.of(new PlannedSpawn(provider, world, plan.get())); + return Optional.of(new PlannedSpawn(provider.service(), provider.world(), plan.get())); } } return Optional.empty(); @@ -158,9 +177,8 @@ public final class ModuleServices { /** The entity {@code key} as the first module that knows it would spawn it. */ public static Optional entity(Engine engine, String key) { - PackWorld world = engine.getGeneration().world(); - for (EntitySpawns provider : catalog(engine.getData()).services(EntitySpawns.class)) { - Optional entity = provider.entity(world, key); + for (Provider provider : providers(engine, EntitySpawns.class)) { + Optional entity = provider.service().entity(provider.world(), key); if (entity.isPresent()) { return entity; } @@ -170,9 +188,8 @@ public final class ModuleServices { /** What the first module that knows the marker {@code tag} says it does. */ public static Optional markerRule(Engine engine, String tag) { - PackWorld world = engine.getGeneration().world(); - for (EntitySpawns provider : catalog(engine.getData()).services(EntitySpawns.class)) { - Optional rule = provider.marker(world, tag); + for (Provider provider : providers(engine, EntitySpawns.class)) { + Optional rule = provider.service().marker(provider.world(), tag); if (rule.isPresent()) { return rule; } @@ -182,10 +199,9 @@ public final class ModuleServices { /** The ambient effects every module says are due for a player standing at {@code at}, in module order. */ public static List ambientEffects(Engine engine, BlockPosition at) { - PackWorld world = engine.getGeneration().world(); List effects = new ArrayList<>(); - for (AmbientEffects provider : catalog(engine.getData()).services(AmbientEffects.class)) { - effects.addAll(provider.due(world, at)); + for (Provider provider : providers(engine, AmbientEffects.class)) { + effects.addAll(provider.service().due(provider.world(), at)); } return effects; } @@ -208,10 +224,9 @@ public final class ModuleServices { /** The keys of the structures the world's modules place and can locate. */ public static Set locatableStructures(Engine engine) { - PackWorld world = engine.getGeneration().world(); Set keys = new LinkedHashSet<>(); - for (StructureLocator provider : catalog(engine.getData()).services(StructureLocator.class)) { - keys.addAll(provider.locatable(world)); + for (Provider provider : providers(engine, StructureLocator.class)) { + keys.addAll(provider.service().locatable(provider.world())); } return keys; } @@ -226,9 +241,8 @@ public final class ModuleServices { * can locate it, in the world's own coordinates; not found when none can. */ public static StructureSearch locateStructure(Engine engine, String key, int fromX, int fromZ, int maxRadiusChunks) { - PackWorld world = engine.getGeneration().world(); LocateResult result = structureLocatorOf(engine, key) - .map(provider -> provider.locate(world, key, fromX, fromZ, maxRadiusChunks)) + .map(provider -> provider.service().locate(provider.world(), key, fromX, fromZ, maxRadiusChunks)) .orElse(LocateResult.NOT_FOUND); return StructureSearch.of(result, engine); } @@ -256,14 +270,13 @@ public final class ModuleServices { } /** The first provider, in the catalog's order, whose locatable structures hold {@code key}. */ - private static Optional structureLocatorOf(Engine engine, String key) { + private static Optional> structureLocatorOf(Engine engine, String key) { if (key == null || key.isBlank()) { return Optional.empty(); } - PackWorld world = engine.getGeneration().world(); String wanted = normalized(key); - for (StructureLocator provider : catalog(engine.getData()).services(StructureLocator.class)) { - if (provider.locatable(world).stream().map(ModuleServices::normalized).anyMatch(wanted::equals)) { + for (Provider provider : providers(engine, StructureLocator.class)) { + if (provider.service().locatable(provider.world()).stream().map(ModuleServices::normalized).anyMatch(wanted::equals)) { return Optional.of(provider); } } diff --git a/core/src/main/java/art/arcane/iris/core/modules/ModuleStructureFitting.java b/core/src/main/java/art/arcane/iris/core/modules/ModuleStructureFitting.java index 5fb14c406..381b7121d 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/ModuleStructureFitting.java +++ b/core/src/main/java/art/arcane/iris/core/modules/ModuleStructureFitting.java @@ -43,6 +43,7 @@ import com.volmit.vanilla.StructureFit; import com.volmit.vanilla.StructureStep; import com.volmit.vanilla.TemplateCells; import com.volmit.vanilla.TerrainAdaptation; +import com.volmit.ModuleLog; import com.volmit.world.BlockAccess; import com.volmit.world.BlockPosition; import com.volmit.world.PackWorld; @@ -96,17 +97,21 @@ public final class ModuleStructureFitting implements NativeStructureFitting { @Override public Session beforePieces(NativeFitChunk chunk) { - ChunkFit fit = new ChunkFit<>(chunk, world); - for (ServiceRegistration registration : providers) { - ModuleVanillaStructures.ask(registration, "fitting structures into chunk " + fit.chunkName(), provider -> { + List> fits = providers.stream() + .>map(registration -> new ChunkFit<>(chunk, () -> registration.scope(world.get()), registration.module().log())) + .toList(); + for (int index = 0; index < providers.size(); index++) { + ChunkFit fit = fits.get(index); + ModuleVanillaStructures.ask(providers.get(index), "fitting structures into chunk " + fit.chunkName(), provider -> { provider.beforePieces(fit); return Boolean.TRUE; }); } return startIndex -> { - StructureFit.Start placed = fit.starts().get(startIndex); - for (ServiceRegistration registration : providers) { - ModuleVanillaStructures.ask(registration, "fitting " + placed.structure() + " into chunk " + fit.chunkName(), + for (int index = 0; index < providers.size(); index++) { + ChunkFit fit = fits.get(index); + StructureFit.Start placed = fit.starts().get(startIndex); + ModuleVanillaStructures.ask(providers.get(index), "fitting " + placed.structure() + " into chunk " + fit.chunkName(), provider -> { provider.afterPieces(fit, placed); return Boolean.TRUE; @@ -145,13 +150,15 @@ public final class ModuleStructureFitting implements NativeStructureFitting { private static final class ChunkFit implements StructureFit { private final NativeFitChunk chunk; private final Supplier world; + private final ModuleLog log; private final Access blocks; private final List starts; private final Map, Object> states = new HashMap<>(); - private ChunkFit(NativeFitChunk chunk, Supplier world) { + private ChunkFit(NativeFitChunk chunk, Supplier world, ModuleLog log) { this.chunk = chunk; this.world = world; + this.log = log; this.blocks = new Access<>(chunk); List converted = new ArrayList<>(chunk.starts().size()); for (NativeFitStart start : chunk.starts()) { @@ -169,6 +176,11 @@ public final class ModuleStructureFitting implements NativeStructureFitting { return world.get(); } + @Override + public ModuleLog log() { + return log; + } + @Override public long seed() { return chunk.seed(); diff --git a/core/src/main/java/art/arcane/iris/core/modules/ModuleVanillaStructures.java b/core/src/main/java/art/arcane/iris/core/modules/ModuleVanillaStructures.java index 1c1a6d3c8..9c526c2ff 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/ModuleVanillaStructures.java +++ b/core/src/main/java/art/arcane/iris/core/modules/ModuleVanillaStructures.java @@ -88,11 +88,11 @@ public final class ModuleVanillaStructures { * as the host's plans: world heights, the platform's jigsaw changes and the modules' memos. */ public static List startsAt(Engine engine, int chunkX, int chunkZ) { - StartContext context = new StartContext(engine.getGeneration().world(), - new IrisTerrainSampler(engine, new PackResourceIds(engine.getData().getDataFolder()), - chunkX << 4, chunkZ << 4, START_TERRAIN_REACH_BLOCKS)); + TerrainSampler terrain = new IrisTerrainSampler(engine, new PackResourceIds(engine.getData().getDataFolder()), + chunkX << 4, chunkZ << 4, START_TERRAIN_REACH_BLOCKS); List plans = new ArrayList<>(); for (ServiceRegistration registration : providersOf(engine.getData())) { + StartContext context = new StartContext(registration.scope(engine.getGeneration().world()), terrain); for (VanillaStructureStart start : ask(registration, "placing starts in chunk " + chunkX + "," + chunkZ, provider -> provider.starts(chunkX, chunkZ, context))) { plans.add(plan(registration.module(), start, chunkX, chunkZ, engine.getMinHeight())); diff --git a/core/src/main/java/art/arcane/iris/core/modules/StructureAssemblies.java b/core/src/main/java/art/arcane/iris/core/modules/StructureAssemblies.java new file mode 100644 index 000000000..77fed47dd --- /dev/null +++ b/core/src/main/java/art/arcane/iris/core/modules/StructureAssemblies.java @@ -0,0 +1,38 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.core.modules; + +import art.arcane.iris.core.loader.IrisData; +import art.arcane.iris.engine.framework.StructureAssembler; +import art.arcane.iris.engine.object.structure.IrisStructure; +import art.arcane.iris.engine.object.value.IrisPosition; + +/** + * Structure assembly for Iris's own tools, the commands and studio, which run outside any module's stage, service or hook and so + * log as Iris itself. + */ +public final class StructureAssemblies { + private StructureAssemblies() { + } + + /** The assembler of {@code structure}, compiled from the pack {@code data} serves, for a start at {@code origin}. */ + public static StructureAssembler forData(IrisData data, IrisStructure structure, IrisPosition origin) { + return StructureAssembler.forData(data, structure, origin, IrisModuleHost.hostLog()); + } +} diff --git a/core/src/main/java/art/arcane/iris/core/service/JigsawStudioService.java b/core/src/main/java/art/arcane/iris/core/service/JigsawStudioService.java index 14b61bb66..534e6d76f 100644 --- a/core/src/main/java/art/arcane/iris/core/service/JigsawStudioService.java +++ b/core/src/main/java/art/arcane/iris/core/service/JigsawStudioService.java @@ -2,6 +2,7 @@ package art.arcane.iris.core.service; import art.arcane.iris.engine.framework.structure.StructureResources; import art.arcane.iris.core.loader.IrisData; +import art.arcane.iris.core.modules.StructureAssemblies; import art.arcane.iris.core.nms.INMS; import art.arcane.iris.core.runtime.InPlaceChunkRegenerator; import art.arcane.iris.core.runtime.jigsaw.JigsawPlanarArchetype; @@ -2476,7 +2477,7 @@ public final class JigsawStudioService implements IrisService, JigsawStudioMenuC if (structure == null) { throw new IOException("The active structure resource no longer exists"); } - StructureAssembler assembler = StructureAssembler.forData( + StructureAssembler assembler = StructureAssemblies.forData( request.source(), structure, origin); StructureAssemblyResult assembly = assembler.assemble(new RNG(seed)); if (!assembly.hasOutput()) { diff --git a/core/src/test/java/art/arcane/iris/core/DiagnosticSeverityPolicyTest.java b/core/src/test/java/art/arcane/iris/core/DiagnosticSeverityPolicyTest.java index 2ba2e1971..8794c3fc3 100644 --- a/core/src/test/java/art/arcane/iris/core/DiagnosticSeverityPolicyTest.java +++ b/core/src/test/java/art/arcane/iris/core/DiagnosticSeverityPolicyTest.java @@ -8,6 +8,8 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Stream; import static org.junit.Assert.assertEquals; @@ -155,6 +157,9 @@ public class DiagnosticSeverityPolicyTest { assertLoggedWith("core/pregenerator/IrisPregenerator.java", "Pregen finished: ", "notice"); } + /** The last logging call before a message: Iris's static front door, or a module's own log. */ + private static final Pattern LOGGING_CALL = Pattern.compile("(?:IrisLogging\\.|\\blog\\.|\\blog\\(\\)\\.)(\\w+)"); + private static void assertLoggedWith(String relativePath, String fragment, String expectedMethod) { String source; try { @@ -173,14 +178,13 @@ public class DiagnosticSeverityPolicyTest { } private static String loggingMethodBefore(String source, int at, String relativePath, String fragment) { - int call = source.lastIndexOf("IrisLogging.", at); - assertTrue(relativePath + " @ \"" + fragment + "\" is not logged through IrisLogging", call >= 0); - int start = call + "IrisLogging.".length(); - int end = start; - while (end < source.length() && Character.isJavaIdentifierPart(source.charAt(end))) { - end++; + String method = null; + Matcher calls = LOGGING_CALL.matcher(source.substring(0, at)); + while (calls.find()) { + method = calls.group(1); } - return source.substring(start, end); + assertTrue(relativePath + " @ \"" + fragment + "\" is not logged through IrisLogging or a ModuleLog", method != null); + return method; } private static String read(String relativePath) throws IOException { diff --git a/core/src/test/java/art/arcane/iris/core/modules/ModuleLogTest.java b/core/src/test/java/art/arcane/iris/core/modules/ModuleLogTest.java new file mode 100644 index 000000000..8990b6d8e --- /dev/null +++ b/core/src/test/java/art/arcane/iris/core/modules/ModuleLogTest.java @@ -0,0 +1,178 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.core.modules; + +import art.arcane.iris.builtin.IrisSeed; +import art.arcane.iris.core.IrisSettings; +import art.arcane.iris.core.loader.IrisData; +import art.arcane.iris.engine.framework.Engine; +import art.arcane.iris.engine.framework.SeedManager; +import art.arcane.iris.engine.object.world.dimension.IrisDimension; +import art.arcane.iris.spi.IrisPlatforms; +import com.volmit.ModuleLog; +import com.volmit.host.ModuleLogs; +import com.volmit.world.PackWorld; +import org.junit.After; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * A module's log is written to Iris's log with the module's id in front, follows Iris's debug setting and reports a failure like + * Iris's own; the world a module is handed carries the module's log. + */ +public class ModuleLogTest { + private static final String MODULE = "iris:decorant"; + private static final long POST_SEED = 9L; + + private final ByteArrayOutputStream out = new ByteArrayOutputStream(); + private final ByteArrayOutputStream err = new ByteArrayOutputStream(); + private PrintStream originalOut; + private PrintStream originalErr; + private IrisSettings originalSettings; + private IrisSettings settings; + + @Before + public void captureTheProcessStreamsIrisLogsToWhenNoPlatformIsBound() { + Assume.assumeFalse("a platform is bound, so the log does not go to the process streams", IrisPlatforms.isBound()); + originalOut = System.out; + originalErr = System.err; + originalSettings = IrisSettings.settings; + System.setOut(new PrintStream(out, true, StandardCharsets.UTF_8)); + System.setErr(new PrintStream(err, true, StandardCharsets.UTF_8)); + settings = new IrisSettings(); + IrisSettings.settings = settings; + } + + @After + public void restoreTheProcessStreams() { + if (originalOut == null) { + return; + } + System.setOut(originalOut); + System.setErr(originalErr); + IrisSettings.settings = originalSettings; + } + + @Test + public void everyLevelCarriesTheModulesIdAndKeepsItsSeverity() { + settings.getGeneral().debug = true; + ModuleLog log = log(); + + log.debug("shown for debugging"); + log.info("started"); + log.warn("unusual"); + log.error("failed", null); + + assertTrue(out(), out().contains("[Iris/DEBUG] [iris:decorant] shown for debugging")); + assertTrue(out(), out().contains("[Iris/INFO] [iris:decorant] started")); + assertTrue(err(), err().contains("[Iris/WARN] [iris:decorant] unusual")); + assertTrue(err(), err().contains("[Iris/ERROR] [iris:decorant] failed")); + } + + @Test + public void debugFollowsIrisDebugSetting() { + ModuleLog log = log(); + + settings.getGeneral().debug = false; + log.debug("while off"); + settings.getGeneral().debug = true; + log.debug("while on"); + + assertFalse(out(), out().contains("while off")); + assertTrue(out(), out().contains("while on")); + } + + @Test + public void anErrorWithACauseIsReportedLikeIrisReportsItsOwnFailures() { + log().error("Failed to place a plant", new IllegalStateException("boom")); + + assertTrue(err(), err().contains("[Iris/ERROR] [iris:decorant] Failed to place a plant")); + assertTrue(err(), err().contains("java.lang.IllegalStateException: boom")); + } + + @Test + public void warnOnceWarnsOnceAndDebugsAfterwards() { + settings.getGeneral().debug = false; + ModuleLog log = log(); + + log.warnOnce("empty:plains", "Empty block data for plains"); + log.warnOnce("empty:plains", "Empty block data for plains"); + + assertEquals(err(), 1, err().split("Empty block data for plains", -1).length - 1); + assertFalse(out(), out().contains("Empty block data")); + } + + @Test + public void aWorldViewCarriesTheModulesLogAndSharesTheWorldsState() { + Engine engine = mock(Engine.class); + when(engine.getData()).thenReturn(mock(IrisData.class)); + when(engine.getDimension()).thenReturn(new IrisDimension()); + SeedManager seeds = mock(SeedManager.class); + when(seeds.getPost()).thenReturn(POST_SEED); + when(engine.getSeedManager()).thenReturn(seeds); + IrisPackWorld world = new IrisPackWorld(engine); + ModuleLog decorant = log(); + + PackWorld view = world.withLog(decorant); + + assertSame(decorant, view.log()); + assertSame("one view per module", view, world.withLog(decorant)); + assertSame(view, view.withLog(decorant)); + assertSame("state is the world's", world.state(Marker.class, ignored -> new Marker()), view.state(Marker.class, ignored -> new Marker())); + assertSame("Iris's own code still reaches the engine through a view", engine, IrisPackWorld.of(view).engine()); + assertEquals("and its seeds", POST_SEED, IrisSeed.POST.of(view)); + } + + @Test + public void theWorldItselfLogsAsIris() { + Engine engine = mock(Engine.class); + when(engine.getData()).thenReturn(mock(IrisData.class)); + + new IrisPackWorld(engine).log().warn("host line"); + + assertTrue(err(), err().contains("[Iris/WARN] [iris] host line")); + } + + private static ModuleLog log() { + return ModuleLogs.labelled(MODULE, new IrisApiLogger("test")); + } + + private String out() { + return out.toString(StandardCharsets.UTF_8); + } + + private String err() { + return err.toString(StandardCharsets.UTF_8); + } + + private static final class Marker { + } +} diff --git a/core/src/test/java/art/arcane/iris/core/modules/ModuleServicesTest.java b/core/src/test/java/art/arcane/iris/core/modules/ModuleServicesTest.java index 72c8d8f01..8eaf36b4e 100644 --- a/core/src/test/java/art/arcane/iris/core/modules/ModuleServicesTest.java +++ b/core/src/test/java/art/arcane/iris/core/modules/ModuleServicesTest.java @@ -25,6 +25,7 @@ import art.arcane.iris.engine.framework.SeedManager; import com.volmit.FeatureRegistry; import com.volmit.IrisModule; import com.volmit.ModuleInfo; +import com.volmit.ModuleLog; import com.volmit.host.LoadedPack; import com.volmit.host.ModuleHost; import com.volmit.resource.PackResources; @@ -60,6 +61,7 @@ public class ModuleServicesTest { public TemporaryFolder folder = new TemporaryFolder(); private final List searches = new ArrayList<>(); + private final List logOwners = new ArrayList<>(); private LoadedPack pack; private IrisData data; private Engine engine; @@ -87,9 +89,11 @@ public class ModuleServicesTest { @Override public void register(FeatureRegistry registry) { + ModuleLog registeredLog = registry.log(); registry.registerService(ObjectsAt.class, new ObjectsAt() { @Override public Set objectsAt(PackWorld world, int chunkX, int chunkZ) { + logOwners.add(id + (world.log() == registeredLog ? " has its own log" : " has another module's log")); return Set.of(object + "@" + chunkX + "," + chunkZ); } @@ -151,6 +155,13 @@ public class ModuleServicesTest { assertEquals(List.of("tree@3,-4", "bush@3,-4", "rock@3,-4"), List.copyOf(ModuleServices.objectsAt(engine, 3, -4))); } + @Test + public void everyModuleIsAskedWithAWorldCarryingItsOwnLog() { + ModuleServices.objectsAt(engine, 0, 0); + + assertEquals(List.of("test:alpha has its own log", "test:beta has its own log", "test:zeta has its own log"), logOwners); + } + @Test public void objectPlacersCombineTheBiomesAndRegionsOfEveryModule() { ObjectsAt.PlacedBy placers = ModuleServices.objectPlacers(engine, "trees/oak"); diff --git a/core/src/test/java/art/arcane/iris/engine/GenerationCacheWarmGateTest.java b/core/src/test/java/art/arcane/iris/engine/GenerationCacheWarmGateTest.java index f328f8e1c..b17525ba3 100644 --- a/core/src/test/java/art/arcane/iris/engine/GenerationCacheWarmGateTest.java +++ b/core/src/test/java/art/arcane/iris/engine/GenerationCacheWarmGateTest.java @@ -106,6 +106,10 @@ public class GenerationCacheWarmGateTest { return new EngineGeneration(engine); } + /** Worlds the modules are handed are views of the generation's world, so they are told apart by what they share. */ + private static final class WorldMarker { + } + @Test public void generationWaitsForAModulesSlowWarmUp() throws Exception { GenerationCacheWarmGate gate = new GenerationCacheWarmGate(); @@ -126,7 +130,9 @@ public class GenerationCacheWarmGateTest { warmUp.get(WAIT_SECONDS, TimeUnit.SECONDS); generating.get(WAIT_SECONDS, TimeUnit.SECONDS); assertFalse(gate.isPending()); - assertSame("the module warmed the world it started", generation.world(), module.warmed); + assertSame("the module warmed the world it started", + generation.world().state(WorldMarker.class, ignored -> new WorldMarker()), + module.warmed.state(WorldMarker.class, ignored -> new WorldMarker())); } finally { module.release.countDown(); background.shutdownNow(); diff --git a/core/src/test/java/art/arcane/iris/engine/actuator/TerrainLayersPinTest.java b/core/src/test/java/art/arcane/iris/engine/actuator/TerrainLayersPinTest.java index dd7be2bd7..879d71bb2 100644 --- a/core/src/test/java/art/arcane/iris/engine/actuator/TerrainLayersPinTest.java +++ b/core/src/test/java/art/arcane/iris/engine/actuator/TerrainLayersPinTest.java @@ -18,6 +18,7 @@ import art.arcane.iris.spi.PlatformBlockState; import art.arcane.iris.util.project.stream.ProceduralStream; import art.arcane.volmlib.util.collection.KList; import art.arcane.volmlib.util.math.RNG; +import com.volmit.host.ModuleLogs; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -131,7 +132,7 @@ public class TerrainLayersPinTest { RNG rng = new RNG(TERRAIN_SEED); IrisBiome biome = new IrisBiome(); biome.setModuleSettings(TerrainTestSettings.of(biomeJson)); - BiomeLayers layers = new BiomeLayers(TestLayerBlocks.of(data.getPackResources())); + BiomeLayers layers = new BiomeLayers(TestLayerBlocks.of(data.getPackResources()), ModuleLogs.discarding()); for (int x = -COLUMN_RANGE; x < COLUMN_RANGE; x += COLUMN_STEP_X) { for (int z = -COLUMN_RANGE; z < COLUMN_RANGE; z += COLUMN_STEP_Z) { transcript.append('|').append(keys(layers.generateLayers(biome, dimension, x, z, rng, 14, 70 + Math.floorMod(x + z, 9), data, complex))); diff --git a/core/src/test/java/art/arcane/iris/engine/decorator/BiomeDecoratorsTest.java b/core/src/test/java/art/arcane/iris/engine/decorator/BiomeDecoratorsTest.java index 2567e032c..f015ff3d1 100644 --- a/core/src/test/java/art/arcane/iris/engine/decorator/BiomeDecoratorsTest.java +++ b/core/src/test/java/art/arcane/iris/engine/decorator/BiomeDecoratorsTest.java @@ -15,6 +15,7 @@ import art.arcane.iris.engine.object.world.biome.IrisBiome; import art.arcane.iris.engine.object.world.dimension.IrisDimension; import art.arcane.volmlib.util.collection.KList; import com.google.gson.Gson; +import com.volmit.host.ModuleLogs; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -65,7 +66,7 @@ public class BiomeDecoratorsTest { bare = mock(IrisBiome.class); when(bare.getLoadKey()).thenReturn("bare"); when(bare.getModuleSettings()).thenReturn(ModuleSettings.NONE); - decorators = new BiomeDecorators(engine); + decorators = new BiomeDecorators(engine, ModuleLogs.discarding()); } @After @@ -104,7 +105,7 @@ public class BiomeDecoratorsTest { assertEquals("biome meadow, index 2", DECORATOR_SEED + "meadow".hashCode() * 0x9E3779B97F4A7C15L + 2 * 0xC2B2AE3D27D4EB4FL, second); assertNotEquals(first, second); assertEquals("another build of the same world draws the same seeds", first, - seedOf(new BiomeDecorators(engine).decorators(meadow, DecorationPart.NONE)[0])); + seedOf(new BiomeDecorators(engine, ModuleLogs.discarding()).decorators(meadow, DecorationPart.NONE)[0])); } @Test diff --git a/core/src/test/java/art/arcane/iris/engine/decorator/DecoratorCoreTest.java b/core/src/test/java/art/arcane/iris/engine/decorator/DecoratorCoreTest.java index 67dbf2ff9..816a66b91 100644 --- a/core/src/test/java/art/arcane/iris/engine/decorator/DecoratorCoreTest.java +++ b/core/src/test/java/art/arcane/iris/engine/decorator/DecoratorCoreTest.java @@ -4,6 +4,7 @@ import art.arcane.iris.builtin.decorant.DecorationPart; import art.arcane.iris.spi.PlatformBlockState; import art.arcane.iris.util.project.hunk.Hunk; import art.arcane.volmlib.util.math.RNG; +import com.volmit.host.ModuleLogs; import org.bukkit.block.BlockSupport; import org.bukkit.block.data.BlockData; import org.junit.Test; @@ -61,7 +62,7 @@ public class DecoratorCoreTest { @Test public void pickDecorator_emptyBucket_returnsNull() { - ResolvedDecorator result = DecoratorCore.pickDecorator(new ResolvedDecorator[0], new RNG(2L), 0.0, 0.0); + ResolvedDecorator result = DecoratorCore.pickDecorator(new ResolvedDecorator[0], new RNG(2L), 0.0, 0.0, ModuleLogs.discarding()); assertNull(result); } @@ -70,7 +71,7 @@ public class DecoratorCoreTest { ResolvedDecorator d = mock(ResolvedDecorator.class); when(d.passesChanceGate(anyDouble(), anyDouble())).thenReturn(false); - ResolvedDecorator result = DecoratorCore.pickDecorator(new ResolvedDecorator[]{d}, new RNG(2L), 0.0, 0.0); + ResolvedDecorator result = DecoratorCore.pickDecorator(new ResolvedDecorator[]{d}, new RNG(2L), 0.0, 0.0, ModuleLogs.discarding()); assertNull(result); } @@ -80,7 +81,7 @@ public class DecoratorCoreTest { when(d.passesChanceGate(anyDouble(), anyDouble())).thenReturn(true); for (int t = 0; t < 50; t++) { - ResolvedDecorator result = DecoratorCore.pickDecorator(new ResolvedDecorator[]{d}, new RNG(t * 13L + 7), 0.0, 0.0); + ResolvedDecorator result = DecoratorCore.pickDecorator(new ResolvedDecorator[]{d}, new RNG(t * 13L + 7), 0.0, 0.0, ModuleLogs.discarding()); assertSame(d, result); } } @@ -99,7 +100,7 @@ public class DecoratorCoreTest { int trials = 2000; for (int t = 0; t < trials; t++) { - ResolvedDecorator picked = DecoratorCore.pickDecorator(decorators, new RNG(t * 31L + 3), 0.0, 0.0); + ResolvedDecorator picked = DecoratorCore.pickDecorator(decorators, new RNG(t * 31L + 3), 0.0, 0.0, ModuleLogs.discarding()); assertNotNull(picked); for (int i = 0; i < n; i++) { if (picked == decorators[i]) { @@ -281,7 +282,7 @@ public class DecoratorCoreTest { output.set(0, 2, 0, occupied); DecoratorCore.placeSurfaceSingle( - decorator, 0, 0, 0, 0, 0, output, false, false, null); + decorator, 0, 0, 0, 0, 0, output, false, false, null, ModuleLogs.discarding()); assertSame(air, output.get(0, 1, 0)); assertSame(occupied, output.get(0, 2, 0)); @@ -300,7 +301,7 @@ public class DecoratorCoreTest { output.set(0, 2, 0, occupied); DecoratorCore.placeFloatingSimple( - decorator, 0, 0, 0, 0, 0, 3, output); + decorator, 0, 0, 0, 0, 0, 3, output, ModuleLogs.discarding()); assertSame(air, output.get(0, 1, 0)); assertSame(occupied, output.get(0, 2, 0)); @@ -324,7 +325,7 @@ public class DecoratorCoreTest { output.set(0, 2, 0, upperAir); DecoratorCore.placeSurfaceSingle( - decorator, 0, 0, 0, 0, 0, output, false, false, null); + decorator, 0, 0, 0, 0, 0, output, false, false, null, ModuleLogs.discarding()); assertSame(lower, output.get(0, 1, 0)); assertSame(upper, output.get(0, 2, 0)); @@ -344,7 +345,7 @@ public class DecoratorCoreTest { output.set(0, 1, 0, air); DecoratorCore.placeSurfaceSingle( - decorator, 0, 0, 0, 0, 0, output, false, false, null); + decorator, 0, 0, 0, 0, 0, output, false, false, null, ModuleLogs.discarding()); assertSame(air, output.get(0, 1, 0)); } @@ -365,7 +366,7 @@ public class DecoratorCoreTest { output.set(0, 1, 0, air); DecoratorCore.placeSurfaceSingle( - decorator, 0, 0, 0, 0, 0, output, false, false, null); + decorator, 0, 0, 0, 0, 0, output, false, false, null, ModuleLogs.discarding()); assertSame(farmland, output.get(0, 0, 0)); assertSame(wheat, output.get(0, 1, 0)); diff --git a/core/src/test/java/art/arcane/iris/engine/decorator/ResolvedDecoratorTest.java b/core/src/test/java/art/arcane/iris/engine/decorator/ResolvedDecoratorTest.java index 6ec387162..44eb89c21 100644 --- a/core/src/test/java/art/arcane/iris/engine/decorator/ResolvedDecoratorTest.java +++ b/core/src/test/java/art/arcane/iris/engine/decorator/ResolvedDecoratorTest.java @@ -10,6 +10,7 @@ import art.arcane.iris.engine.object.material.IrisBlockData; import art.arcane.iris.engine.object.world.biome.IrisBiome; import art.arcane.iris.spi.PlatformBlockState; import com.google.gson.Gson; +import com.volmit.host.ModuleLogs; import com.volmit.noise.NoiseFactory; import com.volmit.noise.NoiseSampler; import org.junit.After; @@ -55,7 +56,7 @@ public class ResolvedDecoratorTest { Gson gson = new Gson(); StringBuilder transcript = new StringBuilder(); for (String json : DECORATORS) { - ResolvedDecorator resolved = ResolvedDecorator.of(gson.fromJson(json, Decorator.class), engine, SEED); + ResolvedDecorator resolved = ResolvedDecorator.of(gson.fromJson(json, Decorator.class), engine, SEED, ModuleLogs.discarding()); for (int x = -40; x < 40; x += 3) { for (int z = -40; z < 40; z += 5) { transcript.append(resolved.passesChanceGate(x, z)).append(resolved.stackHeight(x, z)).append(key(resolved.pickBlock(x, z))) @@ -82,7 +83,7 @@ public class ResolvedDecoratorTest { }; Decorator decorator = new Gson().fromJson("{\"style\": {\"style\": \"SIMPLEX\"}, \"variance\": {\"style\": \"PERLIN\"}, \"heightVariance\": {\"style\": \"CLOVER\"}," + "\"stackMin\": 2, \"stackMax\": 7}", Decorator.class); - ResolvedDecorator resolved = new ResolvedDecorator(decorator, SEED, recording, state("a", "b", "b"), List.of(), null, List.of(), List.of()); + ResolvedDecorator resolved = new ResolvedDecorator(decorator, SEED, recording, state("a", "b", "b"), List.of(), null, List.of(), List.of(), ModuleLogs.discarding()); resolved.warm(); @@ -94,7 +95,7 @@ public class ResolvedDecoratorTest { NoiseFactory refusing = (style, seed) -> { throw new IllegalStateException("no noise"); }; - ResolvedDecorator single = new ResolvedDecorator(new Decorator(), SEED, refusing, state("a"), List.of(), null, List.of(), List.of()); + ResolvedDecorator single = new ResolvedDecorator(new Decorator(), SEED, refusing, state("a"), List.of(), null, List.of(), List.of(), ModuleLogs.discarding()); assertEquals("a one block palette never needs its variance noise", "minecraft:a", single.pickBlock(1, 2).key()); assertEquals("equal limits never need the height noise", 1, single.stackHeight(1, 2)); @@ -104,8 +105,8 @@ public class ResolvedDecoratorTest { @Test public void stackHeightFollowsTheHeightNoiseBetweenTheLimits() { Decorator decorator = new Gson().fromJson("{\"stackMin\": 1, \"stackMax\": 2}", Decorator.class); - ResolvedDecorator top = new ResolvedDecorator(decorator, SEED, (style, seed) -> constant(1.0), state("a"), List.of(), null, List.of(), List.of()); - ResolvedDecorator bottom = new ResolvedDecorator(decorator, SEED, (style, seed) -> constant(0.0), state("a"), List.of(), null, List.of(), List.of()); + ResolvedDecorator top = new ResolvedDecorator(decorator, SEED, (style, seed) -> constant(1.0), state("a"), List.of(), null, List.of(), List.of(), ModuleLogs.discarding()); + ResolvedDecorator bottom = new ResolvedDecorator(decorator, SEED, (style, seed) -> constant(0.0), state("a"), List.of(), null, List.of(), List.of(), ModuleLogs.discarding()); assertEquals(2, top.stackHeight(0, 0)); assertEquals(1, bottom.stackHeight(0, 0)); @@ -117,8 +118,8 @@ public class ResolvedDecoratorTest { PlatformBlockState stone = state("stone").get(0); Decorator listed = new Gson().fromJson("{\"whitelist\": [{\"block\": \"sand\"}], \"blacklist\": [{\"block\": \"stone\"}]}", Decorator.class); ResolvedDecorator resolved = new ResolvedDecorator(listed, SEED, (style, seed) -> constant(0), state("a"), List.of(), - null, List.of(sand), List.of(stone)); - ResolvedDecorator unlisted = new ResolvedDecorator(new Decorator(), SEED, (style, seed) -> constant(0), state("a"), List.of(), null, List.of(), List.of()); + null, List.of(sand), List.of(stone), ModuleLogs.discarding()); + ResolvedDecorator unlisted = new ResolvedDecorator(new Decorator(), SEED, (style, seed) -> constant(0), state("a"), List.of(), null, List.of(), List.of(), ModuleLogs.discarding()); assertFalse(resolved.rejectsSurface(sand)); assertTrue(resolved.rejectsSurface(stone)); @@ -130,9 +131,9 @@ public class ResolvedDecoratorTest { public void onlyASlopeOutsideTheLimitsBlocksAndOnlyWhenTheDecoratorLimitsIt() { Decorator limited = new Gson().fromJson("{\"slopeCondition\": {\"maximumSlope\": 4}}", Decorator.class); Decorator forced = new Gson().fromJson("{\"forcePlace\": true, \"slopeCondition\": {\"maximumSlope\": 4}}", Decorator.class); - ResolvedDecorator resolvedLimited = new ResolvedDecorator(limited, SEED, (style, seed) -> constant(0), state("a"), List.of(), null, List.of(), List.of()); - ResolvedDecorator resolvedForced = new ResolvedDecorator(forced, SEED, (style, seed) -> constant(0), state("a"), List.of(), null, List.of(), List.of()); - ResolvedDecorator resolvedDefault = new ResolvedDecorator(new Decorator(), SEED, (style, seed) -> constant(0), state("a"), List.of(), null, List.of(), List.of()); + ResolvedDecorator resolvedLimited = new ResolvedDecorator(limited, SEED, (style, seed) -> constant(0), state("a"), List.of(), null, List.of(), List.of(), ModuleLogs.discarding()); + ResolvedDecorator resolvedForced = new ResolvedDecorator(forced, SEED, (style, seed) -> constant(0), state("a"), List.of(), null, List.of(), List.of(), ModuleLogs.discarding()); + ResolvedDecorator resolvedDefault = new ResolvedDecorator(new Decorator(), SEED, (style, seed) -> constant(0), state("a"), List.of(), null, List.of(), List.of(), ModuleLogs.discarding()); assertTrue(resolvedLimited.slopeBlocks(() -> 5)); assertFalse(resolvedLimited.slopeBlocks(() -> 3)); diff --git a/core/src/test/java/art/arcane/iris/engine/framework/IrisStructureLocatorContractTest.java b/core/src/test/java/art/arcane/iris/engine/framework/IrisStructureLocatorContractTest.java index 32dceb65c..38fd7edef 100644 --- a/core/src/test/java/art/arcane/iris/engine/framework/IrisStructureLocatorContractTest.java +++ b/core/src/test/java/art/arcane/iris/engine/framework/IrisStructureLocatorContractTest.java @@ -43,6 +43,7 @@ import art.arcane.iris.engine.object.structure.vanilla.NativeStructureSuppressio import art.arcane.iris.engine.object.structure.StructureDistribution; import art.arcane.volmlib.util.collection.KList; import art.arcane.volmlib.util.math.RNG; +import com.volmit.host.ModuleLogs; import org.junit.Test; import java.util.Set; @@ -279,7 +280,7 @@ public class IrisStructureLocatorContractTest { ModuleResourceFixture.of(data).resource(StructureResources.PIECES, "test:target-piece", targetPiece); when(data.load(IrisObject.class, "test:start-object", false)).thenReturn(startObject); when(data.load(IrisObject.class, "test:target-object", false)).thenReturn(targetObject); - assertFalse(StructureGraphCatalog.compile(data, structure).isAssemblyViable()); + assertFalse(StructureGraphCatalog.compile(data, structure, ModuleLogs.discarding()).isAssemblyViable()); IrisStructurePlacement placement = new IrisStructurePlacement() .setNativeSuppression(NativeStructureSuppression.REPLACE_SOURCE); diff --git a/core/src/test/java/art/arcane/iris/engine/framework/StructureAssemblerTest.java b/core/src/test/java/art/arcane/iris/engine/framework/StructureAssemblerTest.java index dad15438b..bc181b9cb 100644 --- a/core/src/test/java/art/arcane/iris/engine/framework/StructureAssemblerTest.java +++ b/core/src/test/java/art/arcane/iris/engine/framework/StructureAssemblerTest.java @@ -41,6 +41,7 @@ import art.arcane.iris.spi.IrisPlatforms; import art.arcane.iris.spi.PlatformBlockState; import art.arcane.iris.spi.PlatformRegistries; import art.arcane.volmlib.util.math.RNG; +import com.volmit.host.ModuleLogs; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -1213,7 +1214,7 @@ public class StructureAssemblerTest { } private StructureAssembler assembler(IrisStructure structure, int x, int y, int z) { - return StructureAssembler.forData(data, structure, new IrisPosition(x, y, z)); + return StructureAssembler.forData(data, structure, new IrisPosition(x, y, z), ModuleLogs.discarding()); } } } diff --git a/core/src/test/java/art/arcane/iris/engine/framework/structure/fit/SurfaceFittingTest.java b/core/src/test/java/art/arcane/iris/engine/framework/structure/fit/SurfaceFittingTest.java index 5b6e02a5f..6c802a184 100644 --- a/core/src/test/java/art/arcane/iris/engine/framework/structure/fit/SurfaceFittingTest.java +++ b/core/src/test/java/art/arcane/iris/engine/framework/structure/fit/SurfaceFittingTest.java @@ -1,5 +1,6 @@ package art.arcane.iris.engine.framework.structure.fit; +import com.volmit.host.ModuleLogs; import com.volmit.vanilla.StructureStep; import com.volmit.vanilla.TerrainAdaptation; import org.junit.Test; @@ -229,7 +230,7 @@ public class SurfaceFittingTest { FitStart start = FitFixture.start(VACUUM, TerrainAdaptation.NONE, StructureStep.SURFACE_STRUCTURES, FitFixture.Piece.rigid(new Box(0, 66, 0, 0, 70, 0), 1).cell(0, 66, 0, COBBLESTONE)); - SurfaceFitting.prepareSurfaceStructures(world.fitBlocks(), area, List.of(start), (x, z) -> 60, 1); + SurfaceFitting.prepareSurfaceStructures(world.fitBlocks(), area, List.of(start), (x, z) -> 60, 1, ModuleLogs.discarding()); assertEquals(before, world.snapshot()); } @@ -242,7 +243,7 @@ public class SurfaceFittingTest { FitFixture.Piece.rigid(new Box(0, 65, 0, 0, 72, 0), 1).cell(0, 65, 0, COBBLESTONE)); SurfaceFitting.VacuumFoundationPlan plan = SurfaceFitting.prepareSurfaceStructures( - world.fitBlocks(), area, List.of(start), (x, z) -> 60, SurfaceFitting.MAX_SURFACE_TEMPLATE_CELLS); + world.fitBlocks(), area, List.of(start), (x, z) -> 60, SurfaceFitting.MAX_SURFACE_TEMPLATE_CELLS, ModuleLogs.discarding()); assertEquals(GRASS, world.at(0, 64, 0)); for (int y = 61; y <= 64; y++) { world.put(0, y, 0, state("cave_air")); diff --git a/core/src/test/java/art/arcane/iris/engine/loot/PlacementLootTest.java b/core/src/test/java/art/arcane/iris/engine/loot/PlacementLootTest.java index 40a3214aa..5b3bd6741 100644 --- a/core/src/test/java/art/arcane/iris/engine/loot/PlacementLootTest.java +++ b/core/src/test/java/art/arcane/iris/engine/loot/PlacementLootTest.java @@ -27,6 +27,7 @@ import art.arcane.iris.engine.object.loot.IObjectLoot; import art.arcane.iris.spi.PlatformBlockState; import art.arcane.volmlib.util.collection.KList; import art.arcane.volmlib.util.math.RNG; +import com.volmit.host.ModuleLogs; import com.volmit.service.Loot; import org.junit.AfterClass; import org.junit.Before; @@ -69,7 +70,7 @@ public class PlacementLootTest { for (String key : List.of("everywhere", "chests", "this-chest", "other")) { fixture.resource(LootResources.TABLES, key, TestSettings.of(LootTable.class, "{\"name\": \"" + key + "\"}")); } - placement = new PlacementLoot(data, () -> Set.of("minecraft:chests/simple_dungeon"), LOOT_SEED); + placement = new PlacementLoot(data, () -> Set.of("minecraft:chests/simple_dungeon"), LOOT_SEED, ModuleLogs.discarding()); } @Test diff --git a/core/src/test/java/art/arcane/iris/engine/mantle/components/FloatingObjectPlacingBoundaryRadiusTest.java b/core/src/test/java/art/arcane/iris/engine/mantle/components/FloatingObjectPlacingBoundaryRadiusTest.java index b2b8acba9..aacf3513b 100644 --- a/core/src/test/java/art/arcane/iris/engine/mantle/components/FloatingObjectPlacingBoundaryRadiusTest.java +++ b/core/src/test/java/art/arcane/iris/engine/mantle/components/FloatingObjectPlacingBoundaryRadiusTest.java @@ -36,6 +36,7 @@ import art.arcane.iris.spi.IrisPlatforms; import art.arcane.iris.spi.PlatformBlockState; import art.arcane.iris.spi.PlatformRegistries; import art.arcane.volmlib.util.collection.KList; +import com.volmit.host.ModuleLogs; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -114,6 +115,6 @@ public class FloatingObjectPlacingBoundaryRadiusTest { when(engine.getData()).thenReturn(data); when(engine.getGeneration()).thenReturn(new EngineGeneration(engine)); - assertEquals(33, new FloatingObjectPlacing(engine).reach()); + assertEquals(33, new FloatingObjectPlacing(engine, ModuleLogs.discarding()).reach()); } } diff --git a/core/src/test/java/art/arcane/iris/engine/mantle/components/ObjectPlacingBoundaryRadiusTest.java b/core/src/test/java/art/arcane/iris/engine/mantle/components/ObjectPlacingBoundaryRadiusTest.java index 3b95ccb4c..55a243dff 100644 --- a/core/src/test/java/art/arcane/iris/engine/mantle/components/ObjectPlacingBoundaryRadiusTest.java +++ b/core/src/test/java/art/arcane/iris/engine/mantle/components/ObjectPlacingBoundaryRadiusTest.java @@ -32,6 +32,7 @@ import art.arcane.volmlib.util.mantle.flag.ReservedFlag; import art.arcane.volmlib.util.mantle.runtime.Mantle; import art.arcane.volmlib.util.mantle.runtime.MantleChunk; import art.arcane.volmlib.util.matter.Matter; +import com.volmit.host.ModuleLogs; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -128,7 +129,7 @@ public class ObjectPlacingBoundaryRadiusTest { when(engine.getDimension()).thenReturn(dimension); when(engine.getData()).thenReturn(data); - assertEquals(53, new ObjectPlacing(engine).reach()); + assertEquals(53, new ObjectPlacing(engine, ModuleLogs.discarding()).reach()); } @Test @@ -159,7 +160,7 @@ public class ObjectPlacingBoundaryRadiusTest { when(engine.getDimension()).thenReturn(dimension); when(engine.getData()).thenReturn(data); - int reach = new ObjectPlacing(engine).reach(); + int reach = new ObjectPlacing(engine, ModuleLogs.discarding()).reach(); assertEquals(33, reach); int chunkRadius = Math.ceilDiv(reach, 16); assertEquals(3, chunkRadius); diff --git a/core/src/test/java/art/arcane/iris/engine/modifier/ApiChunk.java b/core/src/test/java/art/arcane/iris/engine/modifier/ApiChunk.java index ab4420907..62ce3a031 100644 --- a/core/src/test/java/art/arcane/iris/engine/modifier/ApiChunk.java +++ b/core/src/test/java/art/arcane/iris/engine/modifier/ApiChunk.java @@ -32,6 +32,7 @@ import com.volmit.FeatureAttachment.Target; import com.volmit.IrisFeature; import com.volmit.IrisModule; import com.volmit.ModuleInfo; +import com.volmit.ModuleLog; import com.volmit.block.BlockFace; import com.volmit.block.BlockRegistry; import com.volmit.block.BlockSpec; @@ -45,6 +46,7 @@ import com.volmit.generation.GenerationContext; import com.volmit.host.ArrayHunk; import com.volmit.host.ChunkRunner; import com.volmit.host.DiscoveredModule; +import com.volmit.host.ModuleLogs; import com.volmit.host.ResolvedGraph; import com.volmit.host.StageGraphBuilder; import com.volmit.hunk.Hunk; @@ -409,6 +411,16 @@ public final class ApiChunk implements GenerationContext { return type.cast(known); } + @Override + public ModuleLog log() { + return ModuleLogs.discarding(); + } + + @Override + public PackWorld withLog(ModuleLog log) { + return this; + } + @Override public long seed(IrisSeed seed) { return SEED + seed.ordinal(); diff --git a/core/src/test/java/art/arcane/iris/engine/modifier/CaveApplyingBoundarySupportTest.java b/core/src/test/java/art/arcane/iris/engine/modifier/CaveApplyingBoundarySupportTest.java index f76f9edad..1bbb9b6b2 100644 --- a/core/src/test/java/art/arcane/iris/engine/modifier/CaveApplyingBoundarySupportTest.java +++ b/core/src/test/java/art/arcane/iris/engine/modifier/CaveApplyingBoundarySupportTest.java @@ -13,6 +13,7 @@ import art.arcane.volmlib.util.mantle.runtime.MantleChunk; import art.arcane.volmlib.util.matter.Matter; import art.arcane.volmlib.util.matter.MatterCavern; import art.arcane.volmlib.util.matter.MatterSlice; +import com.volmit.host.ModuleLogs; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import org.junit.After; import org.junit.Before; @@ -56,7 +57,7 @@ public class CaveApplyingBoundarySupportTest { doReturn(mock(SeedManager.class)).when(engine).getSeedManager(); DecoratorTestEngines.withGeneration(engine); - CaveApplying modifier = new CaveApplying(engine); + CaveApplying modifier = new CaveApplying(engine, ModuleLogs.discarding()); MantleChunk mantleChunk = mock(MantleChunk.class); Matter floorMatter = mock(Matter.class); diff --git a/core/src/test/java/art/arcane/iris/engine/modifier/CaveApplyingInferenceIsolationTest.java b/core/src/test/java/art/arcane/iris/engine/modifier/CaveApplyingInferenceIsolationTest.java index 023b6c629..4e63286b6 100644 --- a/core/src/test/java/art/arcane/iris/engine/modifier/CaveApplyingInferenceIsolationTest.java +++ b/core/src/test/java/art/arcane/iris/engine/modifier/CaveApplyingInferenceIsolationTest.java @@ -20,6 +20,7 @@ import art.arcane.iris.util.project.hunk.Hunk; import art.arcane.iris.util.project.stream.ProceduralStream; import art.arcane.volmlib.util.matter.MatterCavern; import com.google.gson.Gson; +import com.volmit.host.ModuleLogs; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -68,7 +69,7 @@ public class CaveApplyingInferenceIsolationTest { doReturn(IrisWorld.builder().minHeight(-256).maxHeight(512).build()).when(engine).getWorld(); doReturn(mock(SeedManager.class)).when(engine).getSeedManager(); DecoratorTestEngines.withGeneration(engine); - CaveApplying modifier = new CaveApplying(engine); + CaveApplying modifier = new CaveApplying(engine, ModuleLogs.discarding()); Map customBiomes = new HashMap<>(); customBiomes.put("shared", biome); diff --git a/core/src/test/java/art/arcane/iris/engine/modifier/FloatingIslandsTest.java b/core/src/test/java/art/arcane/iris/engine/modifier/FloatingIslandsTest.java index 2c474b4b9..5dc8ffd12 100644 --- a/core/src/test/java/art/arcane/iris/engine/modifier/FloatingIslandsTest.java +++ b/core/src/test/java/art/arcane/iris/engine/modifier/FloatingIslandsTest.java @@ -10,6 +10,7 @@ import art.arcane.iris.engine.object.world.biome.IrisBiome; import art.arcane.iris.spi.PlatformBlockState; import art.arcane.iris.util.project.context.ChunkContext; import art.arcane.iris.util.project.hunk.Hunk; +import com.volmit.host.ModuleLogs; import org.junit.Test; import static org.mockito.ArgumentMatchers.any; @@ -27,7 +28,7 @@ public class FloatingIslandsTest { @Test @SuppressWarnings("unchecked") public void columnsWithoutFloatingChildBiomesAreLeftAlone() { - FloatingIslands islands = new FloatingIslands(engine()); + FloatingIslands islands = new FloatingIslands(engine(), ModuleLogs.discarding()); IrisBiome biome = mock(IrisBiome.class); when(biome.getModuleSettings()).thenReturn(ModuleSettings.NONE); FloatingIslandBoundarySampler sampler = mock(FloatingIslandBoundarySampler.class); diff --git a/core/src/test/java/art/arcane/iris/engine/object/terrain/floating/FloatingIslandBoundarySamplerTest.java b/core/src/test/java/art/arcane/iris/engine/object/terrain/floating/FloatingIslandBoundarySamplerTest.java index 86b823062..477100211 100644 --- a/core/src/test/java/art/arcane/iris/engine/object/terrain/floating/FloatingIslandBoundarySamplerTest.java +++ b/core/src/test/java/art/arcane/iris/engine/object/terrain/floating/FloatingIslandBoundarySamplerTest.java @@ -33,6 +33,7 @@ import art.arcane.iris.engine.framework.Engine; import art.arcane.iris.util.project.noise.CNG; import art.arcane.volmlib.util.collection.KList; import art.arcane.volmlib.util.math.RNG; +import com.volmit.host.ModuleLogs; import org.junit.Test; import java.util.concurrent.ExecutorService; @@ -583,9 +584,9 @@ public class FloatingIslandBoundarySamplerTest { int[] expectedBottom = {159, 158, 156, 153, 150, 147, 144, 142, 141, 140}; int[] expectedTop = {161, 162, 164, 166, 169, 172, 174, 176, 177, 178}; - assertNull(FloatingIslandSample.sample(parent, entries, 0, 0, 320, 31L, data, engine, sampler)); + assertNull(FloatingIslandSample.sample(parent, entries, 0, 0, 320, 31L, data, engine, sampler, ModuleLogs.discarding())); for (int i = 0; i < expectedBottom.length; i++) { - FloatingIslandSample sample = FloatingIslandSample.sample(parent, entries, i + 1, 0, 320, 31L, data, engine, sampler); + FloatingIslandSample sample = FloatingIslandSample.sample(parent, entries, i + 1, 0, 320, 31L, data, engine, sampler, ModuleLogs.discarding()); assertNotNull("distance " + (i + 2) + " rejected with code " + FloatingIslandSample.getLastReject(), sample); assertEquals(expectedBottom[i], sample.bottomY()); assertEquals(expectedTop[i], sample.topY()); @@ -652,8 +653,8 @@ public class FloatingIslandBoundarySamplerTest { when(engine.getWorld()).thenReturn(world); FloatingIslandBoundarySampler sampler = new FloatingIslandBoundarySampler((x, z) -> parent); - assertNull(FloatingIslandSample.sample(parent, entries, 0, 0, 320, 35L, data, engine, sampler)); - FloatingIslandSample sample = FloatingIslandSample.sample(parent, entries, 1, 0, 320, 35L, data, engine, sampler); + assertNull(FloatingIslandSample.sample(parent, entries, 0, 0, 320, 35L, data, engine, sampler, ModuleLogs.discarding())); + FloatingIslandSample sample = FloatingIslandSample.sample(parent, entries, 1, 0, 320, 35L, data, engine, sampler, ModuleLogs.discarding()); assertNotNull(sample); assertTrue(sample.hasMergedEntries()); diff --git a/core/src/test/java/art/arcane/iris/engine/terrain/BiomeLayersCeilingGuardTest.java b/core/src/test/java/art/arcane/iris/engine/terrain/BiomeLayersCeilingGuardTest.java index c542e9d71..07a1082ba 100644 --- a/core/src/test/java/art/arcane/iris/engine/terrain/BiomeLayersCeilingGuardTest.java +++ b/core/src/test/java/art/arcane/iris/engine/terrain/BiomeLayersCeilingGuardTest.java @@ -11,6 +11,7 @@ import art.arcane.iris.spi.PlatformBlockState; import art.arcane.volmlib.util.collection.KList; import art.arcane.volmlib.util.math.RNG; import com.google.gson.Gson; +import com.volmit.host.ModuleLogs; import org.junit.Test; import java.io.File; @@ -73,6 +74,6 @@ public class BiomeLayersCeilingGuardTest { } private static BiomeLayers layersOf(IrisData data) { - return new BiomeLayers(TestLayerBlocks.of(data.getPackResources())); + return new BiomeLayers(TestLayerBlocks.of(data.getPackResources()), ModuleLogs.discarding()); } } diff --git a/core/src/test/java/art/arcane/iris/engine/terrain/TestLayerBlocks.java b/core/src/test/java/art/arcane/iris/engine/terrain/TestLayerBlocks.java index 86aa8fba6..b2a978095 100644 --- a/core/src/test/java/art/arcane/iris/engine/terrain/TestLayerBlocks.java +++ b/core/src/test/java/art/arcane/iris/engine/terrain/TestLayerBlocks.java @@ -19,7 +19,9 @@ package art.arcane.iris.engine.terrain; import art.arcane.iris.builtin.terrain.LayerBlocks; +import com.volmit.ModuleLog; import com.volmit.config.PackSettings; +import com.volmit.host.ModuleLogs; import com.volmit.resource.PackResources; import com.volmit.world.PackWorld; @@ -57,5 +59,15 @@ public final class TestLayerBlocks { public T state(Class type, Function create) { return type.cast(states.computeIfAbsent(type, ignored -> create.apply(this))); } + + @Override + public ModuleLog log() { + return ModuleLogs.discarding(); + } + + @Override + public PackWorld withLog(ModuleLog log) { + return this; + } } }