mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 08:44:50 +00:00
Structures generate from the built-ins jar
iris:structure moves into the jar as a thin module: it declares the structure placement settings and the mantle stage, and Iris places the structures through a StructureHost facade. The structure model, assembler, locator, fitting and placing stay host. The resource kinds become iris:structure-model/*, owned by Iris's own module. StructurePlacement names its structures with @Ref(Reference.PACK_STRUCTURE), so the exposed package names no host class. CaveProfiles had no users and is removed.
This commit is contained in:
1 parent
2ae16b9c9e
commit
c9058e0892
6 files changed
+73
-84
No files matched your search
@@ -30,7 +30,7 @@ import com.volmit.resource.ResourceKind;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The resource kinds of module {@code iris:structure}, which keep the folders and files Iris packs have always used,
|
||||
* The resource kinds of Iris's module {@code iris:structure-model}, which keep the folders and files Iris packs have always used,
|
||||
* and lookups by pack key for code that still names structures, pools and pieces by key. Every lookup goes through
|
||||
* the pack's {@link com.volmit.resource.PackResources}, so it sees the pack's current snapshot: a hotload, or
|
||||
* {@link IrisData#invalidateStructureResources()} after a tool rewrote the files, reads them again.
|
||||
@@ -40,16 +40,16 @@ import java.util.List;
|
||||
*/
|
||||
public final class StructureResources {
|
||||
/** Jigsaw structures, in {@code structures/}. */
|
||||
public static final ResourceKind<IrisStructure> STRUCTURES = ResourceKind.of("iris:structure/structure", "structures", IrisStructure.class);
|
||||
public static final ResourceKind<IrisStructure> STRUCTURES = ResourceKind.of("iris:structure-model/structure", "structures", IrisStructure.class);
|
||||
/** Jigsaw pools a structure starts from and connectors lead to, in {@code jigsaw-pools/}. */
|
||||
public static final ResourceKind<IrisJigsawPool> POOLS = ResourceKind.of("iris:structure/pool", "jigsaw-pools", IrisJigsawPool.class);
|
||||
public static final ResourceKind<IrisJigsawPool> POOLS = ResourceKind.of("iris:structure-model/pool", "jigsaw-pools", IrisJigsawPool.class);
|
||||
/** Jigsaw pieces pools hold, each an object with connectors, in {@code jigsaw-pieces/}. */
|
||||
public static final ResourceKind<IrisJigsawPiece> PIECES = ResourceKind.of("iris:structure/piece", "jigsaw-pieces", IrisJigsawPiece.class);
|
||||
public static final ResourceKind<IrisJigsawPiece> PIECES = ResourceKind.of("iris:structure-model/piece", "jigsaw-pieces", IrisJigsawPiece.class);
|
||||
|
||||
private StructureResources() {
|
||||
}
|
||||
|
||||
/** Every resource kind of the structure module. */
|
||||
/** Every resource kind of the structure model. */
|
||||
public static List<ResourceKind<?>> kinds() {
|
||||
return List.of(STRUCTURES, POOLS, PIECES);
|
||||
}
|
||||
|
||||
@@ -19,47 +19,25 @@
|
||||
package art.arcane.iris.engine.mantle.components;
|
||||
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.builtin.structure.StructureHost;
|
||||
import art.arcane.iris.builtin.structure.StructurePlacementSettings;
|
||||
import art.arcane.iris.builtin.structure.StructureSettings;
|
||||
import art.arcane.iris.core.modules.IrisMantleChunk;
|
||||
import art.arcane.iris.core.modules.IrisPackSettings;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.structure.StructureLocating;
|
||||
import art.arcane.iris.engine.framework.structure.StructureResources;
|
||||
import art.arcane.iris.engine.framework.structure.StructureValidator;
|
||||
import art.arcane.iris.engine.framework.structure.StructureVanillaStructures;
|
||||
import com.volmit.FeatureRegistry;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.ModuleLog;
|
||||
import com.volmit.config.PackSettings;
|
||||
import com.volmit.service.StructureLocator;
|
||||
import com.volmit.service.VanillaStructures;
|
||||
import com.volmit.stage.MantleStageContext;
|
||||
import com.volmit.stage.StageGraph;
|
||||
|
||||
/**
|
||||
* Module {@code iris:structure}: Iris structures, written into the mantle after objects, whose trees they clear
|
||||
* where they intersect, and after floating objects. A port of what was Iris's structure mantle component, its
|
||||
* work done by {@link StructurePlacing}, one per engine runtime. Its reach is the pack's largest structure.
|
||||
* <p>
|
||||
* The module owns the pack's structures, jigsaw pools and jigsaw pieces as resource kinds
|
||||
* ({@link StructureResources}), read from the folders packs have always used, and checks them with
|
||||
* {@link StructureValidator} wherever Iris validates a pack. It lets Iris find its structures through
|
||||
* {@link StructureLocating}; a world's structure index lives in the world's state, so a reload of the pack's structure
|
||||
* files, which starts a new world, builds it again.
|
||||
* <p>
|
||||
* It decides over the platform's own structures through its {@link VanillaStructures} provider
|
||||
* ({@link StructureVanillaStructures}): the dimension's {@code importedStructures} settings disable, move, fit and set
|
||||
* them up, and the pack's structure placements replace them, place them alongside, start them where their
|
||||
* {@code nativeStructures} grids say and fit them into the terrain. The pack's structure placements are its
|
||||
* {@code "structures"} settings ({@link StructurePlacementSettings}) of the dimension, its regions and biomes.
|
||||
* Module {@code iris:structure}: the structure placements a pack declares, and the mantle stage that places the jigsaw
|
||||
* structures starting in each chunk. Iris builds and places the structures ({@link StructureHost}); the structure
|
||||
* resources, their validation, the locator and the platform structure answers are Iris's own module
|
||||
* {@code iris:structure-model}.
|
||||
*/
|
||||
public final class StructureModule implements IrisModule {
|
||||
private static final String VERSION = "built-in";
|
||||
|
||||
private ModuleLog log;
|
||||
|
||||
@Override
|
||||
public ModuleInfo info() {
|
||||
return ModuleInfo.of("iris:structure", "Structures", VERSION);
|
||||
@@ -68,30 +46,20 @@ public final class StructureModule implements IrisModule {
|
||||
@Override
|
||||
public void install(StageGraph graph) {
|
||||
graph.define(IrisStages.Structure.PLACE).softAfter(IrisStages.Objects.PLACE.ref(), IrisStages.Floating.OBJECTS.ref())
|
||||
.reach(this::reach).run(StructureModule::place);
|
||||
.reach(StructureModule::reach).run(StructureModule::place);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(FeatureRegistry registry) {
|
||||
log = registry.log();
|
||||
registry.registerSettings(StructureSettings.class);
|
||||
registry.registerSettings(StructurePlacementSettings.class);
|
||||
StructureResources.kinds().forEach(registry::registerResourceKind);
|
||||
registry.registerValidator(new StructureValidator());
|
||||
registry.registerService(StructureLocator.class, new StructureLocating());
|
||||
registry.registerService(VanillaStructures.class, new StructureVanillaStructures());
|
||||
}
|
||||
|
||||
private static void place(MantleStageContext context) {
|
||||
IrisMantleChunk chunk = IrisMantleChunk.current();
|
||||
placing(chunk.engine(), context.log()).place(chunk.writer(), chunk.chunkX(), chunk.chunkZ(), chunk.context());
|
||||
StructureHost.of(context.world()).placeChunk();
|
||||
}
|
||||
|
||||
private int reach(PackSettings settings) {
|
||||
return placing(IrisPackSettings.of(settings).engine(), log).reach();
|
||||
}
|
||||
|
||||
private static StructurePlacing placing(Engine engine, ModuleLog log) {
|
||||
return engine.getGeneration().state(StructurePlacing.class, generating -> new StructurePlacing(generating, log));
|
||||
private static int reach(PackSettings settings) {
|
||||
return StructureHost.of(settings).reach();
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.terrain.carving;
|
||||
|
||||
import art.arcane.iris.builtin.carve.CaveProfile;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
|
||||
/** The cave profiles dimensions, regions and biomes declare ({@code caveProfile}). */
|
||||
public final class CaveProfiles {
|
||||
private CaveProfiles() {
|
||||
}
|
||||
|
||||
/** The profile {@code owner}, a dimension, region or biome, declares; null when it declares none, which is as good as one that is not enabled. */
|
||||
public static CaveProfile declaredBy(IrisRegistrant owner) {
|
||||
return owner.getModuleSettings().find(CaveProfile.class).orElse(null);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user