mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 08:14:45 +00:00
Merge IrisModule into module/ with its history
git-subtree-dir: module git-subtree-mainline:925c942764git-subtree-split:27b0036450
This commit is contained in:
commit
68ae3c8d3a
391 files changed
+43895
No files matched your search
@@ -0,0 +1,2 @@
|
||||
build/
|
||||
.gradle/
|
||||
@@ -0,0 +1,229 @@
|
||||
# Iris default module
|
||||
|
||||
This project owns the built-in Iris feature and setting sources under
|
||||
`src/main/java/art/arcane/iris`. The files keep the packages and pack fields they had in Iris. They build against
|
||||
the Iris API alone (see "Building" below); Iris depends on this project, never the reverse.
|
||||
|
||||
Ported features are IrisApi modules that every pack loads before its own: object placement
|
||||
(`iris:prepare`, `iris:anchor`, `iris:validate`, `iris:bore`, `iris:blocks`, `iris:stilt`,
|
||||
`iris:vacuum`, `iris:snow`, shipped in the built-ins jar), the mantle, and chunk generation. Every mantle stage is a pass of Iris's
|
||||
mantle of its own, in the stage graph's order: `iris:carve/caves`, `iris:objects/place`,
|
||||
`iris:floating/objects`, `iris:structure/place`, so a pack's mantle stage can order itself after any of
|
||||
them. Chunk generation then runs, in this order: `iris:biome`, `iris:terrain`, `iris:carve` (cutting the
|
||||
planned caves), `iris:post`, `iris:floating` (solids), `iris:deposit`, `iris:matter`, `iris:decorant`,
|
||||
`iris:floating` (decoration), `iris:perfection` and `iris:custom`. There are no world modes and no Iris
|
||||
mantle components outside the stage graph any more. Their stage constants, and the settings and output
|
||||
types packs may read, live in `src/main/java/art/arcane/iris/builtin`, the package Iris exposes to pack
|
||||
modules; their stage bodies live beside the features they replace. Settings and helper types that only the jar's modules read,
|
||||
which Iris itself never touches, live in `art.arcane.iris.modules` instead, which Iris does not expose: the jar loads its own copy.
|
||||
Every built-in snippet is named under its module's id, `iris/<module>/<name>` (folder `snippet/iris/carve/cave-profile/`), so a
|
||||
snippet type may live in either package. A type stays in `art.arcane.iris.builtin` only when Iris reads it or an exposed type holds it.
|
||||
|
||||
Two of those modules are not in this project: `iris:biome` (writes the layout's platform biomes into the chunk) and
|
||||
`iris:custom` (records the platform's custom blocks of content plugins) are Iris itself, so their classes live in Iris
|
||||
core (`art.arcane.iris.core.modules.BiomeModule` and `CustomModule`) and Iris registers them (`IrisModuleHost`), not
|
||||
the built-ins jar. Their stage constants stay in `art.arcane.iris.builtin.IrisStages`, so packs can still order after them.
|
||||
|
||||
Built-in modules log through the `ModuleLog` IrisApi hands them (`context.log()` in a stage body, `world.log()` in a
|
||||
service or hook, `setup.log()` during setup), which labels each line with the module's id, so these sources do not
|
||||
use `IrisLogging`. Classes of the host's object model (the host-classes list) and code that only has an engine or pack
|
||||
data still log as Iris itself.
|
||||
|
||||
Modules also own pack resources and checks of their own. `iris:structure` (`StructureModule`) reads structures, jigsaw
|
||||
pools and jigsaw pieces as resource kinds (`StructureResources`, `iris:structure/structure`, `/pool`, `/piece`), from the
|
||||
folders and files packs have always used, and declares the structure placement settings and the mantle stage. Its
|
||||
definitions (`IrisStructure`, `IrisJigsawPiece`, `IrisJigsawPool` and their parts in `engine/object/structure`) live
|
||||
here and build against the API. It is not in the built-ins jar: Iris registers it with its own modules, because Iris's
|
||||
jigsaw studio, importers and exporters read the structures it registers as the same classes, which a jar's own copy of
|
||||
a class is not. Iris's own module `iris:structure-model` (core `StructureModelModule`) checks them with its validator
|
||||
(`StructureValidator`: assembly samples and vanilla structure replacement) wherever Iris validates a pack. The
|
||||
assembler, locator, fitting and placing are still Iris's, and `iris:structure` places through the `StructureHost`
|
||||
facade (`art.arcane.iris.builtin.structure`).
|
||||
|
||||
Built-in modules answer Iris through IrisApi services instead of Iris reading their features: `iris:objects`
|
||||
provides `ObjectsAt` (the objects a chunk would get, for the object search and studio tools) and `iris:structure-model`
|
||||
provides `StructureLocator` (`StructureLocating`: the pack's structure keys for Iris's structure index, the ones a
|
||||
world places, and their nearest start for the find commands). A world's structure index lives in the world's state
|
||||
(`engine.getGeneration().state(...)`), so every reload of the pack's structure files, which starts a new world, builds
|
||||
it again.
|
||||
`iris:structure-model` also provides `VanillaStructures` (`StructureVanillaStructures`) for the platform's own structures:
|
||||
which ones its placements replace or the dimension's `importedStructures` disables, the starts its `nativeStructures`
|
||||
placements make (`startedStructures`, `locatableStarts`, `locateStart`), the shift and band of the platform's starts, and the whole terrain fit of every start (SOURCE,
|
||||
PRESERVE, VACUUM, ENCASE, BORE, FORCE_CARVE, stilts) in `engine/framework/structure/fit`, written against IrisApi's
|
||||
`StructureFit` and `BlockAccess` only. A start carries its fit as a memo (its terrain and stilts JSON), so every
|
||||
chunk it reaches and every restart fits it the same way. `iris:vanilla-features` (`VanillaFeaturesModule`, no stages)
|
||||
reads the dimension's `importedFeatures` (`ImportedFeaturesSettings`) and provides `VanillaFeatures` (`ImportedFeatures`):
|
||||
whether the platform's own placed features run over the terrain and which decoration steps and features they leave out;
|
||||
the family patterns of `disabled` and of `importedStructures` share one rule (`art.arcane.iris.builtin.RegistryKeyFamily`).
|
||||
Object place modes are data (`PlaceMode`: height sampling,
|
||||
stilt, `VacuumProfile`, `PlaceTrait`s) that the placement stages ask; the pack JSON keeps the mode names.
|
||||
`iris:objects` also provides `SaplingGrowth` (`TreeGrowing`: the tree a sapling grows into, as placed blocks, and which
|
||||
objects are trees) and says which biomes and regions place an object (`ObjectLocating`, for the object search).
|
||||
`iris:objects` ships in the built-ins jar. It declares the settings `objects` (region, biome: the list of `ObjectPlacement`s),
|
||||
`proceduralObjects` (region, biome), `treeSettings` (dimension), `requireObjectSurfaceSupport`, `objectSurfaceSupportBuffer`,
|
||||
`upperDimensionObjects` and `upperObjectsForcePlace` (dimension), all written as they always were. `ObjectPlacement` is the
|
||||
placement itself, read by the module decoder like any settings class, and the one type Iris places with. What a jar cannot do, Iris does through the facades `ObjectHost` and
|
||||
`ObjectChunk` in `art.arcane.iris.builtin.objects`: loading and scaling the pack's objects, placing one with the placement
|
||||
stages into the chunk's mantle (on the surface, in a cave inside the cave's bounds, or hung from the terrain above), reading the
|
||||
carved space the cave carver planned, and the loot an object placed at a block defines; the layout, the settings of a column and
|
||||
the upper dimension's objects come from IrisApi (`TerrainSampler`, `FeatureSettings`, `UpperDimension`). `ObjectPlacing` and its helpers (`ChunkObjectPlacing`,
|
||||
`CaveAnchors`, `PlacementReach`) decide what to place and where. Procedural objects (`engine/procedural`, resource kind
|
||||
`iris:objects/procedural`, folder `procedural`) are definitions of parts that bake into variants; a placement names them as
|
||||
`procedural/<path>`, or `procedural/<path>#<index>` for one variant, like any object.
|
||||
`iris:loot` owns the loot table resource kind (`LootResources`, folder `loot`), checks the tables and the references to
|
||||
them (`LootValidator`), and provides `Loot` (`LootGiving`: which tables a container draws from and the `ItemDrop`s a
|
||||
table gives) and `BlockDrops` (`BlockDropping`). `iris:spawn` owns spawners, entities and markers (`SpawnResources`,
|
||||
folders `spawners`, `entities`, `markers`) and provides `EntitySpawns` (`EntitySpawning`: what to spawn in a chunk or at
|
||||
a marker, as `EntitySpec`s; `EntityResolution` makes the entity's random choices) and `AmbientEffects` (`AmbientEffecting`:
|
||||
the effects due around a player, with their random values). Iris's Bukkit code creates the items and entities from those
|
||||
values (`BukkitItemStacks`, `BukkitEntitySpawner`, `BukkitAmbientEffects`); the modded adapters, which cannot name IrisApi
|
||||
types, ask through the host-typed `ContentServices`.
|
||||
The settings of both modules are `builtin.loot` and `builtin.spawn` types of IrisApi annotations only: `iris:loot` declares
|
||||
`loot` (object, also the shape of an entity's `loot`) and `blockDrops` (list) for dimensions, regions and biomes;
|
||||
`iris:spawn` declares `entitySpawners` (list of spawner keys) for the same and `effects` (list, `iris:spawn/effects`) for
|
||||
regions and biomes. The loot tables, spawners, entities and markers are plain module types too (`LootTable`, `Spawner`,
|
||||
`EntityDefinition`, `SpawnMarker`). `PlacementLoot` picks the table an object placement gives one of its chests.
|
||||
`iris:decorant`, `iris:terrain` and `iris:deposit` ship in the built-ins jar and keep their per-world workers (`BiomeDecorators`, `TerrainShaper`,
|
||||
`DepositPlacer`) in the world's state store (`context.world().state(...)`); the modules still compiled into Iris reach the same store through
|
||||
the `IrisChunk` their invocation offers (`context.extension(IrisChunk.class)`, then `state(...)`) or `engine.getGeneration().state(...)`.
|
||||
|
||||
Settings move off Iris's classes one feature at a time. `iris:deposit` is the first whose settings are IrisApi types
|
||||
only: `DepositSettings` (`art.arcane.iris.modules.deposit`) holds `DepositGenerator`s (blocks as `BlockSpec`, its enums beside it; packs write generators as
|
||||
`snippet/iris/deposit/deposit/...`), and packs write `"deposits": [...]`, as they always have (`@Feature(key = "deposits", root = "generators")`: the key holds the one option's list). What needs Iris (resolving the
|
||||
palette, ore checks, clump shapes per world seed) lives in the module's own code, `ResolvedDeposit`. The deposits run one generator after the other, each
|
||||
with a random of its own; they used to spread over threads on a multicore pregen, which no module can do (stages run on the host's threads).
|
||||
|
||||
An object placement is `iris:objects` settings (`objects.ObjectPlacement`, under a biome's or region's `objects`), and the
|
||||
settings inside it, such as its clamp, stilt, vacuum and edit settings, its slope condition or a procedural coral, are
|
||||
module-owned classes too (`art.arcane.iris.builtin.validate`, `.stilt`, `.vacuum`, `.blocks`, `.prepare`, `.carve`,
|
||||
`.floating`, `.objects.*`), so studio describes them from the module's own annotations. Iris reads a placement's module
|
||||
settings (the keys pack modules add at `Level.PLACEMENT`) from the JSON the placement was written as (`json()`); a
|
||||
placement made in code uses `ObjectPlacement.builder()` or `toBuilder()`. Packs write the same JSON as before. Behaviour
|
||||
that needs Iris (noise built from the styles, blocks resolved through the pack, baked object variants) lives in `Resolved*` classes beside the
|
||||
worker (`ResolvedReplace`, `ResolvedCaveProfile`, `ResolvedFloatingChild`, `ResolvedProceduralPlacement`).
|
||||
|
||||
`iris:decorant` is the second: `DecorantSettings` (biome level) holds `Decorator`s in `art.arcane.iris.builtin.decorant`,
|
||||
written `"decorators": [...]` as always (`@Feature(key = "decorators", root = "decorators")`).
|
||||
`ResolvedDecorator` resolves one decorator's blocks and noise for a world; `BiomeDecorators`, the world's state, keeps them
|
||||
per biome and place. A chunk's decorators place into a `DecorationScene` (its blocks, the planned blocks around it, the terrain and the pack's block
|
||||
rules); other modules that decorate (the caves' floors and ceilings, floating islands) build one from their chunk's stage context. Whether a
|
||||
dimension decorates at all is its `decorate` key (`DecorateSettings`). A decorator's noise
|
||||
seed is the world's decorator seed, its biome's key and its place in the biome's list. The module's `warmUp` builds
|
||||
them ahead of generation; `iris:terrain` and `iris:objects` warm their ore generators, placements and procedural
|
||||
objects the same way.
|
||||
|
||||
`iris:terrain` and `iris:post` own the fields that shape a column's blocks. Per biome: `layers`, `seaLayers`, `caveCeilingLayers` (lists of
|
||||
`PaletteLayer`, the old biome palette layer, in `art.arcane.iris.builtin.terrain`), `slab` and `wall` (one `PaletteLayer` each), `lockLayers` (a
|
||||
boolean) and `lockLayersMax` (a number). Per dimension: `rockPalette` and `fluidPalette` (a `PaletteSpec` each) in `art.arcane.iris.modules.terrain`, and
|
||||
`postProcessing`, `postProcessingSlabs`, `postProcessingWalls` (booleans) in `art.arcane.iris.modules.post`; `bedrock`, `explodeBiomePalettes` and
|
||||
`explodeBiomePaletteSize` are dimension keys of `iris:terrain` too. A key a pack leaves out has the
|
||||
default Iris always had (one grass layer, no slab or wall, stone and water, post processing on). `ResolvedLayer` resolves one layer's blocks and noise
|
||||
for a pack, `BiomeLayers`, the world's state, keeps them and stacks a biome's layers into the blocks of a column, and `TerrainPalettes` is the world's
|
||||
rock and fluid as a block for every column; the terrain, cave, floating, post and vacuum stages ask them. All of them are the jar's own
|
||||
(`art.arcane.iris.modules.terrain`), and every stage that asks is in the jar, so one copy serves them all: a biome's layer thickness noise is built once,
|
||||
from the random of whoever asks first, as it always was. The slope limit of a layer, a decorator and an
|
||||
object placement is the one `SlopeClip`.
|
||||
|
||||
Caves, floating islands and ores are settings of their modules too, written under the keys they always had. `iris:carve` owns
|
||||
`caveProfile` (dimension, region, biome; an object, or a `snippet/iris/carve/cave-profile/...` reference), `carving` (dimension; a list of bands) and
|
||||
`carvingEnabled` (dimension; a boolean), `carvingBiome` (biome; a biome key) and `caveMinDepthBelowSurface` (biome; a number). `iris:floating`
|
||||
owns `floatingChildBiomes` (biome; a list) and `mergeFloatingChildBiomes` (biome; a boolean). `iris:terrain` owns `ores` (dimension, region,
|
||||
biome; a list of generators) and `hideOresForHiddenOre` (dimension; a boolean); `iris:deposit` owns `depositVariants` (dimension, region, biome; a list)
|
||||
and `oreDepositFrequencyMultiplier` and `oreDepositSizeMultiplier` (biome; numbers). Behaviour that needs Iris lives in the `Resolved*` classes beside the
|
||||
workers: `ResolvedOre`/`ResolvedOres` (blocks and chance noise per world, `TerrainOres` the world's state), `ResolvedDepositVariant`,
|
||||
`ResolvedCarvingEntry`/`CarvingBands`/`CarvingResolver` (the band for a position) and `ResolvedFloatingChild`. The settings that name biomes
|
||||
(`carvingBiome`, a band's biome, a floating child's target and carving) implement `LinkedBiomes`, which is how Iris's biome tree and the biomes a
|
||||
dimension reaches learn of them without reading the settings classes; and `iris:carve` provides the `CaveBiomes` service
|
||||
(`CaveBiomeBands`), which Iris asks for the dimension's carving band at a position and for a biome's minimum cave depth.
|
||||
`iris:floating` ships in the built-ins jar: `FloatingWorld` holds a world's floating children, noise and seeds. It asks the
|
||||
API alone: the running world's layout for a column's surface biome and a biome's height for the `BIOME` top shape
|
||||
(`TerrainSampler.biomeHeight`), the chunk's terrain for a child's sky biome (`skyBiome`), which it writes with
|
||||
`Mantle.setPlatformBiome`, and `PackWorld.placements()` to place an object floating, on an island's top or hung under it,
|
||||
where the jar's `IslandAnchor` says where the island face is.
|
||||
|
||||
Packs write each settings feature under the short key it declares: `deposits` (dimension, region, biome; a list), `decorators`
|
||||
(biome; a list), `importedStructures` (dimension; an object of `disabled`, `adjustments` and the rest) and `structures`
|
||||
(dimension, region, biome; a list of `StructurePlacement`s, `StructurePlacementSettings`). The feature ids
|
||||
(`iris:deposit`, `iris:decorant`, `iris:structure`) stay the modules' identity in the stage graph and logs. A key is unique
|
||||
per target across all modules and Iris's own fields, so a new built-in or pack module picks a key no field of the target uses.
|
||||
|
||||
Every built-in stage is a full port: the module owns its logic and per-engine state, and the mantle stages
|
||||
work out their reach from the pack when it loads. A dimension's `disabledComponents` turns a mantle stage off
|
||||
by its stage id, such as `iris:carve/caves`; a name that matches no stage fails the world.
|
||||
|
||||
## Building
|
||||
|
||||
This is a Gradle build of its own (`art.arcane:iris-module`). Its compile classpath is the Iris API
|
||||
(`com.volmit:iris-api`, from the sibling `../IrisApi` checkout; never `iris-host`), VolmLib, Gson, Lombok and the JDK,
|
||||
all `compileOnly`: a host provides them at runtime. VolmLib comes from a sibling `VolmLib` checkout when there is one,
|
||||
found the way Iris finds it (`-PuseLocalVolmLib=false`, `-PlocalVolmLibDirectory=<path>` or `VOLMLIB_DIR`), otherwise
|
||||
from the published `volmLibCoordinate` in `gradle.properties`, which matches Iris's. Classes compile with Iris's options
|
||||
(`-parameters`, no debug info) and `lombok.config` repeats Iris's, so they are the classes Iris shipped when it
|
||||
compiled these sources itself.
|
||||
|
||||
Iris includes this build (`includeBuild('../IrisModule')` in its `settings.gradle`) and depends on its classes: Iris
|
||||
core and its adapters still name many of them (the cut-over that ends this comes later). Classes that need Iris itself
|
||||
are Iris's and live in Iris core: the layout model (`IrisBiome`, `IrisRegion`, `IrisDimension`, generators, noise
|
||||
styles, expressions, images), the pack's objects and blocks, the structure assembler, locator, fitting and placer
|
||||
(behind `StructureHost`), and the placement service behind `PackWorld.placements()`. A module this build holds
|
||||
but the jar does not, such as `iris:structure`, is one Iris registers with its own modules (`IrisModuleHost`): its
|
||||
classes are then the ones Iris's own code sees.
|
||||
|
||||
`./gradlew check` compiles every source and builds the built-ins jar below, which runs the pack class checks.
|
||||
|
||||
## Built-in modules as a pack module jar
|
||||
|
||||
This build packages the built-in modules as an ordinary pack module jar, `build/libs/iris-builtins.jar`, from its own
|
||||
classes, and Iris bundles it into the plugin: every pack loads it as if it were in its `modules/` folder (IrisApi's
|
||||
`ModuleHost.bundlingJars`). A pack must not hold a copy of it: its classes would be in two jars, so the pack fails to load
|
||||
naming both. `./gradlew builtinModulesJar` builds it. `builtin-modules.txt` lists what goes in: `module <class>` lines
|
||||
(the jar's entry points, written to `META-INF/services/com.volmit.IrisModule`) and `include <pattern>` lines for further
|
||||
classes. Iris asks for the jar by the capability `art.arcane:iris-builtins`; its plugin leaves the jar's classes out of
|
||||
its own, and its Bukkit artifact check fails the build if Iris still uses one of them.
|
||||
Before the jar is written, `ModuleJarCheck` of IrisApi runs the class checks of a pack load on it, with the packages Iris
|
||||
exposes (`art.arcane.iris.builtin`, VolmLib's `art.arcane.volmlib` and Gson's `com.google.gson`, all three on the check's
|
||||
classpath, with this build's other classes as the host's); a listed class that uses a class outside the jar and those
|
||||
packages fails the task naming the class and what it uses. Iris checks the jar once more before bundling it, against the
|
||||
VolmLib classes its Bukkit jar strips (`core/volmlib-left-out-of-bukkit-jar.txt`), which only Iris knows.
|
||||
|
||||
The jar holds `iris:post`, `iris:perfection`, `iris:matter`, `iris:loot`, `iris:spawn`, `iris:vanilla-features` and
|
||||
`iris:carve`, and the object placement stages `iris:prepare`, `iris:anchor`, `iris:validate`, `iris:bore`, `iris:blocks`, `iris:stilt`, `iris:vacuum` and `iris:snow`. They are
|
||||
written against IrisApi and `art.arcane.iris.builtin` alone: the chunk's `BlockState` hunk, the block registry's traits and
|
||||
`canPlaceOn`, the terrain sampler (heights around the chunk, slope, fluid height, where the upper dimension begins) and the
|
||||
mantle's planned blocks; the placement stages read the placement being run through the `ObjectPlacement` facade, and the loot and
|
||||
spawn services, which have no chunk to ask, ask the running world (`world.running()`, IrisApi's `RunningWorld`). Without the jar a pack's world has no caves, vanilla
|
||||
placed features, loot, block drops, entity spawns or ambient effects, and its biomes' `loot`, `blockDrops`, `entitySpawners` and
|
||||
`effects` are not read.
|
||||
Iris no longer compiles them in (`IrisModuleHost.generationModules()`); every pack gets them from the bundled jar. A pack
|
||||
still loads without them, as with an Iris build that bundles no jar, and Iris warns once per pack folder when a pack loads
|
||||
none of the jar's modules (`IrisModuleHost.JAR_MODULE_IDS`, which a test keeps equal to
|
||||
`builtin-modules.txt`): add a module to the jar and to that list together.
|
||||
|
||||
`art.arcane.iris.builtin` also holds what the compiled-in built-ins and the jar must share, because each sees its own copy of
|
||||
every other class. The facades among them are interfaces Iris implements and offers through IrisApi's extension point, never
|
||||
through the thread or a cast: a module asks `world.extension(X.class)` for what belongs to a world (`StructureHost`),
|
||||
`context.extension(X.class)` for what belongs to one invocation (`IrisChunk` in a chunk stage, `IrisMantleChunk` in a mantle stage) and
|
||||
`settings.extension(X.class)` for a reach worked out
|
||||
before any world exists, each with `.orElseThrow()`, since a built-in runs only where Iris offers them. Iris's per-feature world seeds are
|
||||
IrisApi purpose seeds: `world.seed(IrisSeedPurposes.CARVE)` (`iris:seed/carve`), by the API's rule like any module's. What the
|
||||
built-ins keep with a world across restarts, such as the spawner cooldowns (`SpawnCooldownBook`), they save through
|
||||
`RunningWorld.saved`; object placing seeds its chunk random, density noise and virtual heightmaps from purpose seeds and IrisApi noise.
|
||||
The package also holds `loot.LootResolver` (the random streams loot is drawn from, shared with the hosts that fill containers) and the loot and
|
||||
marker lists of an object placement (`loot.ObjectLoot`, `loot.ObjectVanillaLoot`, `spawn.PlacementMarker`). The placement stages need more of the object being
|
||||
placed than IrisApi describes, so `placement.ObjectPlacement` is the facade Iris implements for each placement and offers with
|
||||
its invocation (`context.extension(ObjectPlacement.class)`): the object's size (`ObjectShape`), the placement's settings (`PlacementSettings`, read from
|
||||
the `objects.ObjectPlacement` being placed), the terrain questions of its placer and the world around it (`PlacementTerrain`), the surface warp,
|
||||
and the block operations only the platform can do (turning a state with the object, merging two states, matching, traits of the
|
||||
placement's own states). Its types answer with IrisApi, VolmLib and built-in values only. `prepare.PreparedPlacement`, the output of
|
||||
`iris:prepare/transforms`, lives in the exposed package too, because `IrisStages` names it. `iris:post` reads its switches
|
||||
(`postProcessingWalls`, `postProcessingSlabs`) and the biome's `wall` and `slab` as module settings through its context.
|
||||
|
||||
`iris:carve` plans its caves in IrisApi's host-owned `Mantle.carved()` layer (`CarvedVoid`: open, fluid, lava or air, and optionally a
|
||||
biome), which Iris keeps in its own form for the platform and the rest of Iris to read. The mantle stage writes it; the apply stage
|
||||
reads it, and one block beyond its chunk to wall the caves that cross the border. The cave floors the spawners use are marked by the mantle
|
||||
stage with `PlacementTerrain.mark(PackMarker("cave_floor"))`. What a
|
||||
cave's walls, floor and ceiling get comes from the terrain and decorant built-ins of the same jar (`modules.terrain.BiomeLayers`,
|
||||
`modules.terrain.TerrainPalettes`, the biome decorators), through carve's own `CaveDressing`, which tests replace with fixed blocks.
|
||||
A cave's dimension, region and biome settings are found by the id the layout's biome samples carry (`DeclaredByLevel`), its
|
||||
absolute world Y bands convert with `PackWorld.minWorldY()`, and its noise reads `NoiseSampler.signed(...)` (Iris's memoised signed read)
|
||||
and `scaled(...)`. `caveLavaHeight` and `upperDimensionCarving` are its dimension settings.
|
||||
@@ -0,0 +1,179 @@
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
group = "art.arcane"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
base {
|
||||
archivesName.set("iris-module")
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://jitpack.io") // VolmLib, when no sibling checkout is found
|
||||
}
|
||||
|
||||
val volmLibCoordinate = providers.gradleProperty("volmLibCoordinate").get()
|
||||
|
||||
// What a module may use: the Iris API, VolmLib and Gson, which every Iris host provides, and the JDK. None of them ships
|
||||
// with the module.
|
||||
dependencies {
|
||||
compileOnly("com.volmit:iris-api")
|
||||
compileOnly(volmLibCoordinate) {
|
||||
isTransitive = false
|
||||
}
|
||||
compileOnly("com.google.code.gson:gson:2.14.0")
|
||||
compileOnly("org.projectlombok:lombok:1.18.46")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.46")
|
||||
}
|
||||
|
||||
// The same options as Iris's own compilation, so the classes, and the built-ins jar made from them, are the ones Iris
|
||||
// shipped when it compiled these sources itself.
|
||||
tasks.named<JavaCompile>("compileJava") {
|
||||
options.encoding = "UTF-8"
|
||||
options.compilerArgs.add("-parameters")
|
||||
options.debugOptions.debugLevel = "none"
|
||||
// lombok.config decides which members Lombok generates; Gradle does not know it is an input.
|
||||
inputs.file(layout.projectDirectory.file("lombok.config"))
|
||||
.withPropertyName("lombokConfig")
|
||||
.withPathSensitivity(PathSensitivity.NONE)
|
||||
}
|
||||
|
||||
// The built-ins as a pack module jar, build/libs/iris-builtins.jar. builtin-modules.txt lists what goes in:
|
||||
// "module <class>" (an entry point, with its nested classes) or "include <ant pattern>".
|
||||
val builtinModulesJarName = "iris-builtins.jar"
|
||||
val builtinModuleEntryFile = "com.volmit.IrisModule"
|
||||
val builtinModulesFile = layout.projectDirectory.file("builtin-modules.txt").asFile
|
||||
// The packages an Iris host exposes to pack modules besides the API (Iris's IrisModuleHost.EXPOSED_PACKAGES).
|
||||
val exposedHostPackages = listOf("art.arcane.iris.builtin", "art.arcane.volmlib", "com.google.gson")
|
||||
|
||||
data class BuiltinModulesList(val moduleClasses: List<String>, val classPatterns: List<String>)
|
||||
|
||||
fun readBuiltinModulesList(): BuiltinModulesList {
|
||||
val moduleClasses = mutableListOf<String>()
|
||||
val classPatterns = mutableListOf<String>()
|
||||
builtinModulesFile.readLines()
|
||||
.map { it.substringBefore('#').trim() }
|
||||
.filter { it.isNotEmpty() }
|
||||
.forEach { line ->
|
||||
val parts = line.split(Regex("\\s+"), limit = 2)
|
||||
if (parts.size < 2 || parts[1].isBlank()) {
|
||||
throw GradleException("${builtinModulesFile.name}: '$line' needs a value after '${parts[0]}'")
|
||||
}
|
||||
when (parts[0]) {
|
||||
"module" -> moduleClasses.add(parts[1].trim())
|
||||
"include" -> classPatterns.add(parts[1].trim())
|
||||
else -> throw GradleException("${builtinModulesFile.name}: unknown line '$line'; start it with 'module' or 'include'")
|
||||
}
|
||||
}
|
||||
return BuiltinModulesList(moduleClasses, classPatterns)
|
||||
}
|
||||
|
||||
val builtinModulesList = readBuiltinModulesList()
|
||||
val builtinPackagedPatterns = builtinModulesList.moduleClasses.flatMap { moduleClass ->
|
||||
val path = moduleClass.replace('.', '/')
|
||||
listOf("$path.class", "$path\$*.class")
|
||||
} + builtinModulesList.classPatterns
|
||||
val builtinModulesBuild = layout.buildDirectory.dir("builtin-modules")
|
||||
|
||||
val writeBuiltinModuleEntries = tasks.register("writeBuiltinModuleEntries") {
|
||||
description = "Writes the built-ins jar's META-INF/services/$builtinModuleEntryFile, one module class per line."
|
||||
val entries = builtinModulesBuild.map { it.file("services/$builtinModuleEntryFile") }
|
||||
inputs.file(builtinModulesFile)
|
||||
outputs.file(entries)
|
||||
doLast {
|
||||
val entriesFile = entries.get().asFile
|
||||
entriesFile.parentFile.mkdirs()
|
||||
entriesFile.writeText(builtinModulesList.moduleClasses.joinToString("\n") + "\n")
|
||||
}
|
||||
}
|
||||
|
||||
val packageBuiltinModules = tasks.register<Jar>("packageBuiltinModules") {
|
||||
description = "Packages the listed built-in modules and classes before they are checked."
|
||||
archiveFileName.set(builtinModulesJarName)
|
||||
destinationDirectory.set(builtinModulesBuild.map { it.dir("unchecked") })
|
||||
inputs.file(builtinModulesFile)
|
||||
from(sourceSets.main.map { it.java.classesDirectory }) {
|
||||
include(builtinPackagedPatterns)
|
||||
}
|
||||
from(writeBuiltinModuleEntries) {
|
||||
into("META-INF/services")
|
||||
}
|
||||
}
|
||||
|
||||
// The check runs on the API's host side, which knows the rules of a pack load; the module classes are on its class path as
|
||||
// the host's, so a listed class that uses one left out of the jar fails as it would in Iris.
|
||||
val builtinModulesCheckClasspath = configurations.create("builtinModulesCheckClasspath") {
|
||||
isCanBeConsumed = false
|
||||
isTransitive = false
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
builtinModulesCheckClasspath("com.volmit:iris-api")
|
||||
builtinModulesCheckClasspath("com.volmit:iris-host")
|
||||
builtinModulesCheckClasspath(volmLibCoordinate)
|
||||
builtinModulesCheckClasspath("com.google.code.gson:gson:2.14.0")
|
||||
}
|
||||
|
||||
val builtinModulesJar = tasks.register<JavaExec>("builtinModulesJar") {
|
||||
group = "build"
|
||||
description = "Builds build/libs/$builtinModulesJarName, the built-in modules as a pack module jar, checked with IrisApi's" +
|
||||
" pack class and reference checks as a pack load would."
|
||||
val unchecked = packageBuiltinModules.flatMap { it.archiveFile }
|
||||
val checked = layout.buildDirectory.file("libs/$builtinModulesJarName")
|
||||
classpath = builtinModulesCheckClasspath + files(sourceSets.main.map { it.java.classesDirectory })
|
||||
mainClass.set("com.volmit.host.ModuleJarCheck")
|
||||
inputs.file(unchecked)
|
||||
outputs.file(checked)
|
||||
argumentProviders.add(CommandLineArgumentProvider { listOf(unchecked.get().asFile.absolutePath) + exposedHostPackages })
|
||||
isIgnoreExitValue = true
|
||||
val problems = ByteArrayOutputStream()
|
||||
errorOutput = problems
|
||||
doFirst {
|
||||
// A jar from an earlier run that passed must not survive a run that fails.
|
||||
checked.get().asFile.delete()
|
||||
}
|
||||
doLast {
|
||||
if (executionResult.get().exitValue != 0) {
|
||||
throw GradleException("The built-in modules jar breaks the rules of a pack module jar:\n" + problems.toString().trim() +
|
||||
"\nFix the classes listed in ${builtinModulesFile.name}, or move what they use into the jar or into art.arcane.iris.builtin.")
|
||||
}
|
||||
unchecked.get().asFile.copyTo(checked.get().asFile, overwrite = true)
|
||||
}
|
||||
}
|
||||
|
||||
// Iris bundles the checked jar into its plugin. It asks for it by this capability of the module's coordinate.
|
||||
configurations.create("builtinModulesJarElements") {
|
||||
isCanBeConsumed = true
|
||||
isCanBeResolved = false
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
|
||||
}
|
||||
outgoing.capability("art.arcane:iris-builtins:${project.version}")
|
||||
outgoing.artifact(builtinModulesJar.map { layout.buildDirectory.file("libs/$builtinModulesJarName").get() }) {
|
||||
builtBy(builtinModulesJar)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("check") {
|
||||
dependsOn(builtinModulesJar)
|
||||
}
|
||||
|
||||
tasks.named("assemble") {
|
||||
dependsOn(builtinModulesJar)
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
# What goes into build/libs/iris-builtins.jar, the built-in modules as a pack module jar.
|
||||
#
|
||||
# A line is one of (blank lines and # comments are ignored):
|
||||
#
|
||||
# module <binary class name> an IrisModule class. It is listed in META-INF/services/com.volmit.IrisModule,
|
||||
# and its nested classes are packaged with it.
|
||||
# include <class pattern> more classes for the jar, as an Ant pattern relative to the class root, such as
|
||||
# art/arcane/iris/engine/modifier/carve/** Settings types, helpers and stage
|
||||
# constants a listed module owns go here.
|
||||
#
|
||||
# A class here must be one a pack module may have: it may use only the IrisApi, the packages Iris exposes
|
||||
# (art.arcane.iris.builtin), the JDK and the other classes of the jar. `./gradlew builtinModulesJar` checks
|
||||
# that with IrisApi's pack class checks and fails naming the class and what it uses.
|
||||
#
|
||||
# Moving a module here means removing it from IrisModuleHost.generationModules() in Iris.
|
||||
|
||||
# The settings and helper types only the jar's modules use, which Iris does not expose.
|
||||
include art/arcane/iris/modules/**
|
||||
|
||||
module art.arcane.iris.engine.modifier.PostModule
|
||||
include art/arcane/iris/engine/modifier/SurfaceSmoothing*.class
|
||||
module art.arcane.iris.engine.modifier.PerfectionModule
|
||||
module art.arcane.iris.engine.modifier.MatterModule
|
||||
module art.arcane.iris.engine.loot.LootModule
|
||||
include art/arcane/iris/engine/loot/**
|
||||
module art.arcane.iris.engine.spawn.SpawnModule
|
||||
include art/arcane/iris/engine/spawn/**
|
||||
module art.arcane.iris.engine.object.placement.PrepareModule
|
||||
module art.arcane.iris.engine.object.placement.AnchorModule
|
||||
module art.arcane.iris.engine.object.placement.ValidateModule
|
||||
module art.arcane.iris.engine.object.placement.BoreModule
|
||||
module art.arcane.iris.engine.object.placement.BlocksModule
|
||||
module art.arcane.iris.engine.object.placement.StiltModule
|
||||
module art.arcane.iris.engine.object.placement.VacuumModule
|
||||
module art.arcane.iris.engine.object.placement.SnowModule
|
||||
include art/arcane/iris/engine/object/placement/PlacementModules.class
|
||||
include art/arcane/iris/engine/object/placement/PlacementWorld.class
|
||||
include art/arcane/iris/engine/object/placement/WorldVolume.class
|
||||
include art/arcane/iris/engine/object/placement/ObjectEdits*.class
|
||||
include art/arcane/iris/engine/object/placement/ResolvedReplace*.class
|
||||
include art/arcane/iris/engine/object/placement/IrisSurfaceSupport*.class
|
||||
include art/arcane/iris/engine/object/placement/IrisObjectVacuum.class
|
||||
module art.arcane.iris.engine.framework.vanillafeatures.VanillaFeaturesModule
|
||||
include art/arcane/iris/engine/framework/vanillafeatures/**
|
||||
module art.arcane.iris.engine.modifier.CarveModule
|
||||
include art/arcane/iris/engine/modifier/CaveApplying*.class
|
||||
include art/arcane/iris/engine/modifier/CaveDressing.class
|
||||
include art/arcane/iris/engine/modifier/BuiltInCaveDressing.class
|
||||
include art/arcane/iris/engine/modifier/CaveBiomeBands*.class
|
||||
include art/arcane/iris/engine/modifier/CaveBiomeCache.class
|
||||
include art/arcane/iris/engine/modifier/CaveBlockClasses.class
|
||||
include art/arcane/iris/engine/modifier/CarveColumnMask.class
|
||||
include art/arcane/iris/engine/modifier/CarveWallBuffer*.class
|
||||
include art/arcane/iris/engine/modifier/IrisCarveScratch.class
|
||||
include art/arcane/iris/engine/mantle/components/CarveOrphanSweep*.class
|
||||
include art/arcane/iris/engine/mantle/components/CarveWorld.class
|
||||
include art/arcane/iris/engine/mantle/components/CaveCarveScratch*.class
|
||||
include art/arcane/iris/engine/mantle/components/CaveCarving*.class
|
||||
include art/arcane/iris/engine/mantle/components/CaveFieldModuleState.class
|
||||
include art/arcane/iris/engine/mantle/components/CaveFloorMarking*.class
|
||||
include art/arcane/iris/engine/mantle/components/CaveFluidSupportPlan*.class
|
||||
include art/arcane/iris/engine/mantle/components/IrisCaveCarver3D*.class
|
||||
include art/arcane/iris/engine/mantle/components/SurfaceFluidBoundaryPlan*.class
|
||||
include art/arcane/iris/engine/object/terrain/carving/CarvingResolver*.class
|
||||
include art/arcane/iris/engine/object/terrain/carving/CaveProfileSampler*.class
|
||||
include art/arcane/iris/engine/object/terrain/carving/DeclaredByLevel.class
|
||||
include art/arcane/iris/engine/object/terrain/carving/DeclaredCaveProfiles.class
|
||||
include art/arcane/iris/engine/object/terrain/carving/ResolvedCarvingEntry.class
|
||||
module art.arcane.iris.engine.modifier.DepositModule
|
||||
include art/arcane/iris/engine/modifier/DepositPlacer*.class
|
||||
include art/arcane/iris/engine/modifier/DepositClump*.class
|
||||
include art/arcane/iris/engine/modifier/ResolvedDeposit*.class
|
||||
module art.arcane.iris.engine.actuator.DecorantModule
|
||||
include art/arcane/iris/engine/decorator/**
|
||||
module art.arcane.iris.engine.actuator.TerrainModule
|
||||
include art/arcane/iris/engine/actuator/Terrain*.class
|
||||
include art/arcane/iris/engine/actuator/ResolvedOre*.class
|
||||
include art/arcane/iris/engine/actuator/OreWarmUp*.class
|
||||
module art.arcane.iris.engine.mantle.components.ObjectModule
|
||||
include art/arcane/iris/engine/mantle/components/ObjectPlacing*.class
|
||||
include art/arcane/iris/engine/mantle/components/ChunkObjectPlacing*.class
|
||||
include art/arcane/iris/engine/mantle/components/CaveAnchors*.class
|
||||
include art/arcane/iris/engine/mantle/components/CaveSettings*.class
|
||||
include art/arcane/iris/engine/mantle/components/CaveRejects*.class
|
||||
include art/arcane/iris/engine/mantle/components/EffectivePlacements*.class
|
||||
include art/arcane/iris/engine/mantle/components/PlacementReach*.class
|
||||
include art/arcane/iris/engine/mantle/components/ObjectWarmUp*.class
|
||||
include art/arcane/iris/engine/mantle/components/ObjectLocating*.class
|
||||
include art/arcane/iris/engine/mantle/components/TreeGrowing*.class
|
||||
include art/arcane/iris/engine/mantle/components/ObjectChunk*.class
|
||||
include art/arcane/iris/engine/mantle/components/GoldenDebugTerrain*.class
|
||||
include art/arcane/iris/engine/procedural/**
|
||||
module art.arcane.iris.engine.modifier.FloatingModule
|
||||
include art/arcane/iris/engine/modifier/FloatingIslands*.class
|
||||
include art/arcane/iris/engine/object/terrain/floating/**
|
||||
include art/arcane/iris/engine/mantle/components/FloatingObjectPlacing*.class
|
||||
include art/arcane/iris/engine/mantle/components/FloatingPlacer*.class
|
||||
include art/arcane/iris/engine/mantle/components/FloatingIslandSampleResolver*.class
|
||||
include art/arcane/iris/engine/mantle/components/IslandFace*.class
|
||||
include art/arcane/iris/engine/mantle/components/UndersideTurn*.class
|
||||
# iris:structure (art.arcane.iris.engine.mantle.components.StructureModule) is not here: Iris registers it with its own
|
||||
# modules, because its jigsaw studio reads the structure resources the module registers.
|
||||
@@ -0,0 +1,3 @@
|
||||
# The published VolmLib the build resolves when no sibling checkout is found (see settings.gradle.kts). Keep it equal to
|
||||
# Iris's volmLibCoordinate: Iris ships VolmLib and the built-ins run against that copy.
|
||||
volmLibCoordinate=com.github.VolmitSoftware:VolmLib:e6574cf814b3dd670385a4d632a63fde2038e186
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
@@ -0,0 +1,5 @@
|
||||
# Iris compiled these sources itself before they had a build of their own, so this repeats ../Iris/lombok.config to keep
|
||||
# the members Lombok generates, and with them the classes Iris ships, unchanged. ../Iris/lombok.config explains each setting.
|
||||
config.stopBubbling = true
|
||||
lombok.equalsAndHashCode.doNotUseGetters = true
|
||||
lombok.toString.doNotUseGetters = true
|
||||
@@ -0,0 +1,42 @@
|
||||
rootProject.name = "IrisModule"
|
||||
|
||||
// The built-ins compile against the Iris API alone, from the sibling checkout. Never against iris-host: that is what a host
|
||||
// such as Iris uses to load modules, and packs never see it.
|
||||
includeBuild("../IrisApi") {
|
||||
dependencySubstitution {
|
||||
substitute(module("com.volmit:iris-api")).using(project(":api"))
|
||||
substitute(module("com.volmit:iris-host")).using(project(":host"))
|
||||
}
|
||||
}
|
||||
|
||||
// VolmLib from a sibling checkout when there is one, as Iris resolves it (Iris's gradle/volmlib-resolution.settings.gradle):
|
||||
// -PuseLocalVolmLib=false turns it off, -PlocalVolmLibDirectory=<path> or VOLMLIB_DIR names the checkout, and otherwise the
|
||||
// first `VolmLib` folder with a settings script above this one is used. Without one, the build resolves the published
|
||||
// coordinate in gradle.properties.
|
||||
fun hasSettingsScript(directory: File): Boolean =
|
||||
File(directory, "settings.gradle.kts").exists() || File(directory, "settings.gradle").exists()
|
||||
|
||||
fun localVolmLibDirectory(): File? {
|
||||
val configuredPath = providers.gradleProperty("localVolmLibDirectory")
|
||||
.orElse(providers.environmentVariable("VOLMLIB_DIR"))
|
||||
.orNull
|
||||
if (!configuredPath.isNullOrBlank()) {
|
||||
val configured = File(configuredPath).let { if (it.isAbsolute) it else File(settingsDir, configuredPath) }
|
||||
if (hasSettingsScript(configured)) {
|
||||
return configured
|
||||
}
|
||||
}
|
||||
return generateSequence(settingsDir) { it.parentFile }
|
||||
.map { File(it, "VolmLib") }
|
||||
.firstOrNull { hasSettingsScript(it) }
|
||||
}
|
||||
|
||||
val useLocalVolmLib = providers.gradleProperty("useLocalVolmLib").orElse("true").get().equals("true", ignoreCase = true)
|
||||
val volmLibCheckout = if (useLocalVolmLib) localVolmLibDirectory() else null
|
||||
if (volmLibCheckout != null) {
|
||||
includeBuild(volmLibCheckout) {
|
||||
dependencySubstitution {
|
||||
substitute(module("com.github.VolmitSoftware:VolmLib")).using(project(":shared"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.builtin;
|
||||
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
/**
|
||||
* The purposes Iris's built-in modules ask {@link PackWorld#seed(ResourceId)} for, one per feature.
|
||||
*/
|
||||
public final class IrisSeedPurposes {
|
||||
public static final ResourceId BIOME = purpose("biome");
|
||||
public static final ResourceId CARVE = purpose("carve");
|
||||
public static final ResourceId COMPLEX = purpose("complex");
|
||||
public static final ResourceId COMPONENT = purpose("component");
|
||||
public static final ResourceId DECORATOR = purpose("decorator");
|
||||
public static final ResourceId DEPOSIT = purpose("deposit");
|
||||
public static final ResourceId ENTITY = purpose("entity");
|
||||
public static final ResourceId LOOT = purpose("loot");
|
||||
public static final ResourceId MANTLE = purpose("mantle");
|
||||
/** The random each chunk's objects are placed with, before the chunk's coordinates are mixed in. */
|
||||
public static final ResourceId OBJECT_CHUNK = purpose("object-chunk");
|
||||
/** The noise that picks the count of a placement with a density style. */
|
||||
public static final ResourceId OBJECT_DENSITY = purpose("object-density");
|
||||
/** The noise that warps the columns of object placements with a surface warp. */
|
||||
public static final ResourceId OBJECT_WARP = purpose("object-warp");
|
||||
/** The candidate spots, ranks and chance noise of separated object placements. */
|
||||
public static final ResourceId OBJECT_SEPARATION = purpose("object-separation");
|
||||
public static final ResourceId POST = purpose("post");
|
||||
public static final ResourceId TERRAIN = purpose("terrain");
|
||||
|
||||
private static final String NAMESPACE = "iris";
|
||||
private static final String PATH_PREFIX = "seed/";
|
||||
|
||||
private IrisSeedPurposes() {
|
||||
}
|
||||
|
||||
private static ResourceId purpose(String name) {
|
||||
return new ResourceId(NAMESPACE, PATH_PREFIX + name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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.builtin;
|
||||
|
||||
import com.volmit.stage.ChunkStage;
|
||||
import com.volmit.stage.MantleStage;
|
||||
import com.volmit.stage.Stage;
|
||||
|
||||
/**
|
||||
* The mantle and chunk stages of Iris's built-in modules, one nested class per module, in the order their pipelines
|
||||
* run them: mantle, then chunk. The stage graph decides the actual order. The object placement stages are the
|
||||
* placement modules' own.
|
||||
*/
|
||||
public final class IrisStages {
|
||||
private IrisStages() {
|
||||
}
|
||||
|
||||
/** Module {@code iris:carve}: caves, planned in the mantle and cut into each chunk's terrain. */
|
||||
public static final class Carve {
|
||||
/** Plans the caves of the dimension's cave profiles into the mantle, one block into each neighbor. */
|
||||
public static final MantleStage CAVES = Stage.mantle("iris:carve/caves");
|
||||
/** Cuts the planned caves out of the chunk's terrain and decorates their floors and ceilings. */
|
||||
public static final ChunkStage<Void> APPLY = Stage.chunk("iris:carve/apply");
|
||||
|
||||
private Carve() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:objects}: the objects the dimension's regions and biomes place. */
|
||||
public static final class Objects {
|
||||
/** Places surface, cave and upper-dimension objects into the mantle, after the caves they anchor in. */
|
||||
public static final MantleStage PLACE = Stage.mantle("iris:objects/place");
|
||||
|
||||
private Objects() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:floating}: the floating islands of floating child biomes. */
|
||||
public static final class Floating {
|
||||
/** Places the objects on and under the islands into the mantle, after the dimension's other objects. */
|
||||
public static final MantleStage OBJECTS = Stage.mantle("iris:floating/objects");
|
||||
/** Writes the islands' solid blocks. */
|
||||
public static final ChunkStage<Void> SOLIDS = Stage.chunk("iris:floating/solids");
|
||||
/** Decorates the islands' tops and bottoms once the chunk's own decoration is done. */
|
||||
public static final ChunkStage<Void> DECORATE = Stage.chunk("iris:floating/decorate");
|
||||
|
||||
private Floating() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:structure}: Iris structures, assembled from pieces. */
|
||||
public static final class Structure {
|
||||
/** Places the structures of the dimension, its regions and biomes into the mantle, after objects and floating objects. */
|
||||
public static final MantleStage PLACE = Stage.mantle("iris:structure/place");
|
||||
|
||||
private Structure() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:terrain}: the solid ground, fluids and biome layers of a chunk. */
|
||||
public static final class Terrain {
|
||||
/** Fills each column from bedrock up to its height and the fluid height, with its biome's layers. */
|
||||
public static final ChunkStage<Void> SHAPE = Stage.chunk("iris:terrain/shape");
|
||||
|
||||
private Terrain() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:post}: smoothing a chunk's surface after carving. */
|
||||
public static final class Post {
|
||||
/** Fills single-block holes, places slabs and walls on steps and settles snow. */
|
||||
public static final ChunkStage<Void> SMOOTH = Stage.chunk("iris:post/smooth");
|
||||
|
||||
private Post() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:deposit}: ores and other deposits. */
|
||||
public static final class Deposit {
|
||||
/**
|
||||
* Places the deposits every level declares at the chunk's centre column, the dimension's, the region's and
|
||||
* the biome's, each with its own clumps. Active where any column of the chunk has deposits.
|
||||
*/
|
||||
public static final ChunkStage<Void> ORES = Stage.chunk("iris:deposit/ores");
|
||||
|
||||
private Deposit() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:matter}: the blocks the mantle planned for a chunk, such as objects and structures. */
|
||||
public static final class Matter {
|
||||
/** Copies the chunk's planned mantle blocks into it. */
|
||||
public static final ChunkStage<Void> INSERT = Stage.chunk("iris:matter/insert");
|
||||
|
||||
private Matter() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:decorant}: the decorators of biomes, such as grass, flowers and cave ceilings. */
|
||||
public static final class Decorant {
|
||||
/** Places every column's surface, sea, shore and cave decorators. */
|
||||
public static final ChunkStage<Void> DECORATE = Stage.chunk("iris:decorant/decorate");
|
||||
|
||||
private Decorant() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Module {@code iris:perfection}: the last touches on an overworld chunk's blocks. */
|
||||
public static final class Perfection {
|
||||
/** Hides ores when the dimension asks, then removes decorations that nothing holds up. */
|
||||
public static final ChunkStage<Void> SURFACE = Stage.chunk("iris:perfection/surface");
|
||||
|
||||
private Perfection() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.builtin;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* How the settings of Iris's built-ins name families of the platform's registry keys, such as structures and placed
|
||||
* features: a pattern matches the keys equal to it and the keys it starts at a namespace, slash or underscore boundary,
|
||||
* ignoring case and surrounding space. So {@code minecraft:village} matches {@code minecraft:village_plains},
|
||||
* {@code minecraft:ore} every vanilla ore, and {@code nova_structures:} a whole namespace.
|
||||
*/
|
||||
public final class RegistryKeyFamily {
|
||||
private RegistryKeyFamily() {
|
||||
}
|
||||
|
||||
/** Whether the family pattern {@code pattern} matches the registry key {@code key}. */
|
||||
public static boolean matches(String pattern, String key) {
|
||||
if (pattern == null || key == null) {
|
||||
return false;
|
||||
}
|
||||
String normalizedPattern = normalize(pattern);
|
||||
String normalizedKey = normalize(key);
|
||||
if (normalizedPattern.isEmpty() || !normalizedKey.startsWith(normalizedPattern)) {
|
||||
return false;
|
||||
}
|
||||
if (normalizedKey.length() == normalizedPattern.length()) {
|
||||
return true;
|
||||
}
|
||||
char patternEnd = normalizedPattern.charAt(normalizedPattern.length() - 1);
|
||||
if (patternEnd == ':' || patternEnd == '/' || patternEnd == '_') {
|
||||
return true;
|
||||
}
|
||||
char boundary = normalizedKey.charAt(normalizedPattern.length());
|
||||
return boundary == '/' || boundary == '_';
|
||||
}
|
||||
|
||||
private static String normalize(String key) {
|
||||
return key.trim().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.builtin.anchor;
|
||||
|
||||
/** The height an object's anchor is placed at. */
|
||||
public record AnchorHeight(int y) {
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.builtin.anchor;
|
||||
|
||||
/** How a placement mode finds the height of an object placed without a requested height. */
|
||||
public enum AnchorSampling {
|
||||
/** The surface at the object's center, or the floor of the cave it is placed in. */
|
||||
CENTER,
|
||||
/** The highest surface under any column of the object. */
|
||||
HIGHEST,
|
||||
/** The highest surface under the object's four corners. */
|
||||
HIGHEST_CORNER,
|
||||
/** The lowest surface under any column of the object. */
|
||||
LOWEST,
|
||||
/** The lowest surface under the object's four corners. */
|
||||
LOWEST_CORNER,
|
||||
/** The surface at the object's center, ignoring caves; each block then follows its own column. */
|
||||
SURFACE,
|
||||
/** The translation alone, in open air. */
|
||||
TRANSLATION,
|
||||
/** The requested height, even when negative. */
|
||||
REQUESTED
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 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.builtin.anchor;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
|
||||
@Desc("Object Place modes are useful for positioning objects just right. The default value is CENTER_HEIGHT.")
|
||||
public enum ObjectPlaceMode {
|
||||
@Desc("The default place mode. This mode picks a center point (where the center of the object will be) and takes the height. That height is used for the whole object.")
|
||||
|
||||
CENTER_HEIGHT(PlaceMode.of(AnchorSampling.CENTER, StiltShape.NONE)),
|
||||
|
||||
@Desc("Samples a lot of points where the object will cover (horizontally) and picks the highest height, that height is then used to place the object. This mode is useful for preventing any part of your object from being buried though it will float off of cliffs.")
|
||||
|
||||
MAX_HEIGHT(PlaceMode.of(AnchorSampling.HIGHEST, StiltShape.NONE)),
|
||||
|
||||
@Desc("Samples only 4 points where the object will cover (horizontally) and picks the highest height, that height is then used to place the object. This mode is useful for preventing any part of your object from being buried though it will float off of cliffs.\"")
|
||||
|
||||
FAST_MAX_HEIGHT(PlaceMode.of(AnchorSampling.HIGHEST_CORNER, StiltShape.NONE)),
|
||||
|
||||
@Desc("Samples a lot of points where the object will cover (horizontally) and picks the lowest height, that height is then used to place the object. This mode is useful for preventing any part of your object from overhanging a cliff though it gets buried a lot")
|
||||
MIN_HEIGHT(PlaceMode.of(AnchorSampling.LOWEST, StiltShape.NONE)),
|
||||
|
||||
@Desc("Samples only 4 points where the object will cover (horizontally) and picks the lowest height, that height is then used to place the object. This mode is useful for preventing any part of your object from overhanging a cliff though it gets buried a lot")
|
||||
|
||||
FAST_MIN_HEIGHT(PlaceMode.of(AnchorSampling.LOWEST_CORNER, StiltShape.NONE)),
|
||||
|
||||
@Desc("Stilting is MAX_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
|
||||
|
||||
STILT(PlaceMode.of(AnchorSampling.HIGHEST, StiltShape.STRAIGHT)),
|
||||
|
||||
@Desc("Just like stilting but very inaccurate. Useful for stilting a lot of objects without too much care on accuracy (you can use the over-stilt value to force stilts under ground further)")
|
||||
|
||||
FAST_STILT(PlaceMode.of(AnchorSampling.HIGHEST_CORNER, StiltShape.STRAIGHT)),
|
||||
|
||||
@Desc("Stilting is MIN_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
|
||||
|
||||
MIN_STILT(PlaceMode.of(AnchorSampling.LOWEST, StiltShape.STRAIGHT)),
|
||||
|
||||
@Desc("Just like MIN_STILT but very inaccurate. Useful for stilting a lot of objects without too much care on accuracy (you can use the over-stilt value to force stilts under ground further)")
|
||||
|
||||
FAST_MIN_STILT(PlaceMode.of(AnchorSampling.LOWEST_CORNER, StiltShape.STRAIGHT)),
|
||||
|
||||
@Desc("Stilting is CENTER_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
|
||||
|
||||
CENTER_STILT(PlaceMode.of(AnchorSampling.CENTER, StiltShape.STRAIGHT)),
|
||||
|
||||
@Desc("Erode stilting tapers columns downward like an ice cream cone. Blocks near the center extend deepest while edge blocks drop off first. Blocks are randomly skipped in the lower portion for a rough organic eroded texture.")
|
||||
|
||||
ERODE_STILT(PlaceMode.of(AnchorSampling.HIGHEST, StiltShape.ERODE)),
|
||||
|
||||
@Desc("Organic stilting scans straight down from the bottom of the object to the first solid block (the cave floor, or terrain) and fills the gap with the object's own bottom block. Each column stops at a slightly different, noise-varied depth and the lower portion is randomly broken up, so the underside reads as rough organic roots rather than a flat disc. Designed for objects placed inside caves so they connect to the floor instead of floating. Tune with stilt-settings (organicMaxScan, organicJitter, organicScratch).")
|
||||
|
||||
ORGANIC_STILT(PlaceMode.of(AnchorSampling.CENTER, StiltShape.ORGANIC, PlaceTrait.CAVE_ANCHORED)),
|
||||
|
||||
@Desc("Hangs the object upside-down from a cave ceiling. The object is flipped vertically (its tip points down like a stalactite) and its top is anchored to the ceiling, while an organic, noise-varied stilt grows up into the ceiling so it never floats below the roof. Use inside caves; tune with stilt-settings (organicMaxScan, organicJitter, organicScratch).")
|
||||
|
||||
CEILING_HANG(PlaceMode.of(AnchorSampling.CENTER, StiltShape.CEILING, PlaceTrait.UPSIDE_DOWN, PlaceTrait.CAVE_ANCHORED)),
|
||||
|
||||
@Desc("Anchors the object at the terrain surface (plus translate.y) like CENTER_HEIGHT, then bends the surrounding terrain to be flush with the object's base. Columns inside the object footprint are raised (or lowered) to meet the base, and the deformation falls off parabolically out to a radius so the terrain smoothly blends back to its natural height. Use this to seat a floating/translated object on the ground without a flat stilt disc, e.g. a cube translated up 10 on a mountain pulls the terrain up to meet it. Tune with vacuum-settings (radius, falloff).")
|
||||
|
||||
VACUUM(PlaceMode.vacuum(VacuumProfile.STANDARD)),
|
||||
|
||||
@Desc("VACUUM with a larger radius and finer per-column sampling for the smoothest terrain blend. More expensive.")
|
||||
|
||||
VACUUM_HIGH(PlaceMode.vacuum(VacuumProfile.HIGH)),
|
||||
|
||||
@Desc("VACUUM with a smaller radius and coarser sampling for performance. Use when seating many objects.")
|
||||
|
||||
VACUUM_FAST(PlaceMode.vacuum(VacuumProfile.FAST)),
|
||||
|
||||
@Desc("VACUUM whose falloff radius is perturbed by noise per column, so the terrain meets the object with an irregular organic edge rather than a clean parabolic bowl.")
|
||||
|
||||
VACUUM_ORGANIC(PlaceMode.vacuum(VacuumProfile.ORGANIC)),
|
||||
|
||||
@Desc("VACUUM whose terrain bend is bent by smooth coherent simplex noise so the surface meets the object with a gently rolling, wavy slope instead of the ragged white-noise edge of VACUUM_ORGANIC or a clean parabolic bowl. The object itself still seats flush; the waves fade to zero under the object and at the outer rim, peaking across the mid-slope. Tune with vacuum-settings (waveAmplitude, waveScale).")
|
||||
|
||||
VACUUM_WAVY(PlaceMode.vacuum(VacuumProfile.WAVY)),
|
||||
|
||||
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
|
||||
|
||||
PAINT(PlaceMode.of(AnchorSampling.SURFACE, StiltShape.NONE)),
|
||||
|
||||
@Desc("Places the object in pure air at an absolute Y driven entirely by translate.y (plus optional translate.yRandom). Terrain height, underwater, and carving anchor checks are skipped. Use this for floating islands, sky structures, clouds, or blimps where the object must not be translated to the ground.")
|
||||
|
||||
FLOATING(PlaceMode.of(AnchorSampling.TRANSLATION, StiltShape.NONE, PlaceTrait.FREE_HEIGHT)),
|
||||
|
||||
@Desc("Raw stamp at the caller-supplied (x, y, z). No terrain sampling, no stilting, no Y recomputation, no underwater or carving anchor guards. Used internally to route native Minecraft structure pieces (villages etc.) through the Iris object placer.")
|
||||
|
||||
STRUCTURE_PIECE(PlaceMode.of(AnchorSampling.REQUESTED, StiltShape.NONE, PlaceTrait.RAW_STAMP, PlaceTrait.FREE_HEIGHT));
|
||||
|
||||
private final PlaceMode placeMode;
|
||||
|
||||
ObjectPlaceMode(PlaceMode placeMode) {
|
||||
this.placeMode = placeMode;
|
||||
}
|
||||
|
||||
/** What the mode does, for the placement stages to ask. */
|
||||
public PlaceMode placeMode() {
|
||||
return placeMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* The mode an object takes on a floating island, which has no ground below to grow stilts to or to stamp into: a
|
||||
* stilt down to the ground becomes the same height sampling without the stilt, a raw stamp the default mode.
|
||||
*/
|
||||
public ObjectPlaceMode onFloatingIsland() {
|
||||
if (placeMode.has(PlaceTrait.RAW_STAMP)) {
|
||||
return CENTER_HEIGHT;
|
||||
}
|
||||
if (placeMode.stilt() != StiltShape.STRAIGHT && placeMode.stilt() != StiltShape.ERODE) {
|
||||
return this;
|
||||
}
|
||||
for (ObjectPlaceMode mode : values()) {
|
||||
if (mode.placeMode.equals(PlaceMode.of(placeMode.anchor(), StiltShape.NONE))) {
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("No place mode samples " + placeMode.anchor() + " without a stilt");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.builtin.anchor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* What an object place mode does, as data the placement stages ask instead of comparing modes: how it finds its
|
||||
* height, the stilt it grows, how it bends the terrain around the object, and its traits.
|
||||
*/
|
||||
public record PlaceMode(AnchorSampling anchor, StiltShape stilt, VacuumProfile vacuum, Set<PlaceTrait> traits) {
|
||||
public PlaceMode {
|
||||
traits = Set.copyOf(traits);
|
||||
}
|
||||
|
||||
public static PlaceMode of(AnchorSampling anchor, StiltShape stilt, PlaceTrait... traits) {
|
||||
return new PlaceMode(anchor, stilt, VacuumProfile.NONE, Set.of(traits));
|
||||
}
|
||||
|
||||
public static PlaceMode vacuum(VacuumProfile vacuum) {
|
||||
return new PlaceMode(AnchorSampling.CENTER, StiltShape.NONE, vacuum, Set.of());
|
||||
}
|
||||
|
||||
public boolean has(PlaceTrait trait) {
|
||||
return traits.contains(trait);
|
||||
}
|
||||
|
||||
/** Whether the mode bends the terrain to meet the object's base. */
|
||||
public boolean bendsTerrain() {
|
||||
return vacuum != VacuumProfile.NONE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.builtin.anchor;
|
||||
|
||||
/** A trait of an object place mode that changes what the placement stages do. */
|
||||
public enum PlaceTrait {
|
||||
/** Stamps the object at the requested position as it is: no terrain sampling, no height recomputation. */
|
||||
RAW_STAMP,
|
||||
/** Takes its height from the placement alone, so the terrain, water and carving guards do not apply. */
|
||||
FREE_HEIGHT,
|
||||
/** Flips the object upside down and anchors its top. */
|
||||
UPSIDE_DOWN,
|
||||
/** Anchors to a cave's floor or ceiling, so it keeps its own mode underground. */
|
||||
CAVE_ANCHORED
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.builtin.anchor;
|
||||
|
||||
/** What a placement mode grows between the object and the ground or ceiling. */
|
||||
public enum StiltShape {
|
||||
NONE,
|
||||
/** Repeats the bottom layer straight down to the surface. */
|
||||
STRAIGHT,
|
||||
/** Like {@link #STRAIGHT}, tapering toward the edges and broken up at depth. */
|
||||
ERODE,
|
||||
/** Repeats the bottom layer down to the first solid block, each column a little different. */
|
||||
ORGANIC,
|
||||
/** Hangs the flipped object from a ceiling and grows its top layer up into it. */
|
||||
CEILING
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.builtin.anchor;
|
||||
|
||||
/** How a place mode bends the terrain around the object to meet its base; NONE leaves the terrain alone. */
|
||||
public enum VacuumProfile {
|
||||
NONE(0, 1, Edge.PARABOLIC),
|
||||
STANDARD(12, 1, Edge.PARABOLIC),
|
||||
HIGH(20, 1, Edge.PARABOLIC),
|
||||
FAST(8, 2, Edge.PARABOLIC),
|
||||
ORGANIC(12, 1, Edge.JITTERED),
|
||||
WAVY(12, 1, Edge.WAVY);
|
||||
|
||||
/** The shape of the bend's outer edge. */
|
||||
public enum Edge {
|
||||
PARABOLIC,
|
||||
/** The radius perturbed per column. */
|
||||
JITTERED,
|
||||
/** The bend rolled by smooth noise. */
|
||||
WAVY
|
||||
}
|
||||
|
||||
private final int defaultRadiusBlocks;
|
||||
private final int columnStepBlocks;
|
||||
private final Edge edge;
|
||||
|
||||
VacuumProfile(int defaultRadiusBlocks, int columnStepBlocks, Edge edge) {
|
||||
this.defaultRadiusBlocks = defaultRadiusBlocks;
|
||||
this.columnStepBlocks = columnStepBlocks;
|
||||
this.edge = edge;
|
||||
}
|
||||
|
||||
/** How far the bend reaches when the vacuum settings leave the radius open. */
|
||||
public int defaultRadiusBlocks() {
|
||||
return defaultRadiusBlocks;
|
||||
}
|
||||
|
||||
/** Every how many columns the bend samples the terrain. */
|
||||
public int columnStepBlocks() {
|
||||
return columnStepBlocks;
|
||||
}
|
||||
|
||||
public Edge edge() {
|
||||
return edge;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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.builtin.blocks;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** One find-and-replace of an object placement's blocks, an entry of the placement's {@code edit}. */
|
||||
@Snippet("iris/blocks/object-block-replacer")
|
||||
@Desc("Find and replace object materials")
|
||||
public final class ObjectReplace {
|
||||
@Required
|
||||
@Desc("Find this block")
|
||||
private List<BlockSpec> find = List.of();
|
||||
@Required
|
||||
@Desc("Replace it with this block palette")
|
||||
private PaletteSpec replace = PaletteSpec.of(List.of(BlockSpec.of("stone")));
|
||||
@Desc("Exactly match the block data or not")
|
||||
private boolean exact = false;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Modifies the chance the block is replaced")
|
||||
private float chance = 1;
|
||||
|
||||
public ObjectReplace() {
|
||||
}
|
||||
|
||||
public List<BlockSpec> find() {
|
||||
return find == null ? List.of() : Collections.unmodifiableList(find);
|
||||
}
|
||||
|
||||
public PaletteSpec replace() {
|
||||
return replace == null ? PaletteSpec.of(List.of(BlockSpec.of("stone"))) : replace;
|
||||
}
|
||||
|
||||
public boolean exact() {
|
||||
return exact;
|
||||
}
|
||||
|
||||
public float chance() {
|
||||
return chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.builtin.blocks;
|
||||
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.geometry.BlockPosition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* The object's own blocks a placement wrote, in world positions, in the order they were written. Positions and states
|
||||
* are kept side by side, so recording a block allocates nothing beyond the position the placement already has.
|
||||
*/
|
||||
public final class WrittenBlocks {
|
||||
private final List<BlockPosition> positions = new ArrayList<>();
|
||||
private final List<BlockState> states = new ArrayList<>();
|
||||
|
||||
public void add(BlockPosition position, BlockState state) {
|
||||
positions.add(position);
|
||||
states.add(state);
|
||||
}
|
||||
|
||||
public List<BlockPosition> positions() {
|
||||
return Collections.unmodifiableList(positions);
|
||||
}
|
||||
|
||||
/** The written states, each at the index of its position in {@link #positions()}. */
|
||||
public List<BlockState> states() {
|
||||
return Collections.unmodifiableList(states);
|
||||
}
|
||||
|
||||
/** Each written block's position and state, in the order they were written. */
|
||||
public void forEach(BiConsumer<BlockPosition, BlockState> action) {
|
||||
for (int index = 0; index < positions.size(); index++) {
|
||||
action.accept(positions.get(index), states.get(index));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return positions.isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 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.builtin.carve;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Defines if an object is allowed to place in carvings, surfaces or both.")
|
||||
public enum CarvingMode {
|
||||
@Desc("Only place this object on surfaces (NOT under carvings)")
|
||||
SURFACE_ONLY,
|
||||
|
||||
@Desc("Only place this object under carvings (NOT on the surface)")
|
||||
CARVING_ONLY,
|
||||
|
||||
@Desc("This object can place anywhere")
|
||||
ANYWHERE;
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
public boolean supportsCarving() {
|
||||
return this.equals(ANYWHERE) || this.equals(CARVING_ONLY);
|
||||
}
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
public boolean supportsSurface() {
|
||||
return this.equals(ANYWHERE) || this.equals(SURFACE_ONLY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package art.arcane.iris.builtin.carve;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Defines which carved-space anchor to target for cave object placement.")
|
||||
public enum CaveAnchorMode {
|
||||
@Desc("Use the active cave profile default anchor mode.")
|
||||
PROFILE_DEFAULT,
|
||||
|
||||
@Desc("Target cave floor anchors where carved space has solid support below.")
|
||||
FLOOR,
|
||||
|
||||
@Desc("Target cave ceiling anchors where carved space has solid support above.")
|
||||
CEILING,
|
||||
|
||||
@Desc("Target carved positions with no immediate solid support above or below.")
|
||||
CENTER,
|
||||
|
||||
@Desc("Target any carved-space anchor.")
|
||||
ANY
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.builtin.carve;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Range;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
|
||||
/** One more layer of noise a cave profile blends into its density, an entry of the profile's {@code modules}. */
|
||||
@Desc("Represents a modular cave-density layer.")
|
||||
public final class CaveFieldModule {
|
||||
@Desc("Density style used by this module.")
|
||||
private NoiseStyle style = NoiseStyle.of("CELLULAR_IRIS_DOUBLE");
|
||||
@MinNumber(0)
|
||||
@Desc("Layer contribution multiplier.")
|
||||
private double weight = 1;
|
||||
@MinNumber(-1)
|
||||
@MaxNumber(1)
|
||||
@Desc("Threshold offset applied to this layer before blending.")
|
||||
private double threshold = 0;
|
||||
@Desc("Vertical bounds where this module can contribute, in engine-local Y where 0 is the bottom of the dimension, not world Y.")
|
||||
private Range verticalRange = Range.of(0, 384);
|
||||
@Desc("Invert this module before weighting.")
|
||||
private boolean invert = false;
|
||||
|
||||
public CaveFieldModule() {
|
||||
}
|
||||
|
||||
public NoiseStyle style() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public double weight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public double threshold() {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
public Range verticalRange() {
|
||||
return verticalRange;
|
||||
}
|
||||
|
||||
public boolean invert() {
|
||||
return invert;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.builtin.carve;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
/** A dimension's {@code caveLavaHeight}, written as the bare number. */
|
||||
@Desc("The subterranean fluid (cave lava) layer height, in engine-local Y where 0 is the bottom of the dimension, not world Y. With the default -64..320 height, 8 means world Y -56.")
|
||||
@Feature(id = "iris:carve/lava-height", name = "Cave lava height", key = "caveLavaHeight", root = "height", targets = Level.DIMENSION)
|
||||
public final class CaveLavaHeightSettings implements IrisFeature {
|
||||
public static final int DEFAULT_HEIGHT = 8;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(318)
|
||||
@Desc("The subterranean fluid (cave lava) layer height, in engine-local Y where 0 is the bottom of the dimension, not world Y. With the default -64..320 height, 8 means world Y -56.")
|
||||
private int height = DEFAULT_HEIGHT;
|
||||
|
||||
public CaveLavaHeightSettings() {
|
||||
}
|
||||
|
||||
public CaveLavaHeightSettings(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int height() {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.builtin.decorant;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The decorators one biome declares, written as {@code "decorators": [...]}, the list of decorators. IrisApi types only, like
|
||||
* {@link Decorator}.
|
||||
*/
|
||||
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
||||
@Feature(id = "iris:decorant", name = "Decorators", key = "decorators", root = "decorators", targets = Level.BIOME)
|
||||
public final class DecorantSettings implements IrisFeature {
|
||||
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
||||
private List<Decorator> decorators = List.of();
|
||||
|
||||
public DecorantSettings() {
|
||||
}
|
||||
|
||||
public DecorantSettings(List<Decorator> decorators) {
|
||||
this.decorators = List.copyOf(decorators);
|
||||
}
|
||||
|
||||
public List<Decorator> decorators() {
|
||||
return decorators == null ? List.of() : Collections.unmodifiableList(decorators);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.builtin.decorant;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Represents a location where decorations should go")
|
||||
public enum DecorationPart {
|
||||
@Desc("The default, decorate anywhere")
|
||||
NONE,
|
||||
|
||||
@Desc("Targets shore lines (typically for sugar cane)")
|
||||
SHORE_LINE,
|
||||
|
||||
@Desc("Target sea surfaces (typically for lilypads)")
|
||||
SEA_SURFACE,
|
||||
|
||||
@Desc("Targets the sea floor (entire placement must be bellow sea level)")
|
||||
SEA_FLOOR,
|
||||
|
||||
@Desc("Decorates on cave & carving ceilings or underside of overhangs")
|
||||
CEILING,
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* 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.builtin.decorant;
|
||||
|
||||
import art.arcane.iris.builtin.prepare.SlopeClip;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* One decorator of a biome, as packs write it in the {@code "decorators"} list or under
|
||||
* {@code snippet/iris/decorant/decorator/}: which blocks it places, where, how often and how tall. A value of IrisApi types only; the
|
||||
* decorant module resolves the blocks and builds the noise.
|
||||
*/
|
||||
@Snippet("iris/decorant/decorator")
|
||||
@Desc("A biome decorator is used for placing flowers, grass, cacti and so on")
|
||||
public final class Decorator {
|
||||
private static final String STATIC_NOISE = "STATIC";
|
||||
private static final String DEFAULT_BLOCK = "grass";
|
||||
|
||||
@Desc("The varience dispersion is used when multiple blocks are put in the palette. Scatter scrambles them, Wispy shows streak-looking varience")
|
||||
private NoiseStyle variance = NoiseStyle.of(STATIC_NOISE);
|
||||
|
||||
@Desc("Forcefully place this decorant anywhere it is supposed to go even if it should not go on a specific surface block. For example, you could force tallgrass to place on top of stone by using this.")
|
||||
private boolean forcePlace = false;
|
||||
|
||||
@Desc("Forced the surface block of this decorant to be the specified block. Assumes forcePlace.")
|
||||
private BlockSpec forceBlock;
|
||||
|
||||
@Desc("When set, the decorator can only place onto any of these blocks.")
|
||||
private List<BlockSpec> whitelist;
|
||||
|
||||
@Desc("When set, the decorator will never place onto any of these blocks.")
|
||||
private List<BlockSpec> blacklist;
|
||||
|
||||
@Desc("The slope at which this decorator can be placed. Range from 0 to 10 by default. Calculated from a 3-block radius from the center of the decorator placement.")
|
||||
private SlopeClip slopeCondition = new SlopeClip();
|
||||
|
||||
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
|
||||
private int absoluteMaxStack = 30;
|
||||
|
||||
@Desc("Dispersion is used to pick places to spawn. Scatter randomly places them (vanilla) or Wispy for a streak like patch system.")
|
||||
private NoiseStyle style = NoiseStyle.of(STATIC_NOISE);
|
||||
|
||||
@Desc("If this decorator has a height more than 1 this changes how it picks the height between your maxes. Scatter = random, Wispy = wavy heights")
|
||||
private NoiseStyle heightVariance = NoiseStyle.of(STATIC_NOISE);
|
||||
|
||||
@Desc("Tells iris where this decoration is a part of. I.e. SHORE_LINE or SEA_SURFACE")
|
||||
private DecorationPart partOf = DecorationPart.NONE;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(2032)
|
||||
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
|
||||
private int stackMin = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(2032)
|
||||
@Desc("The maximum repeat stack height")
|
||||
private int stackMax = 1;
|
||||
|
||||
@Desc("""
|
||||
Changes stackMin and stackMin from being absolute block heights and instead uses them as a percentage to scale the stack based on the cave height
|
||||
|
||||
Within a cave, setting them stackMin/max to 50 would make the stack 50% of the cave height""")
|
||||
private boolean scaleStack = false;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("The chance for this decorator to decorate at a given X,Y coordinate. This is hit 256 times per chunk (per surface block)")
|
||||
private double chance = 0.1;
|
||||
|
||||
@Required
|
||||
@MinItems(1)
|
||||
@Desc("The palette of blocks to pick from when this decorator needs to place.")
|
||||
private List<BlockSpec> palette = List.of(BlockSpec.of(DEFAULT_BLOCK));
|
||||
|
||||
@Desc("The palette of blocks used at the very top of a 'stackMax' of higher than 1. For example, bamboo tops.")
|
||||
private List<BlockSpec> topPalette = List.of();
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.0)
|
||||
@Desc("When the stack passes the top threshold, the top palette will start being used instead of the normal palette.")
|
||||
private double topThreshold = 1.0;
|
||||
|
||||
/** A decorator with every option at its default, as packs get it from {@code {}}. */
|
||||
public Decorator() {
|
||||
}
|
||||
|
||||
public NoiseStyle variance() {
|
||||
return variance == null ? NoiseStyle.of(STATIC_NOISE) : variance;
|
||||
}
|
||||
|
||||
public boolean forcePlace() {
|
||||
return forcePlace;
|
||||
}
|
||||
|
||||
public Optional<BlockSpec> forceBlock() {
|
||||
return Optional.ofNullable(forceBlock);
|
||||
}
|
||||
|
||||
/** The blocks it may only be placed onto; empty when unset, which {@link #hasWhitelist()} tells apart from an explicitly empty list that blocks all placement. */
|
||||
public List<BlockSpec> whitelist() {
|
||||
return listOrEmpty(whitelist);
|
||||
}
|
||||
|
||||
public boolean hasWhitelist() {
|
||||
return whitelist != null;
|
||||
}
|
||||
|
||||
public List<BlockSpec> blacklist() {
|
||||
return listOrEmpty(blacklist);
|
||||
}
|
||||
|
||||
public boolean hasBlacklist() {
|
||||
return blacklist != null;
|
||||
}
|
||||
|
||||
public SlopeClip slopeCondition() {
|
||||
return slopeCondition == null ? new SlopeClip() : slopeCondition;
|
||||
}
|
||||
|
||||
public int absoluteMaxStack() {
|
||||
return absoluteMaxStack;
|
||||
}
|
||||
|
||||
public NoiseStyle style() {
|
||||
return style == null ? NoiseStyle.of(STATIC_NOISE) : style;
|
||||
}
|
||||
|
||||
public NoiseStyle heightVariance() {
|
||||
return heightVariance == null ? NoiseStyle.of(STATIC_NOISE) : heightVariance;
|
||||
}
|
||||
|
||||
public DecorationPart partOf() {
|
||||
return partOf == null ? DecorationPart.NONE : partOf;
|
||||
}
|
||||
|
||||
public int stackMin() {
|
||||
return stackMin;
|
||||
}
|
||||
|
||||
public int stackMax() {
|
||||
return stackMax;
|
||||
}
|
||||
|
||||
public boolean scaleStack() {
|
||||
return scaleStack;
|
||||
}
|
||||
|
||||
public double chance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
public List<BlockSpec> palette() {
|
||||
return listOrEmpty(palette);
|
||||
}
|
||||
|
||||
public List<BlockSpec> topPalette() {
|
||||
return listOrEmpty(topPalette);
|
||||
}
|
||||
|
||||
public double topThreshold() {
|
||||
return topThreshold;
|
||||
}
|
||||
|
||||
/** Whether it places more than one block per column. */
|
||||
public boolean isStacking() {
|
||||
return stackMax > 1;
|
||||
}
|
||||
|
||||
private static <T> List<T> listOrEmpty(List<T> list) {
|
||||
return list == null ? List.of() : Collections.unmodifiableList(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("iris/loot/attribute-modifier")
|
||||
@Desc("Represents an attribute modifier for an item or an entity. This allows you to create modifications to basic game attributes such as MAX_HEALTH or ARMOR_VALUE.")
|
||||
public final class ItemAttributeModifier {
|
||||
@Required
|
||||
@Desc("The Attribute type key such as max_health or minecraft:armor. This type is pulled from the game attributes. Zombie & Horse attributes will not work on non-zombie/horse entities.\nUsing an attribute on an item will have affects when held, or worn. There is no way to specify further granularity as the game picks this depending on the item type.")
|
||||
private String attribute = null;
|
||||
|
||||
@Required
|
||||
@Desc("The Attribute Name is used internally only for the game. This value should be unique to all other attributes applied to this item/entity. It is not shown in game.")
|
||||
private String name = "";
|
||||
|
||||
@Desc("The application operation: ADD_NUMBER (default), ADD_SCALAR or MULTIPLY_SCALAR_1. Add Number adds to the default value. \nAdd scalar_1 will multiply by 1 for example if the health is 20 and you multiply_scalar_1 by 0.5, the health will result in 30, not 10. Use negative values to achieve that.")
|
||||
private String operation = "ADD_NUMBER";
|
||||
|
||||
@Desc("Minimum amount for this modifier. Iris randomly chooses an amount, this is the minimum it can choose randomly for this attribute.")
|
||||
private double minAmount = 1;
|
||||
|
||||
@Desc("Maximum amount for this modifier Iris randomly chooses an amount, this is the maximum it can choose randomly for this attribute.")
|
||||
private double maxAmount = 1;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("The chance that this attribute is applied (0 to 1). If the chance is 0.5 (50%), then Iris will only apply this attribute 50% of the time.")
|
||||
private double chance = 1;
|
||||
|
||||
public ItemAttributeModifier() {
|
||||
}
|
||||
|
||||
public String attribute() {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String operation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public double minAmount() {
|
||||
return minAmount;
|
||||
}
|
||||
|
||||
public double maxAmount() {
|
||||
return maxAmount;
|
||||
}
|
||||
|
||||
public double chance() {
|
||||
return chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("iris/loot/enchantment")
|
||||
@Desc("Represents an enchantment & level")
|
||||
public final class LootEnchantment {
|
||||
@Required
|
||||
@Ref(Reference.ENCHANTMENT)
|
||||
@Desc("The enchantment")
|
||||
private String enchantment;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("Minimum amount of this loot")
|
||||
private int minLevel = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("Maximum amount of this loot")
|
||||
private int maxLevel = 1;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("The chance that this enchantment is applied (0 to 1)")
|
||||
private double chance = 1;
|
||||
|
||||
public LootEnchantment() {
|
||||
}
|
||||
|
||||
public String enchantment() {
|
||||
return enchantment;
|
||||
}
|
||||
|
||||
public int minLevel() {
|
||||
return minLevel;
|
||||
}
|
||||
|
||||
public int maxLevel() {
|
||||
return maxLevel;
|
||||
}
|
||||
|
||||
public double chance() {
|
||||
return chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Snippet("iris/loot/loot")
|
||||
@Desc("Represents a loot entry")
|
||||
public final class LootEntry {
|
||||
public static final int MAX_AMOUNT = 64;
|
||||
|
||||
@Desc("The target inventory slot types to fill this loot with. World generation only ever fills STORAGE; the other values are inert during worldgen.")
|
||||
private LootSlot slotTypes = LootSlot.STORAGE;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The sub rarity of this loot. Calculated after this loot table has been picked.")
|
||||
private int rarity = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(MAX_AMOUNT)
|
||||
@Desc("Minimum amount of this loot, from 1 to 64")
|
||||
private int minAmount = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(MAX_AMOUNT)
|
||||
@Desc("Maximum amount of this loot, from 1 to 64")
|
||||
private int maxAmount = 1;
|
||||
|
||||
@Desc("The display name of this item")
|
||||
private String displayName = null;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Minimum durability percent")
|
||||
private double minDurability = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Maximum durability percent")
|
||||
private double maxDurability = 1;
|
||||
|
||||
@Desc("Define a custom model identifier 1.14+ only")
|
||||
private Integer customModel = null;
|
||||
|
||||
@Desc("Set this to true to prevent it from being broken")
|
||||
private boolean unbreakable = false;
|
||||
|
||||
@Desc("The item flags to add")
|
||||
private List<String> itemFlags = List.of();
|
||||
|
||||
@Desc("Apply enchantments to this item")
|
||||
private List<LootEnchantment> enchantments = List.of();
|
||||
|
||||
@Desc("Apply attribute modifiers to this item")
|
||||
private List<ItemAttributeModifier> attributes = List.of();
|
||||
|
||||
@Desc("Add lore to this item")
|
||||
private List<String> lore = List.of();
|
||||
|
||||
@Ref(Reference.ITEM)
|
||||
@Required
|
||||
@Desc("This is the item or block type. Does not accept minecraft:*, only materials such as DIAMOND_SWORD or DIRT. The exception are modded materials, as they require a namespace.")
|
||||
private String type = "";
|
||||
|
||||
@Desc("The dye color")
|
||||
private String dyeColor = null;
|
||||
|
||||
@Desc("The leather armor color")
|
||||
private String leatherColor = null;
|
||||
|
||||
@Desc("Defines a custom NBT Tag for the item.")
|
||||
private Map<String, Object> customNbt;
|
||||
|
||||
public LootEntry() {
|
||||
}
|
||||
|
||||
public LootSlot slotTypes() {
|
||||
return slotTypes == null ? LootSlot.STORAGE : slotTypes;
|
||||
}
|
||||
|
||||
public int rarity() {
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public int minAmount() {
|
||||
return minAmount;
|
||||
}
|
||||
|
||||
public int maxAmount() {
|
||||
return maxAmount;
|
||||
}
|
||||
|
||||
public String displayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public double minDurability() {
|
||||
return minDurability;
|
||||
}
|
||||
|
||||
public double maxDurability() {
|
||||
return maxDurability;
|
||||
}
|
||||
|
||||
public Integer customModel() {
|
||||
return customModel;
|
||||
}
|
||||
|
||||
public boolean unbreakable() {
|
||||
return unbreakable;
|
||||
}
|
||||
|
||||
public List<String> itemFlags() {
|
||||
return listOrEmpty(itemFlags);
|
||||
}
|
||||
|
||||
public List<LootEnchantment> enchantments() {
|
||||
return listOrEmpty(enchantments);
|
||||
}
|
||||
|
||||
public List<ItemAttributeModifier> attributes() {
|
||||
return listOrEmpty(attributes);
|
||||
}
|
||||
|
||||
public List<String> lore() {
|
||||
return listOrEmpty(lore);
|
||||
}
|
||||
|
||||
/** The authored item key, exactly as written in the pack. Each platform resolves it against its own item registry. */
|
||||
public String type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String dyeColor() {
|
||||
return dyeColor;
|
||||
}
|
||||
|
||||
public String leatherColor() {
|
||||
return leatherColor;
|
||||
}
|
||||
|
||||
/** The custom data of the item; empty when unset. */
|
||||
public Map<String, Object> customNbt() {
|
||||
return customNbt == null ? Map.of() : Collections.unmodifiableMap(customNbt);
|
||||
}
|
||||
|
||||
private static <T> List<T> listOrEmpty(List<T> list) {
|
||||
return list == null ? List.of() : Collections.unmodifiableList(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("A loot mode is used to describe what to do with the existing loot layers before adding this loot. ADD appends to the building list of tables (dimension tables, then region tables, then biome tables). REPLACE swaps the parent tables for this reference's tables. CLEAR suppresses loot entirely at this point.")
|
||||
public enum LootMode {
|
||||
@Desc("Add to the existing parent loot tables")
|
||||
ADD,
|
||||
@Desc("Clear all parent loot tables and contribute nothing at this level. Any tables listed here are ignored.")
|
||||
CLEAR,
|
||||
@Desc("Replace all parent loot tables with this reference's tables")
|
||||
REPLACE,
|
||||
@Desc("Only use when there was no loot table defined by an object")
|
||||
FALLBACK
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit 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.builtin.loot;
|
||||
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
/**
|
||||
* The random streams loot is drawn from and the picks made on them, shared by the loot module and the hosts that fill
|
||||
* containers, so a container always holds the same loot. Changing a seed, a salt or a draw changes the loot of existing worlds.
|
||||
*/
|
||||
public final class LootResolver {
|
||||
private static final int MAX_SCALED_SOURCE_COUNT = 256;
|
||||
private static final long CONTAINER_SALT = 0x632BE59BD9B4E019L;
|
||||
private static final long TABLE_SALT = 0x94D049BB133111EBL;
|
||||
private static final long ENTRY_SALT = 0x9E3779B97F4A7C15L;
|
||||
|
||||
private LootResolver() {
|
||||
}
|
||||
|
||||
public static RNG containerRng(long lootSeed, int x, int y, int z) {
|
||||
return new RNG(containerSeed(lootSeed, x, y, z));
|
||||
}
|
||||
|
||||
public static long containerSeed(long lootSeed, int x, int y, int z) {
|
||||
long seed = mix(lootSeed ^ CONTAINER_SALT);
|
||||
seed = mix(seed ^ ((long) x * 0xD6E8FEB86659FD93L));
|
||||
seed = mix(seed ^ ((long) y * 0xA5A3564E27F886A7L));
|
||||
return mix(seed ^ ((long) z * 0x8CB92BA72F3D8DD7L));
|
||||
}
|
||||
|
||||
/** The random stream of one loot table at one position; {@code tableIdentity} names the table (its key, else its name). */
|
||||
public static RNG tableRng(long lootSeed, String tableIdentity, int x, int y, int z) {
|
||||
return new RNG(tableSeed(lootSeed, tableIdentity, x, y, z));
|
||||
}
|
||||
|
||||
public static long tableSeed(long lootSeed, String tableIdentity, int x, int y, int z) {
|
||||
return mix(containerSeed(lootSeed, x, y, z) ^ stableHash(tableIdentity) ^ TABLE_SALT);
|
||||
}
|
||||
|
||||
public static boolean spatialOneIn(
|
||||
long lootSeed,
|
||||
String tableIdentity,
|
||||
int entryIndex,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
long rarity
|
||||
) {
|
||||
if (rarity <= 1L) {
|
||||
return true;
|
||||
}
|
||||
long roll = mix(tableSeed(lootSeed, tableIdentity, x, y, z) ^ ((long) entryIndex * ENTRY_SALT));
|
||||
return new RNG(roll).nextLong(rarity) == 0L;
|
||||
}
|
||||
|
||||
public static long combinedRarity(int tableRarity, int entryRarity) {
|
||||
long table = Math.max(1, tableRarity);
|
||||
long entry = Math.max(1, entryRarity);
|
||||
if (table > Long.MAX_VALUE / entry) {
|
||||
return Long.MAX_VALUE;
|
||||
}
|
||||
return table * entry;
|
||||
}
|
||||
|
||||
public static boolean oneIn(RNG rng, int rarity) {
|
||||
int bound = Math.max(1, rarity);
|
||||
return bound == 1 || rng.nextInt(bound) == 0;
|
||||
}
|
||||
|
||||
public static int inclusive(RNG rng, int first, int second) {
|
||||
int lower = Math.min(first, second);
|
||||
int upper = Math.max(first, second);
|
||||
if (lower == upper) {
|
||||
return lower;
|
||||
}
|
||||
long span = (long) upper - lower + 1L;
|
||||
return (int) (lower + rng.nextLong(span));
|
||||
}
|
||||
|
||||
public static <T> T pickWeighted(List<T> choices, ToIntFunction<T> weight, RNG rng) {
|
||||
long total = 0L;
|
||||
for (T choice : choices) {
|
||||
int value = Math.max(0, weight.applyAsInt(choice));
|
||||
total = Long.MAX_VALUE - total < value ? Long.MAX_VALUE : total + value;
|
||||
}
|
||||
if (total <= 0L) {
|
||||
return null;
|
||||
}
|
||||
long pull = rng.nextLong(total);
|
||||
for (T choice : choices) {
|
||||
pull -= Math.max(0, weight.applyAsInt(choice));
|
||||
if (pull < 0L) {
|
||||
return choice;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> void scaleSources(List<T> sources, double multiplier, RNG rng) {
|
||||
if (!Double.isFinite(multiplier) || multiplier < 0D) {
|
||||
throw new IllegalArgumentException("Effective loot source multiplier must be finite and non-negative, got "
|
||||
+ multiplier + ".");
|
||||
}
|
||||
if (sources.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (sources.size() > MAX_SCALED_SOURCE_COUNT) {
|
||||
throw new IllegalArgumentException("Loot source scaling starts above the maximum of "
|
||||
+ MAX_SCALED_SOURCE_COUNT + " sources: " + sources.size() + ".");
|
||||
}
|
||||
double scaledSize = sources.size() * multiplier;
|
||||
if (!Double.isFinite(scaledSize) || scaledSize > MAX_SCALED_SOURCE_COUNT) {
|
||||
throw new IllegalArgumentException("Loot source scaling exceeds the maximum of "
|
||||
+ MAX_SCALED_SOURCE_COUNT + " sources: " + sources.size() + " * " + multiplier + ".");
|
||||
}
|
||||
int target = (int) Math.round(scaledSize);
|
||||
if (target == sources.size()) {
|
||||
return;
|
||||
}
|
||||
List<T> original = new ArrayList<>(sources);
|
||||
int[] order = new int[original.size()];
|
||||
if (target < original.size()) {
|
||||
shrinkSources(sources, original, order, target, rng);
|
||||
return;
|
||||
}
|
||||
expandSources(sources, original, order, target, rng);
|
||||
}
|
||||
|
||||
private static <T> void shrinkSources(List<T> sources, List<T> original, int[] order, int target, RNG rng) {
|
||||
shuffleOrder(order, rng);
|
||||
boolean[] selected = new boolean[original.size()];
|
||||
for (int index = 0; index < target; index++) {
|
||||
selected[order[index]] = true;
|
||||
}
|
||||
sources.clear();
|
||||
for (int index = 0; index < original.size(); index++) {
|
||||
if (selected[index]) {
|
||||
sources.add(original.get(index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> void expandSources(List<T> sources, List<T> original, int[] order, int target, RNG rng) {
|
||||
while (sources.size() < target) {
|
||||
shuffleOrder(order, rng);
|
||||
int additions = Math.min(target - sources.size(), original.size());
|
||||
for (int index = 0; index < additions; index++) {
|
||||
sources.add(original.get(order[index]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void shuffleOrder(int[] order, RNG rng) {
|
||||
for (int index = 0; index < order.length; index++) {
|
||||
order[index] = index;
|
||||
}
|
||||
for (int index = 0; index < order.length - 1; index++) {
|
||||
int selected = index + rng.nextInt(order.length - index);
|
||||
int previous = order[index];
|
||||
order[index] = order[selected];
|
||||
order[selected] = previous;
|
||||
}
|
||||
}
|
||||
|
||||
private static long stableHash(String value) {
|
||||
long hash = 0xCBF29CE484222325L;
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
hash ^= value.charAt(i);
|
||||
hash *= 0x100000001B3L;
|
||||
}
|
||||
return mix(hash);
|
||||
}
|
||||
|
||||
private static long mix(long value) {
|
||||
long mixed = value;
|
||||
mixed = (mixed ^ (mixed >>> 30)) * 0xBF58476D1CE4E5B9L;
|
||||
mixed = (mixed ^ (mixed >>> 27)) * 0x94D049BB133111EBL;
|
||||
return mixed ^ (mixed >>> 31);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The loot tables one dimension, region or biome adds to the containers it covers, written as
|
||||
* {@code "loot": {"mode": "ADD", "tables": [...], "multiplier": 1}}. Levels stack, dimension first, then region and
|
||||
* biome; {@link LootMode} says what each does with the tables before it. An entity's {@code loot} has the same shape.
|
||||
*/
|
||||
@Snippet("iris/loot/loot-registry")
|
||||
@Desc("Reference loot tables in this area")
|
||||
@Feature(id = "iris:loot", name = "Loot", key = "loot", targets = {Level.DIMENSION, Level.REGION, Level.BIOME})
|
||||
public final class LootSettings implements IrisFeature {
|
||||
public static final double MAX_MULTIPLIER = 16D;
|
||||
|
||||
@Desc("ADD = add on top of parent tables. REPLACE = clear parent tables, then add these. CLEAR = clear parent tables and add nothing, even if tables are listed. FALLBACK = only used when nothing else defined a table.")
|
||||
private LootMode mode = LootMode.ADD;
|
||||
|
||||
@ResourceRef(LootTable.class)
|
||||
@Desc("Add loot table registries here")
|
||||
private List<String> tables = List.of();
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(MAX_MULTIPLIER)
|
||||
@Desc("Scale loot sources in this area from 0 to 16 times their normal count")
|
||||
private double multiplier = 1D;
|
||||
|
||||
/** Nothing added, nothing scaled: what a level without loot settings means. */
|
||||
public LootSettings() {
|
||||
}
|
||||
|
||||
public LootMode mode() {
|
||||
return mode == null ? LootMode.ADD : mode;
|
||||
}
|
||||
|
||||
/** The keys of the loot tables, in order. */
|
||||
public List<String> tables() {
|
||||
return tables == null ? List.of() : Collections.unmodifiableList(tables);
|
||||
}
|
||||
|
||||
public double multiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("An inventory slot type is used to represent a type of slot for items to fit into in any given inventory.")
|
||||
public enum LootSlot {
|
||||
@Desc("Typically the one you want to go with. Storage represnents most slots in inventories.")
|
||||
STORAGE,
|
||||
|
||||
@Desc("Used for the fuel slot in Furnaces, Blast furnaces, smokers etc.")
|
||||
FUEL,
|
||||
|
||||
@Desc("Used for the cook slot in furnaces")
|
||||
FURNACE,
|
||||
@Desc("Used for the cook slot in blast furnaces")
|
||||
BLAST_FURNACE,
|
||||
|
||||
@Desc("Used for the cook slot in smokers")
|
||||
SMOKER,
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** A loot table of the pack, one file of {@code loot/}. */
|
||||
@Desc("Represents a loot table. Biomes, Regions & Objects can add or replace the virtual table with these loot tables")
|
||||
public final class LootTable {
|
||||
public static final int MAX_PICKED = 64;
|
||||
public static final int MAX_TRIES = 256;
|
||||
|
||||
@Required
|
||||
@Desc("The name of this loot table")
|
||||
private String name = "";
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The rarity as in 1 in X chance")
|
||||
private int rarity = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(MAX_PICKED)
|
||||
@Desc("The maximum amount of loot that can be picked in this table at a time, from 1 to 64")
|
||||
private int maxPicked = 5;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(MAX_PICKED)
|
||||
@Desc("The minimum amount of loot that can be picked in this table at a time, from 0 to 64")
|
||||
private int minPicked = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(MAX_TRIES)
|
||||
@Desc("The maximum amount of tries to generate loot, from 1 to 256")
|
||||
private int maxTries = 10;
|
||||
|
||||
@Desc("The loot in this table")
|
||||
private List<LootEntry> loot = List.of();
|
||||
|
||||
public LootTable() {
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name == null ? "" : name;
|
||||
}
|
||||
|
||||
public int rarity() {
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public int maxPicked() {
|
||||
return maxPicked;
|
||||
}
|
||||
|
||||
public int minPicked() {
|
||||
return minPicked;
|
||||
}
|
||||
|
||||
public int maxTries() {
|
||||
return maxTries;
|
||||
}
|
||||
|
||||
public List<LootEntry> loot() {
|
||||
return loot == null ? List.of() : Collections.unmodifiableList(loot);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("iris/loot/object-loot")
|
||||
@Desc("Represents loot within this object")
|
||||
public final class ObjectLoot implements ObjectLootEntry {
|
||||
@Desc("The list of blocks this loot table should apply to")
|
||||
private List<BlockSpec> filter = List.of();
|
||||
@Desc("Exactly match the block data or not")
|
||||
private boolean exact = false;
|
||||
@Desc("The loot table name")
|
||||
@Required
|
||||
@ResourceRef(LootTable.class)
|
||||
private String name;
|
||||
@Desc("The weight of this loot table being chosen")
|
||||
@MinNumber(1)
|
||||
private int weight = 1;
|
||||
|
||||
public ObjectLoot() {
|
||||
}
|
||||
|
||||
/** A table for every container of the placement. */
|
||||
public ObjectLoot(String name, int weight) {
|
||||
this.name = name;
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int weight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exact() {
|
||||
return exact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockSpec> filter() {
|
||||
return filter == null ? List.of() : Collections.unmodifiableList(filter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One loot table an object placement gives its containers: which table, how often it is picked among the placement's
|
||||
* tables, and which of the object's containers it is for.
|
||||
*/
|
||||
public interface ObjectLootEntry {
|
||||
/** The table: a key of the pack's loot tables, or a key of the platform's. */
|
||||
String name();
|
||||
|
||||
/** How often the table is picked among equals; a table with no weight is never picked. */
|
||||
int weight();
|
||||
|
||||
/** Whether the table applies to the exact state of the blocks in {@link #filter}, not to every state of their kind of block. */
|
||||
boolean exact();
|
||||
|
||||
/** The blocks the table is for; none means every container the placement holds. */
|
||||
List<BlockSpec> filter();
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.builtin.loot;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("iris/loot/object-vanilla-loot")
|
||||
@Desc("Represents vanilla loot within this object")
|
||||
public final class ObjectVanillaLoot implements ObjectLootEntry {
|
||||
@Desc("The list of blocks this loot table should apply to")
|
||||
private List<BlockSpec> filter = List.of();
|
||||
@Desc("Exactly match the block data or not")
|
||||
private boolean exact = false;
|
||||
@Desc("The vanilla loot table key")
|
||||
@Required
|
||||
@Ref(Reference.LOOT_TABLE)
|
||||
private String name;
|
||||
@Desc("The weight of this loot table being chosen")
|
||||
@MinNumber(1)
|
||||
private int weight = 1;
|
||||
|
||||
public ObjectVanillaLoot() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int weight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exact() {
|
||||
return exact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockSpec> filter() {
|
||||
return filter == null ? List.of() : Collections.unmodifiableList(filter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** The virtual heightmap an object placement may sit on instead of the terrain, written as the placement's {@code heightmap}. */
|
||||
@Snippet("iris/objects/generator")
|
||||
@Desc("A noise generator")
|
||||
public final class HeightmapNoise {
|
||||
@MinNumber(0.0001)
|
||||
@Desc("The coordinate input zoom")
|
||||
private double zoom = 1;
|
||||
@Desc("Reverse the output. So that noise = -noise + opacity")
|
||||
private boolean negative = false;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("The output multiplier")
|
||||
private double opacity = 1;
|
||||
@Desc("Coordinate offset x")
|
||||
private double offsetX = 0;
|
||||
@Desc("Height output offset y. Avoid using with terrain generation.")
|
||||
private double offsetY = 0;
|
||||
@Desc("Coordinate offset z")
|
||||
private double offsetZ = 0;
|
||||
@Required
|
||||
@Desc("The seed")
|
||||
private long seed = 0;
|
||||
@Desc("Apply a parametric curve on the output")
|
||||
private boolean parametric = false;
|
||||
@Desc("Apply a bezier curve on the output")
|
||||
private boolean bezier = false;
|
||||
@Desc("Apply a sin-center curve on the output (0, and 1 = 0 and 0.5 = 1.0 using a sinoid shape.)")
|
||||
private boolean sinCentered = false;
|
||||
@Desc("The exponent noise^EXPONENT")
|
||||
private double exponent = 1;
|
||||
@Desc("Enable / disable. Outputs offsetY if disabled")
|
||||
private boolean enabled = true;
|
||||
@Required
|
||||
@Desc("The Noise Style")
|
||||
private NoiseStyle style = NoiseStyle.of("IRIS");
|
||||
@MinNumber(1)
|
||||
@Desc("Multiple octaves for multple generators of changing zooms added together")
|
||||
private int octaves = 1;
|
||||
@Desc("Apply a child noise generator to fracture the input coordinates of this generator")
|
||||
private List<HeightmapNoise> fracture = List.of();
|
||||
|
||||
public HeightmapNoise() {
|
||||
}
|
||||
|
||||
public double zoom() {
|
||||
return zoom;
|
||||
}
|
||||
|
||||
public boolean negative() {
|
||||
return negative;
|
||||
}
|
||||
|
||||
public double opacity() {
|
||||
return opacity;
|
||||
}
|
||||
|
||||
public double offsetX() {
|
||||
return offsetX;
|
||||
}
|
||||
|
||||
public double offsetY() {
|
||||
return offsetY;
|
||||
}
|
||||
|
||||
public double offsetZ() {
|
||||
return offsetZ;
|
||||
}
|
||||
|
||||
public long seed() {
|
||||
return seed;
|
||||
}
|
||||
|
||||
public boolean parametric() {
|
||||
return parametric;
|
||||
}
|
||||
|
||||
public boolean bezier() {
|
||||
return bezier;
|
||||
}
|
||||
|
||||
public boolean sinCentered() {
|
||||
return sinCentered;
|
||||
}
|
||||
|
||||
public double exponent() {
|
||||
return exponent;
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public NoiseStyle style() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public int octaves() {
|
||||
return octaves;
|
||||
}
|
||||
|
||||
public List<HeightmapNoise> fracture() {
|
||||
return fracture == null ? List.of() : Collections.unmodifiableList(fracture);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,717 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
|
||||
import art.arcane.iris.builtin.blocks.ObjectReplace;
|
||||
import art.arcane.iris.builtin.carve.CarvingMode;
|
||||
import art.arcane.iris.builtin.carve.CaveAnchorMode;
|
||||
import art.arcane.iris.builtin.loot.ObjectLoot;
|
||||
import art.arcane.iris.builtin.loot.ObjectVanillaLoot;
|
||||
import art.arcane.iris.builtin.prepare.ObjectRotation;
|
||||
import art.arcane.iris.builtin.prepare.ObjectTranslate;
|
||||
import art.arcane.iris.builtin.prepare.SlopeClip;
|
||||
import art.arcane.iris.builtin.spawn.PlacementMarker;
|
||||
import art.arcane.iris.builtin.stilt.StiltSettings;
|
||||
import art.arcane.iris.builtin.vacuum.VacuumSettings;
|
||||
import art.arcane.iris.builtin.validate.ObjectLimit;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.TypeAdapterFactory;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
import com.volmit.noise.StyledRange;
|
||||
import com.volmit.object.GeneratedObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* One object placement of a biome or region, an entry of its {@code objects}: which objects, how often, and how they sit
|
||||
* in the world. {@code iris:objects} decides from the options it owns (what to place, chance, density, carving and
|
||||
* surface support); Iris's placement stages read the rest from the placement itself, so this keeps the JSON the placement
|
||||
* was written as ({@link #json()}) for Iris to read it again the way it reads placements everywhere else.
|
||||
*/
|
||||
@Snippet("iris/objects/object-placer")
|
||||
@Desc("Represents an iris object placer. It places objects.")
|
||||
@JsonAdapter(ObjectPlacement.KeepingItsJson.class)
|
||||
public final class ObjectPlacement {
|
||||
private static final int DEFAULT_SURFACE_SUPPORT_BUFFER = 2;
|
||||
private static final int DEFAULT_SURFACE_SUPPORT_DEPTH = 2;
|
||||
|
||||
@Required
|
||||
@ResourceRef(GeneratedObject.class)
|
||||
@Desc("List of objects to place")
|
||||
private List<String> place = List.of();
|
||||
@Desc("Rotate this objects placement")
|
||||
private ObjectRotation rotation = new ObjectRotation();
|
||||
@Desc("Limit the max height or min height of placement.")
|
||||
private ObjectLimit clamp = new ObjectLimit();
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
|
||||
private double snow = 0;
|
||||
@Desc("Whether or not this object can be targeted by a dolphin.")
|
||||
private boolean isDolphinTarget = false;
|
||||
@Desc("The slope at which this object can be placed. Range from 0 to 10 by default. Calculated from a 3-block radius from the center of the object placement.")
|
||||
private SlopeClip slopeCondition = new SlopeClip();
|
||||
@Desc("Set to true to add the rotation of the direction of the slope of the terrain (wherever the slope is going down) to the y-axis rotation of the object." +
|
||||
"Rounded to 90 degrees. Adds the *min* rotation of the y axis as well (to still allow you to rotate objects nicely). Discards *max* and *interval* on *yaxis*")
|
||||
private boolean rotateTowardsSlope = false;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")
|
||||
private double chance = 1;
|
||||
@Desc("If set, chance is multiplied by this noise (0 to 1) at the chunk, so objects gather in some areas and thin out in others.")
|
||||
private NoiseStyle chanceStyle = null;
|
||||
@MinNumber(0)
|
||||
@Desc("Keeps objects of this placement at least this many blocks apart, also across chunks and biomes that place the same objects. Each chunk then places at most one. 0 turns it off. Surface placements only.")
|
||||
private int separation = 0;
|
||||
@MinNumber(1)
|
||||
@Desc("If the chance check passes, place this many in a single chunk. Ignored when separation is set.")
|
||||
private int density = 1;
|
||||
@Desc("If the chance check passes, and you specify this, it picks a number in the range based on noise, and 'density' is ignored.")
|
||||
private StyledRange densityStyle = null;
|
||||
@Desc("When stilting is enabled, this object will define various properties related to it.")
|
||||
private StiltSettings stiltSettings;
|
||||
@Desc("When a VACUUM place mode is used, this defines the deformation radius and falloff.")
|
||||
private VacuumSettings vacuumSettings;
|
||||
@MaxNumber(64)
|
||||
@MinNumber(0)
|
||||
@Desc("When bore is enabled, expand max-y of the cuboid it removes")
|
||||
private int boreExtendMaxY = 0;
|
||||
@Desc("Add markers to blocks in this object")
|
||||
private List<PlacementMarker> markers = List.of();
|
||||
@MaxNumber(64)
|
||||
@MinNumber(-1)
|
||||
@Desc("When bore is enabled, lower min-y of the cuboid it removes")
|
||||
private int boreExtendMinY = 0;
|
||||
@Desc("If set to true, objects will place on the terrain height, ignoring the water surface.")
|
||||
private boolean underwater = false;
|
||||
@Desc("If set to true, objects will place in carvings (such as underground) or under an overhang.")
|
||||
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(16)
|
||||
@Desc("Extra buffer, in blocks, around this object's base footprint that must also be solid, un-carved ground. 0 checks only the footprint itself.")
|
||||
private int surfaceSupportBuffer = DEFAULT_SURFACE_SUPPORT_BUFFER;
|
||||
@MinNumber(1)
|
||||
@MaxNumber(16)
|
||||
@Desc("Minimum thickness, in blocks, of un-carved ground required under every column of this object's base footprint.")
|
||||
private int surfaceSupportDepth = DEFAULT_SURFACE_SUPPORT_DEPTH;
|
||||
@Desc("Set to false to let this placement sit over carved surface openings such as cave entrances.")
|
||||
private boolean requireSurfaceSupport = true;
|
||||
@Desc("When carving placement is enabled, select which carved-space anchor this placement targets.")
|
||||
private CaveAnchorMode caveAnchorMode = CaveAnchorMode.PROFILE_DEFAULT;
|
||||
@Desc("If this is defined, this object wont place on the terrain heightmap, but instead on this virtual heightmap")
|
||||
private HeightmapNoise heightmap;
|
||||
@Desc("If set to true, Iris will try to fill the insides of 'rooms' and 'pockets' where air should fit based off of raytrace checks. This prevents a village house placing in an area where a tree already exists, and instead replaces the parts of the tree where the interior of the structure is. \n\nThis operation does not affect warmed-up generation speed however it does slow down loading objects.")
|
||||
private boolean smartBore = false;
|
||||
@Desc("If set to true, Blocks placed underwater that could be waterlogged are waterlogged.")
|
||||
private boolean waterloggable = false;
|
||||
@Desc("If set to true, objects will place on the fluid height level Such as boats.")
|
||||
private boolean onwater = false;
|
||||
@Desc("If set to true, this object will only place parts of itself where blocks already exist. Warning: Melding is very performance intensive!")
|
||||
private boolean meld = false;
|
||||
@Desc("If set to true, this object will get placed from the bottom of the world up")
|
||||
private boolean fromBottom;
|
||||
@Desc("If set to true, this object will place from the ground up instead of height checks when not y locked to the surface. This is not compatable with X and Z axis rotations (it may look off)")
|
||||
private boolean bottom = false;
|
||||
@Desc("If set to true, air will be placed before the schematic places.")
|
||||
private boolean bore = false;
|
||||
@Desc("Use a generator to warp the field of coordinates. Using simplex for example would make a square placement warp like a flag")
|
||||
private NoiseStyle warp = NoiseStyle.of(NoiseStyle.FLAT);
|
||||
@Desc("The placement mode")
|
||||
private ObjectPlaceMode mode = ObjectPlaceMode.CENTER_HEIGHT;
|
||||
@Desc("Find and replace blocks")
|
||||
private List<ObjectReplace> edit = List.of();
|
||||
@Desc("Translate this object's placement")
|
||||
private ObjectTranslate translate = new ObjectTranslate();
|
||||
@Desc("Scale Objects")
|
||||
private ObjectScale scale = new ObjectScale();
|
||||
@Desc("The loot tables to apply to these objects")
|
||||
private List<ObjectLoot> loot = List.of();
|
||||
@Desc("The vanilla loot tables to apply to these objects")
|
||||
private List<ObjectVanillaLoot> vanillaLoot = List.of();
|
||||
@Desc("Whether the given loot tables override any and all other loot tables available in the dimension, region or biome.")
|
||||
private boolean overrideGlobalLoot = false;
|
||||
@Desc("This object / these objects override the following trees when they grow...")
|
||||
private List<TreeOverride> trees = List.of();
|
||||
@ResourceRef(GeneratedObject.class)
|
||||
@Desc("List of objects to this object is allowed to collied with")
|
||||
private List<String> allowedCollisions = List.of();
|
||||
@ResourceRef(GeneratedObject.class)
|
||||
@Desc("List of objects to this object is forbidden to collied with")
|
||||
private List<String> forbiddenCollisions = List.of();
|
||||
@Desc("Ignore any placement restrictions for this object")
|
||||
@SerializedName(value = "forcePlace", alternate = {"force"})
|
||||
private boolean forcePlace = false;
|
||||
|
||||
private transient volatile String json;
|
||||
|
||||
public ObjectPlacement() {
|
||||
}
|
||||
|
||||
private ObjectPlacement(ObjectPlacement source) {
|
||||
place = source.place;
|
||||
rotation = source.rotation;
|
||||
clamp = source.clamp;
|
||||
snow = source.snow;
|
||||
isDolphinTarget = source.isDolphinTarget;
|
||||
slopeCondition = source.slopeCondition;
|
||||
rotateTowardsSlope = source.rotateTowardsSlope;
|
||||
chance = source.chance;
|
||||
chanceStyle = source.chanceStyle;
|
||||
separation = source.separation;
|
||||
density = source.density;
|
||||
densityStyle = source.densityStyle;
|
||||
stiltSettings = source.stiltSettings;
|
||||
vacuumSettings = source.vacuumSettings;
|
||||
boreExtendMaxY = source.boreExtendMaxY;
|
||||
markers = source.markers;
|
||||
boreExtendMinY = source.boreExtendMinY;
|
||||
underwater = source.underwater;
|
||||
carvingSupport = source.carvingSupport;
|
||||
surfaceSupportBuffer = source.surfaceSupportBuffer;
|
||||
surfaceSupportDepth = source.surfaceSupportDepth;
|
||||
requireSurfaceSupport = source.requireSurfaceSupport;
|
||||
caveAnchorMode = source.caveAnchorMode;
|
||||
heightmap = source.heightmap;
|
||||
smartBore = source.smartBore;
|
||||
waterloggable = source.waterloggable;
|
||||
onwater = source.onwater;
|
||||
meld = source.meld;
|
||||
fromBottom = source.fromBottom;
|
||||
bottom = source.bottom;
|
||||
bore = source.bore;
|
||||
warp = source.warp;
|
||||
mode = source.mode;
|
||||
edit = source.edit;
|
||||
translate = source.translate;
|
||||
scale = source.scale;
|
||||
loot = source.loot;
|
||||
vanillaLoot = source.vanillaLoot;
|
||||
overrideGlobalLoot = source.overrideGlobalLoot;
|
||||
trees = source.trees;
|
||||
allowedCollisions = source.allowedCollisions;
|
||||
forbiddenCollisions = source.forbiddenCollisions;
|
||||
forcePlace = source.forcePlace;
|
||||
json = source.json;
|
||||
}
|
||||
|
||||
/** A builder of a placement made in code, starting from the defaults a pack's placement starts from. */
|
||||
public static Builder builder() {
|
||||
return new Builder(new ObjectPlacement());
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder of a copy of this placement with some options changed. The copy keeps the JSON this placement was
|
||||
* read from, so the module settings it declares, and what Iris made of it, unless a noise option changes.
|
||||
*/
|
||||
public Builder toBuilder() {
|
||||
return new Builder(new ObjectPlacement(this));
|
||||
}
|
||||
|
||||
/** The objects to pick from, by the keys of the pack's objects. */
|
||||
public List<String> place() {
|
||||
return listOf(place);
|
||||
}
|
||||
|
||||
public ObjectRotation rotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public ObjectLimit clamp() {
|
||||
return clamp;
|
||||
}
|
||||
|
||||
public double snow() {
|
||||
return snow;
|
||||
}
|
||||
|
||||
public boolean isDolphinTarget() {
|
||||
return isDolphinTarget;
|
||||
}
|
||||
|
||||
public SlopeClip slopeCondition() {
|
||||
return slopeCondition;
|
||||
}
|
||||
|
||||
public boolean rotateTowardsSlope() {
|
||||
return rotateTowardsSlope;
|
||||
}
|
||||
|
||||
public double chance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
/** The noise, from 0 to 1, that {@link #chance()} is multiplied by at each chunk; empty when the chance is the same everywhere. */
|
||||
public Optional<NoiseStyle> chanceStyle() {
|
||||
return Optional.ofNullable(chanceStyle);
|
||||
}
|
||||
|
||||
/** The least distance in blocks between two objects of placements with the same objects; 0 when they are not kept apart. */
|
||||
public int separation() {
|
||||
return separation;
|
||||
}
|
||||
|
||||
public boolean isSeparated() {
|
||||
return separation > 0;
|
||||
}
|
||||
|
||||
/** The count of placements when the chance check passes, unless {@link #densityStyle()} picks it. */
|
||||
public int density() {
|
||||
return density;
|
||||
}
|
||||
|
||||
public Optional<StyledRange> densityStyle() {
|
||||
return Optional.ofNullable(densityStyle);
|
||||
}
|
||||
|
||||
/** The fixed density, or, when a style picks the count, the middle of its range. */
|
||||
public int middleDensity() {
|
||||
if (densityStyle == null) {
|
||||
return density;
|
||||
}
|
||||
return (int) ((densityStyle.max() + densityStyle.min()) / 2);
|
||||
}
|
||||
|
||||
public Optional<StiltSettings> stiltSettings() {
|
||||
return Optional.ofNullable(stiltSettings);
|
||||
}
|
||||
|
||||
public Optional<VacuumSettings> vacuumSettings() {
|
||||
return Optional.ofNullable(vacuumSettings);
|
||||
}
|
||||
|
||||
public int boreExtendMaxY() {
|
||||
return boreExtendMaxY;
|
||||
}
|
||||
|
||||
public List<PlacementMarker> markers() {
|
||||
return listOf(markers);
|
||||
}
|
||||
|
||||
public int boreExtendMinY() {
|
||||
return boreExtendMinY;
|
||||
}
|
||||
|
||||
public boolean underwater() {
|
||||
return underwater;
|
||||
}
|
||||
|
||||
public CarvingMode carvingSupport() {
|
||||
return carvingSupport;
|
||||
}
|
||||
|
||||
public int surfaceSupportBuffer() {
|
||||
return surfaceSupportBuffer;
|
||||
}
|
||||
|
||||
public int surfaceSupportDepth() {
|
||||
return surfaceSupportDepth;
|
||||
}
|
||||
|
||||
public boolean requireSurfaceSupport() {
|
||||
return requireSurfaceSupport;
|
||||
}
|
||||
|
||||
public CaveAnchorMode caveAnchorMode() {
|
||||
return caveAnchorMode;
|
||||
}
|
||||
|
||||
/** The virtual heightmap the objects place on instead of the terrain, if one is set. */
|
||||
public Optional<HeightmapNoise> heightmap() {
|
||||
return Optional.ofNullable(heightmap);
|
||||
}
|
||||
|
||||
public boolean smartBore() {
|
||||
return smartBore;
|
||||
}
|
||||
|
||||
public boolean waterloggable() {
|
||||
return waterloggable;
|
||||
}
|
||||
|
||||
public boolean onwater() {
|
||||
return onwater;
|
||||
}
|
||||
|
||||
public boolean meld() {
|
||||
return meld;
|
||||
}
|
||||
|
||||
public boolean fromBottom() {
|
||||
return fromBottom;
|
||||
}
|
||||
|
||||
public boolean bottom() {
|
||||
return bottom;
|
||||
}
|
||||
|
||||
public boolean bore() {
|
||||
return bore;
|
||||
}
|
||||
|
||||
public NoiseStyle warp() {
|
||||
return warp;
|
||||
}
|
||||
|
||||
public ObjectPlaceMode mode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public List<ObjectReplace> edit() {
|
||||
return listOf(edit);
|
||||
}
|
||||
|
||||
public ObjectTranslate translate() {
|
||||
return translate;
|
||||
}
|
||||
|
||||
public ObjectScale scale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public List<ObjectLoot> loot() {
|
||||
return listOf(loot);
|
||||
}
|
||||
|
||||
public List<ObjectVanillaLoot> vanillaLoot() {
|
||||
return listOf(vanillaLoot);
|
||||
}
|
||||
|
||||
public boolean overrideGlobalLoot() {
|
||||
return overrideGlobalLoot;
|
||||
}
|
||||
|
||||
public List<TreeOverride> trees() {
|
||||
return listOf(trees);
|
||||
}
|
||||
|
||||
/** Whether one of the trees this placement overrides is the species {@code species} grown on a sapling area of {@code width} by {@code depth}. */
|
||||
public boolean overridesTree(int width, int depth, String species) {
|
||||
return trees().stream().anyMatch(tree -> tree.matches(width, depth, species));
|
||||
}
|
||||
|
||||
public List<String> allowedCollisions() {
|
||||
return listOf(allowedCollisions);
|
||||
}
|
||||
|
||||
public List<String> forbiddenCollisions() {
|
||||
return listOf(forbiddenCollisions);
|
||||
}
|
||||
|
||||
public boolean forcePlace() {
|
||||
return forcePlace;
|
||||
}
|
||||
|
||||
/** The JSON this placement was read from, which declares its module settings; null for one made in code. */
|
||||
public String json() {
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* The names a placement's own options are written under: every field Gson reads, under its {@code @SerializedName} and
|
||||
* alternates. Settings other modules declare on a placement may not take these keys
|
||||
* ({@link com.volmit.FeatureRegistry#registerPlacementType}).
|
||||
*/
|
||||
public static Set<String> jsonFields() {
|
||||
Set<String> names = new TreeSet<>();
|
||||
for (Field field : ObjectPlacement.class.getDeclaredFields()) {
|
||||
int modifiers = field.getModifiers();
|
||||
if (Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers) || field.isSynthetic()) {
|
||||
continue;
|
||||
}
|
||||
SerializedName serialized = field.getAnnotation(SerializedName.class);
|
||||
if (serialized == null) {
|
||||
names.add(field.getName());
|
||||
continue;
|
||||
}
|
||||
names.add(serialized.value());
|
||||
names.addAll(Arrays.asList(serialized.alternate()));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
private static <T> List<T> listOf(List<T> values) {
|
||||
return values == null ? List.of() : Collections.unmodifiableList(values);
|
||||
}
|
||||
|
||||
/** Sets the options of a placement made in code; each setter returns the builder. */
|
||||
public static final class Builder {
|
||||
private final ObjectPlacement placement;
|
||||
|
||||
private Builder(ObjectPlacement placement) {
|
||||
this.placement = placement;
|
||||
}
|
||||
|
||||
public Builder place(List<String> keys) {
|
||||
placement.place = List.copyOf(keys);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder rotation(ObjectRotation rotation) {
|
||||
placement.rotation = rotation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clamp(ObjectLimit clamp) {
|
||||
placement.clamp = clamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder snow(double snow) {
|
||||
placement.snow = snow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder slopeCondition(SlopeClip slopeCondition) {
|
||||
placement.slopeCondition = slopeCondition;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder rotateTowardsSlope(boolean rotateTowardsSlope) {
|
||||
placement.rotateTowardsSlope = rotateTowardsSlope;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder chance(double chance) {
|
||||
placement.chance = chance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder density(int density) {
|
||||
placement.density = density;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder densityStyle(StyledRange densityStyle) {
|
||||
placement.densityStyle = densityStyle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder stiltSettings(StiltSettings stiltSettings) {
|
||||
placement.stiltSettings = stiltSettings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder vacuumSettings(VacuumSettings vacuumSettings) {
|
||||
placement.vacuumSettings = vacuumSettings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder boreExtendMaxY(int blocks) {
|
||||
placement.boreExtendMaxY = blocks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder markers(List<PlacementMarker> markers) {
|
||||
placement.markers = List.copyOf(markers);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder boreExtendMinY(int blocks) {
|
||||
placement.boreExtendMinY = blocks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder underwater(boolean underwater) {
|
||||
placement.underwater = underwater;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder carvingSupport(CarvingMode carvingSupport) {
|
||||
placement.carvingSupport = carvingSupport;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder surfaceSupportBuffer(int blocks) {
|
||||
placement.surfaceSupportBuffer = blocks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder surfaceSupportDepth(int blocks) {
|
||||
placement.surfaceSupportDepth = blocks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder requireSurfaceSupport(boolean require) {
|
||||
placement.requireSurfaceSupport = require;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder caveAnchorMode(CaveAnchorMode caveAnchorMode) {
|
||||
placement.caveAnchorMode = caveAnchorMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder heightmap(HeightmapNoise heightmap) {
|
||||
placement.heightmap = heightmap;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder smartBore(boolean smartBore) {
|
||||
placement.smartBore = smartBore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder waterloggable(boolean waterloggable) {
|
||||
placement.waterloggable = waterloggable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder onwater(boolean onwater) {
|
||||
placement.onwater = onwater;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder meld(boolean meld) {
|
||||
placement.meld = meld;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder fromBottom(boolean fromBottom) {
|
||||
placement.fromBottom = fromBottom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder bottom(boolean bottom) {
|
||||
placement.bottom = bottom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder bore(boolean bore) {
|
||||
placement.bore = bore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder warp(NoiseStyle warp) {
|
||||
placement.warp = warp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mode(ObjectPlaceMode mode) {
|
||||
placement.mode = mode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder edit(List<ObjectReplace> edit) {
|
||||
placement.edit = List.copyOf(edit);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder translate(ObjectTranslate translate) {
|
||||
placement.translate = translate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder scale(ObjectScale scale) {
|
||||
placement.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder loot(List<ObjectLoot> loot) {
|
||||
placement.loot = List.copyOf(loot);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder vanillaLoot(List<ObjectVanillaLoot> vanillaLoot) {
|
||||
placement.vanillaLoot = List.copyOf(vanillaLoot);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder overrideGlobalLoot(boolean override) {
|
||||
placement.overrideGlobalLoot = override;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder trees(List<TreeOverride> trees) {
|
||||
placement.trees = List.copyOf(trees);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder allowedCollisions(List<String> keys) {
|
||||
placement.allowedCollisions = List.copyOf(keys);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder forbiddenCollisions(List<String> keys) {
|
||||
placement.forbiddenCollisions = List.copyOf(keys);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder forcePlace(boolean forcePlace) {
|
||||
placement.forcePlace = forcePlace;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** The placement; the builder must not be used after. */
|
||||
/** The placement as set so far; later changes to the builder do not reach it. */
|
||||
public ObjectPlacement build() {
|
||||
return new ObjectPlacement(placement);
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads a placement like any settings and keeps the JSON it was read from. */
|
||||
public static final class KeepingItsJson implements TypeAdapterFactory {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked") // The type is checked to be ObjectPlacement.
|
||||
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
|
||||
if (type.getRawType() != ObjectPlacement.class) {
|
||||
return null;
|
||||
}
|
||||
TypeAdapter<ObjectPlacement> placements = gson.getDelegateAdapter(this, TypeToken.get(ObjectPlacement.class));
|
||||
TypeAdapter<JsonElement> elements = gson.getAdapter(JsonElement.class);
|
||||
return (TypeAdapter<T>) new TypeAdapter<ObjectPlacement>() {
|
||||
@Override
|
||||
public void write(JsonWriter out, ObjectPlacement placement) throws IOException {
|
||||
placements.write(out, placement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectPlacement read(JsonReader in) throws IOException {
|
||||
JsonElement written = elements.read(in);
|
||||
ObjectPlacement placement = placements.fromJsonTree(written);
|
||||
if (placement != null) {
|
||||
placement.json = written.toString();
|
||||
}
|
||||
return placement;
|
||||
}
|
||||
}.nullSafe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import art.arcane.iris.builtin.prepare.ObjectTranslate;
|
||||
import com.volmit.geometry.BlockBox;
|
||||
import com.volmit.geometry.BlockPosition;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
import com.volmit.object.PackObjects;
|
||||
import com.volmit.object.PlaceableObject;
|
||||
import com.volmit.placement.PlacementOutcome;
|
||||
import com.volmit.placement.PlacementRequest;
|
||||
import com.volmit.placement.PlacementRun;
|
||||
import com.volmit.placement.PlacementTerrain;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
/**
|
||||
* One object placed through the pack's placement stages with an object placement's settings: the input Iris's built-in
|
||||
* placement stages read ({@link PlacementRun#input}), and what they report back, the height the object was anchored at
|
||||
* and which of the written blocks are the object's own. Made for one placement; not thread-safe.
|
||||
*/
|
||||
public final class ObjectRun {
|
||||
private static final int NOT_ANCHORED = Integer.MIN_VALUE;
|
||||
private static final int NEIGHBOR_READ_BLOCKS = 1;
|
||||
private static final long X_MULTIPLIER = 0x9E3779B97F4A7C15L;
|
||||
private static final long Z_MULTIPLIER = 0xC2B2AE3D27D4EB4FL;
|
||||
private static final long Y_MULTIPLIER = 0x165667B19E3779F9L;
|
||||
private static final long FNV_OFFSET_BASIS = 0xCBF29CE484222325L;
|
||||
private static final long FNV_PRIME = 0x100000001B3L;
|
||||
|
||||
private PlaceableObject object;
|
||||
private final ObjectPlacement settings;
|
||||
private final int x;
|
||||
private final int requestedY;
|
||||
private final int z;
|
||||
private final Cave cave;
|
||||
private final List<BlockPosition> objectBlocks = new ArrayList<>();
|
||||
private int anchorY = NOT_ANCHORED;
|
||||
|
||||
private ObjectRun(PlaceableObject object, ObjectPlacement settings, int x, int requestedY, int z, Cave cave) {
|
||||
this.object = Objects.requireNonNull(object, "object");
|
||||
this.settings = Objects.requireNonNull(settings, "settings");
|
||||
this.x = x;
|
||||
this.requestedY = requestedY;
|
||||
this.z = z;
|
||||
this.cave = cave;
|
||||
}
|
||||
|
||||
/** @param requestedY the height to place at, or a negative value for the stages to sample it */
|
||||
public static ObjectRun of(PlaceableObject object, ObjectPlacement settings, int x, int requestedY, int z) {
|
||||
return new ObjectRun(object, settings, x, requestedY, z, null);
|
||||
}
|
||||
|
||||
/** A placement inside {@code cave}, which the stages anchor in and keep the object's height within. */
|
||||
public static ObjectRun inCave(PlaceableObject object, ObjectPlacement settings, int x, int requestedY, int z, Cave cave) {
|
||||
return new ObjectRun(object, settings, x, requestedY, z, Objects.requireNonNull(cave, "cave"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The cave an object is placed in.
|
||||
*
|
||||
* @param surface the height of its floor
|
||||
* @param height how many blocks high it is
|
||||
*/
|
||||
public record Cave(int surface, int height) {
|
||||
}
|
||||
|
||||
/** Places the object into {@code terrain} through the pack's placement stages of {@code world} ({@link #toRun}). */
|
||||
public PlacementOutcome placeIn(PackWorld world, PlacementTerrain terrain) {
|
||||
return world.placements().place(toRun(terrain, world));
|
||||
}
|
||||
|
||||
/**
|
||||
* The run of this placement in {@code terrain}. Its seed comes from the world's seed and the placement's identity, the
|
||||
* object's name and requested position, so the same placement draws the same in every run. Its area is every column
|
||||
* the object reaches in any rotation around its anchor, moved by its translation and surface warp, and one block more
|
||||
* for neighbor reads. A placement that smart bores bores its object first, so the stages see the bored air.
|
||||
*/
|
||||
public PlacementRun toRun(PlacementTerrain terrain, PackWorld world) {
|
||||
return toRun(terrain, world.seed(), world.resources().objects());
|
||||
}
|
||||
|
||||
/** As {@link #toRun(PlacementTerrain, PackWorld)}, for a world of seed {@code worldSeed} whose pack's objects are {@code objects}. */
|
||||
public PlacementRun toRun(PlacementTerrain terrain, long worldSeed, PackObjects objects) {
|
||||
if (settings.smartBore()) {
|
||||
object = objects.smartBored(object);
|
||||
}
|
||||
PlacementRequest request = new PlacementRequest(object.geometry(), new BlockPosition(x, requestedY, z));
|
||||
return new PlacementRun(request, object.name(), Optional.ofNullable(settings.json()), area(), terrain, this,
|
||||
placementSeed(worldSeed));
|
||||
}
|
||||
|
||||
public PlaceableObject object() {
|
||||
return object;
|
||||
}
|
||||
|
||||
/** The settings as the caller passed them; the stages derive what they change, such as the rotation, themselves. */
|
||||
public ObjectPlacement settings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public int x() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/** The height the caller asked for, negative when the stages sample it. */
|
||||
public int requestedY() {
|
||||
return requestedY;
|
||||
}
|
||||
|
||||
public int z() {
|
||||
return z;
|
||||
}
|
||||
|
||||
/** The cave the object is placed in; empty outside caves. */
|
||||
public Optional<Cave> cave() {
|
||||
return Optional.ofNullable(cave);
|
||||
}
|
||||
|
||||
/** Reports the height the object was anchored at. */
|
||||
public void anchoredAt(int y) {
|
||||
anchorY = y;
|
||||
}
|
||||
|
||||
/** The height the object was anchored at; empty until a stage anchors it. */
|
||||
public OptionalInt anchorY() {
|
||||
return anchorY == NOT_ANCHORED ? OptionalInt.empty() : OptionalInt.of(anchorY);
|
||||
}
|
||||
|
||||
/** Reports a written block as one of the object's own, as opposed to boring, stilts, snow or a terrain bend. */
|
||||
public void objectBlockWritten(BlockPosition position) {
|
||||
objectBlocks.add(position);
|
||||
}
|
||||
|
||||
/** The object's own blocks the stages wrote, in the order they wrote them; they reach the world only if it is placed. */
|
||||
public List<BlockPosition> objectBlocks() {
|
||||
return Collections.unmodifiableList(objectBlocks);
|
||||
}
|
||||
|
||||
private BlockBox area() {
|
||||
int objectRadius = Math.max(rotationRadius(object.geometry().bounds()), rotationRadius(declaredBox()));
|
||||
int reach = objectRadius + translationLength(settings.translate()) + warpMargin(settings.warp()) + NEIGHBOR_READ_BLOCKS;
|
||||
return new BlockBox(x - reach, Integer.MIN_VALUE, z - reach, x + reach + 1, Integer.MAX_VALUE, z + reach + 1);
|
||||
}
|
||||
|
||||
/** The object's declared size around its center, which its block offsets count from. */
|
||||
private BlockBox declaredBox() {
|
||||
BlockPosition center = object.center();
|
||||
return new BlockBox(-center.x(), -center.y(), -center.z(), Math.max(1, object.width()) - center.x(),
|
||||
Math.max(1, object.height()) - center.y(), Math.max(1, object.depth()) - center.z());
|
||||
}
|
||||
|
||||
/** The farthest any block of {@code bounds} lies from the origin, which rotations turn around. */
|
||||
private static int rotationRadius(BlockBox bounds) {
|
||||
long farthestX = farthest(bounds.minX(), bounds.maxX());
|
||||
long farthestY = farthest(bounds.minY(), bounds.maxY());
|
||||
long farthestZ = farthest(bounds.minZ(), bounds.maxZ());
|
||||
return (int) Math.ceil(Math.sqrt(farthestX * farthestX + farthestY * farthestY + farthestZ * farthestZ));
|
||||
}
|
||||
|
||||
private static long farthest(int min, int maxExclusive) {
|
||||
return Math.max(Math.abs((long) min), Math.abs((long) maxExclusive - 1));
|
||||
}
|
||||
|
||||
private static int translationLength(ObjectTranslate translate) {
|
||||
long translateX = translate.x();
|
||||
long translateY = translate.y();
|
||||
long translateZ = translate.z();
|
||||
return (int) Math.ceil(Math.sqrt(translateX * translateX + translateY * translateY + translateZ * translateZ));
|
||||
}
|
||||
|
||||
private static int warpMargin(NoiseStyle warp) {
|
||||
return warps(warp) ? (int) Math.ceil(Math.abs(warp.multiplier()) / 2D) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether {@code warp} moves the placement's columns: any base style but {@link NoiseStyle#FLAT}. Unlike
|
||||
* {@link NoiseStyle#isFlat()}, a flat style with an expression still does not warp, as Iris always read it.
|
||||
*/
|
||||
public static boolean warps(NoiseStyle warp) {
|
||||
return !NoiseStyle.FLAT.equals(warp.style());
|
||||
}
|
||||
|
||||
private long placementSeed(long worldSeed) {
|
||||
return worldSeed ^ fnv1a(object.name()) ^ (x * X_MULTIPLIER) ^ (requestedY * Y_MULTIPLIER) ^ (z * Z_MULTIPLIER);
|
||||
}
|
||||
|
||||
private static long fnv1a(String text) {
|
||||
long hash = FNV_OFFSET_BASIS;
|
||||
for (byte value : text.getBytes(StandardCharsets.UTF_8)) {
|
||||
hash = (hash ^ (value & 0xFF)) * FNV_PRIME;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/** How an object placement scales its objects, written as the placement's {@code scale}. */
|
||||
@Snippet("iris/objects/object-scale")
|
||||
@Desc("Scale Objects")
|
||||
public final class ObjectScale {
|
||||
private static final double NO_SCALE = 1;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(50)
|
||||
@Desc("Fixed scale multiplier for this object. 0.5 shrinks to half size, 2.0 doubles the size. When set to anything other than 1, this overrides minimumScale and maximumScale. Leave at 1 to use the minimumScale/maximumScale range.")
|
||||
private double size = NO_SCALE;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(32)
|
||||
@Desc("Iris Objects are scaled and cached to speed up placements. Because of this extra memory is used, so we evenly distribute variations across the defined scale range, then pick one randomly. If the differences is small, use a lower number. For more possibilities on the scale spectrum, increase this at the cost of memory.")
|
||||
private int variations = 7;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(50)
|
||||
@Desc("The minimum scale. Used when size is 1 to pick a random scale per placement.")
|
||||
private double minimumScale = NO_SCALE;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(50)
|
||||
@Desc("The maximum scale. Used when size is 1 to pick a random scale per placement.")
|
||||
private double maximumScale = NO_SCALE;
|
||||
|
||||
@Desc("If this object is scaled up beyond its origin size, specify a 3D interpolator. NONE keeps blocky scaled output, TRILINEAR (LERP) smooths with linear interpolation, TRICUBIC and TRIHERMITE produce smoother but slower output.")
|
||||
private ScaleInterpolation interpolation = ScaleInterpolation.NONE;
|
||||
|
||||
public ObjectScale() {
|
||||
}
|
||||
|
||||
public double size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public int variations() {
|
||||
return variations;
|
||||
}
|
||||
|
||||
public double minimumScale() {
|
||||
return minimumScale;
|
||||
}
|
||||
|
||||
public double maximumScale() {
|
||||
return maximumScale;
|
||||
}
|
||||
|
||||
public ScaleInterpolation interpolation() {
|
||||
return interpolation == null ? ScaleInterpolation.NONE : interpolation;
|
||||
}
|
||||
|
||||
/** The largest factor this scale makes an object, which a placement's reach has to cover. */
|
||||
public double maxScale() {
|
||||
if (size != NO_SCALE) {
|
||||
return size;
|
||||
}
|
||||
return Math.max(minimumScale, maximumScale);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The object placements a region or biome declares, written as {@code "objects": [...]}, the list of placements. A chunk
|
||||
* places those of its centre column's region and of that column's biome, and of the cave biome where it places in caves.
|
||||
*/
|
||||
@Desc("Objects define what schematics (iob files) iris will place here")
|
||||
@Feature(id = "iris:objects", name = "Objects", key = "objects", root = "objects", targets = {Level.REGION, Level.BIOME})
|
||||
public final class ObjectSettings implements IrisFeature {
|
||||
@Desc("Objects define what schematics (iob files) iris will place here")
|
||||
private List<ObjectPlacement> objects = List.of();
|
||||
|
||||
public ObjectSettings() {
|
||||
}
|
||||
|
||||
public List<ObjectPlacement> objects() {
|
||||
return objects == null ? List.of() : Collections.unmodifiableList(objects);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** Whether a dimension refuses surface objects over carved openings, written as {@code "requireObjectSurfaceSupport": true}. */
|
||||
@Desc("Refuse to place surface objects and trees over carved surface openings.")
|
||||
@Feature(id = "iris:objects/surface-support", name = "Require surface support", key = "requireObjectSurfaceSupport", root = "require", targets = Level.DIMENSION)
|
||||
public final class RequireSurfaceSupportSettings implements IrisFeature {
|
||||
private static final boolean DEFAULT_REQUIRED = true;
|
||||
|
||||
@Desc("Refuse to place surface objects and trees over carved surface openings.")
|
||||
private boolean require = DEFAULT_REQUIRED;
|
||||
|
||||
public RequireSurfaceSupportSettings() {
|
||||
}
|
||||
|
||||
public boolean require() {
|
||||
return require;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Use 3D Interpolation on scaled objects if they are larger than the origin.")
|
||||
public enum ScaleInterpolation {
|
||||
@Desc("Don't interpolate, big cubes")
|
||||
NONE,
|
||||
@Desc("Uses linear interpolation in 3 dimensions, generally pretty good, but slow")
|
||||
TRILINEAR,
|
||||
@Desc("Uses cubic spline interpolation in 3 dimensions, even better, but extreme slowdowns")
|
||||
TRICUBIC,
|
||||
@Desc("Uses hermite spline interpolation in 3 dimensions, even better, but extreme slowdowns")
|
||||
TRIHERMITE
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
/** The least surface-support buffer a dimension gives its surface objects, written as {@code "objectSurfaceSupportBuffer": 2}. */
|
||||
@Desc("Minimum surface-support buffer, in blocks, applied to every surface object placement in this dimension. A placement may ask for more but never less.")
|
||||
@Feature(id = "iris:objects/surface-support-buffer", name = "Surface support buffer", key = "objectSurfaceSupportBuffer", root = "buffer", targets = Level.DIMENSION)
|
||||
public final class SurfaceSupportBufferSettings implements IrisFeature {
|
||||
private static final int DEFAULT_BUFFER_BLOCKS = 2;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(16)
|
||||
@Desc("Minimum surface-support buffer, in blocks, applied to every surface object placement in this dimension. A placement may ask for more but never less.")
|
||||
private int buffer = DEFAULT_BUFFER_BLOCKS;
|
||||
|
||||
public SurfaceSupportBufferSettings() {
|
||||
}
|
||||
|
||||
public int buffer() {
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** The trees an object placement overrides when their saplings grow, an entry of the placement's {@code trees}. */
|
||||
@Snippet("iris/objects/tree")
|
||||
@Desc("Tree replace options for this object placer")
|
||||
public final class TreeOverride {
|
||||
@Required
|
||||
@Desc("The types of trees overwritten by this object")
|
||||
private List<String> treeTypes = List.of();
|
||||
|
||||
@Required
|
||||
@Desc("The size of the square of saplings this applies to (2 means a 2 * 2 sapling area)")
|
||||
private List<TreeSize> sizes = List.of();
|
||||
|
||||
public TreeOverride() {
|
||||
}
|
||||
|
||||
public List<String> treeTypes() {
|
||||
return treeTypes == null ? List.of() : Collections.unmodifiableList(treeTypes);
|
||||
}
|
||||
|
||||
public List<TreeSize> sizes() {
|
||||
return sizes == null ? List.of() : Collections.unmodifiableList(sizes);
|
||||
}
|
||||
|
||||
/** Whether this override is for a sapling area of {@code width} by {@code depth} growing the species {@code species}. */
|
||||
public boolean matches(int width, int depth, String species) {
|
||||
return matchesSize(width, depth) && matchesSpecies(species);
|
||||
}
|
||||
|
||||
private boolean matchesSize(int width, int depth) {
|
||||
for (TreeSize size : sizes()) {
|
||||
if (size.matches(width, depth)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean matchesSpecies(String species) {
|
||||
for (String type : treeTypes()) {
|
||||
if (type != null && type.equalsIgnoreCase(species)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/** The size of a sapling area, in saplings, that a tree override applies to. */
|
||||
@Snippet("iris/objects/tree-size")
|
||||
@Desc("Sapling override object picking options")
|
||||
public final class TreeSize {
|
||||
@Required
|
||||
@Desc("The width of the sapling area")
|
||||
private int width = 1;
|
||||
|
||||
@Required
|
||||
@Desc("The depth of the sapling area")
|
||||
private int depth = 1;
|
||||
|
||||
public TreeSize() {
|
||||
}
|
||||
|
||||
public TreeSize(int width, int depth) {
|
||||
this.width = width;
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
public int width() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public int depth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
/** Whether an area of {@code otherWidth} by {@code otherDepth} saplings is this size, turned either way. */
|
||||
public boolean matches(int otherWidth, int otherDepth) {
|
||||
return (width == otherWidth && depth == otherDepth) || (depth == otherWidth && width == otherDepth);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** Whether the objects placed in the terrain stacked above ignore placement restrictions, written as {@code "upperObjectsForcePlace": true}. */
|
||||
@Desc("When true, upper-dimension objects force-place regardless of placement restrictions (slope, underwater, clamp, collisions, carving). Normal dimension objects always place first; upper objects place second and may clip or occlude lower-dimension placements when this is enabled.")
|
||||
@Feature(id = "iris:objects/upper-force", name = "Force upper dimension objects", key = "upperObjectsForcePlace", root = "force", targets = Level.DIMENSION)
|
||||
public final class UpperObjectsForceSettings implements IrisFeature {
|
||||
@Desc("When true, upper-dimension objects force-place regardless of placement restrictions (slope, underwater, clamp, collisions, carving). Normal dimension objects always place first; upper objects place second and may clip or occlude lower-dimension placements when this is enabled.")
|
||||
private boolean force = false;
|
||||
|
||||
public UpperObjectsForceSettings() {
|
||||
}
|
||||
|
||||
public boolean force() {
|
||||
return force;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.builtin.objects;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** Whether the objects of a dimension are also placed in the terrain stacked above it, written as {@code "upperDimensionObjects": true}. */
|
||||
@Desc("When true, objects from the mantle (structures, trees, etc.) can be placed in the upper dimension terrain zone. When false, the upper terrain is protected from object placement.")
|
||||
@Feature(id = "iris:objects/upper", name = "Upper dimension objects", key = "upperDimensionObjects", root = "enabled", targets = Level.DIMENSION)
|
||||
public final class UpperObjectsSettings implements IrisFeature {
|
||||
@Desc("When true, objects from the mantle (structures, trees, etc.) can be placed in the upper dimension terrain zone. When false, the upper terrain is protected from object placement.")
|
||||
private boolean enabled = false;
|
||||
|
||||
public UpperObjectsSettings() {
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The public face of Iris's built-in modules: every stage constant, in {@link art.arcane.iris.builtin.IrisStages},
|
||||
* and the settings and output types of those stages. {@link art.arcane.iris.core.modules.IrisModuleHost} exposes this package, with its
|
||||
* subpackages, to pack modules, so a pack jar can {@code requires(...)} a built-in stage and read its
|
||||
* output. Everything here is part of what packs compile against.
|
||||
* <p>
|
||||
* Keep implementation out of it: stage bodies and anything that uses Iris internals live in the
|
||||
* built-in module classes outside this package, which packs cannot see. Settings and output types go in one
|
||||
* subpackage per built-in module, named after the module path, such as {@code art.arcane.iris.builtin.spawn}
|
||||
* for {@code iris:spawn}. A type only the built-ins jar uses, which Iris itself never reads, lives in
|
||||
* {@code art.arcane.iris.modules} instead, which Iris does not expose.
|
||||
* <p>
|
||||
* Besides those, it holds what Iris and the built-ins jar must share, since each sees its own copy
|
||||
* of every other class: narrow facades only Iris's own built-ins use, interfaces Iris's worlds implement
|
||||
* ({@link art.arcane.iris.builtin.structure.StructureHost}), and the seed purposes of the built-in features
|
||||
* ({@link art.arcane.iris.builtin.IrisSeedPurposes}). Keep them few: each is a promise.
|
||||
* <p>
|
||||
* The placement stages ({@code iris:prepare} to {@code iris:snow}) run in the pack's placement graph, which
|
||||
* {@code PackWorld.placements()} runs. They read the object and its settings from the run's input,
|
||||
* {@link art.arcane.iris.builtin.objects.ObjectRun}, which Iris also builds when it places an object itself.
|
||||
*/
|
||||
package art.arcane.iris.builtin;
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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.builtin.prepare;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/** One axis of an object rotation, with the angles it may turn by and the steps between them. */
|
||||
@Snippet("iris/prepare/axis-rotation")
|
||||
@Desc("Represents a rotation axis with intervals and maxes. The x and z axis values are defaulted to disabled. The Y axis defaults to on, rotating by 90 degree increments.")
|
||||
public final class AxisRotationClamp {
|
||||
private static final double FULL_TURN_DEGREES = 360D;
|
||||
|
||||
@Desc("Should this axis be rotated at all?")
|
||||
private boolean enabled = false;
|
||||
|
||||
private transient boolean forceLock = false;
|
||||
|
||||
@Required
|
||||
@MinNumber(-360)
|
||||
@MaxNumber(360)
|
||||
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
|
||||
private double min = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(-360)
|
||||
@MaxNumber(360)
|
||||
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
|
||||
private double max = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(360)
|
||||
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees. \nSetting this to 0 means totally free rotation.\n\nNote that a lot of structures can have issues with non 90 degree intervals because the minecraft block resolution is so low.")
|
||||
private double interval = 0;
|
||||
|
||||
public AxisRotationClamp() {
|
||||
}
|
||||
|
||||
/** An axis turned as {@code enabled} says, by angles from {@code min} to {@code max} in steps of {@code interval}. */
|
||||
public static AxisRotationClamp of(boolean enabled, boolean forceLock, double min, double max, double interval) {
|
||||
AxisRotationClamp clamp = new AxisRotationClamp();
|
||||
clamp.enabled = enabled;
|
||||
clamp.forceLock = forceLock;
|
||||
clamp.min = min;
|
||||
clamp.max = max;
|
||||
clamp.interval = interval;
|
||||
return clamp;
|
||||
}
|
||||
|
||||
/** An axis that turns to exactly {@code angle}, in steps of {@code interval}, whatever its min and max say. */
|
||||
public static AxisRotationClamp locked(boolean enabled, double angle, double interval) {
|
||||
return of(enabled, true, angle, angle, interval);
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public double min() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public double max() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public double interval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public boolean isUnlimited() {
|
||||
return min == max && min == 0;
|
||||
}
|
||||
|
||||
public boolean isLocked() {
|
||||
return min == max && !isUnlimited();
|
||||
}
|
||||
|
||||
public double getRadians(int rng) {
|
||||
if (forceLock) {
|
||||
return Math.toRadians(Math.ceil(Math.abs((max % FULL_TURN_DEGREES))));
|
||||
}
|
||||
|
||||
if (isUnlimited()) {
|
||||
double resolvedInterval = interval < 1 ? 1 : interval;
|
||||
return Math.toRadians((resolvedInterval * (Math.ceil(Math.abs((rng % FULL_TURN_DEGREES) / resolvedInterval)))) % FULL_TURN_DEGREES);
|
||||
}
|
||||
|
||||
if (min == max && min != 0) {
|
||||
return Math.toRadians(max);
|
||||
}
|
||||
|
||||
double angle = (interval * (Math.ceil(Math.abs((rng % FULL_TURN_DEGREES) / interval)))) % FULL_TURN_DEGREES;
|
||||
return Math.toRadians(Math.min(Math.max(min, max), Math.max(Math.min(min, max), angle)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return other instanceof AxisRotationClamp clamp
|
||||
&& enabled == clamp.enabled
|
||||
&& Double.compare(min, clamp.min) == 0
|
||||
&& Double.compare(max, clamp.max) == 0
|
||||
&& Double.compare(interval, clamp.interval) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(enabled, min, max, interval);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
/*
|
||||
* 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.builtin.prepare;
|
||||
|
||||
import art.arcane.iris.engine.object.value.IrisDirection;
|
||||
import art.arcane.iris.engine.object.value.IrisPosition;
|
||||
import art.arcane.volmlib.util.math.IrisBlockVector;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* How an object is turned around each axis, written as a placement's {@code rotation}. Positions turn around X, then Z,
|
||||
* then Y; an axis locked to a multiple of a quarter turn swaps coordinates exactly instead of turning by an angle.
|
||||
*/
|
||||
@Snippet("iris/prepare/object-rotator")
|
||||
@Desc("Configures rotation for iris")
|
||||
public final class ObjectRotation {
|
||||
private static final double QUARTER_TURN_DEGREES = 90;
|
||||
private static final double HALF_TURN_DEGREES = 180;
|
||||
private static final double THREE_QUARTER_TURN_DEGREES = 270;
|
||||
private static final double FULL_TURN_DEGREES = 360;
|
||||
|
||||
@Desc("If this rotator is enabled or not")
|
||||
private boolean enabled = true;
|
||||
|
||||
@Desc("The x axis rotation")
|
||||
private AxisRotationClamp xAxis = new AxisRotationClamp();
|
||||
|
||||
@Desc("The y axis rotation")
|
||||
private AxisRotationClamp yAxis = AxisRotationClamp.of(true, false, 0, 0, QUARTER_TURN_DEGREES);
|
||||
|
||||
@Desc("The z axis rotation")
|
||||
private AxisRotationClamp zAxis = new AxisRotationClamp();
|
||||
|
||||
public ObjectRotation() {
|
||||
}
|
||||
|
||||
/** A rotation with the given axes. */
|
||||
public static ObjectRotation of(boolean enabled, AxisRotationClamp xAxis, AxisRotationClamp yAxis, AxisRotationClamp zAxis) {
|
||||
ObjectRotation rotation = new ObjectRotation();
|
||||
rotation.enabled = enabled;
|
||||
rotation.xAxis = xAxis;
|
||||
rotation.yAxis = yAxis;
|
||||
rotation.zAxis = zAxis;
|
||||
return rotation;
|
||||
}
|
||||
|
||||
/** A rotation locked to the given angles, in degrees; enabled only when one of them is not 0. */
|
||||
public static ObjectRotation of(double x, double y, double z) {
|
||||
return of(x != 0 || y != 0 || z != 0,
|
||||
AxisRotationClamp.locked(x != 0, x, QUARTER_TURN_DEGREES),
|
||||
AxisRotationClamp.locked(y != 0, y, QUARTER_TURN_DEGREES),
|
||||
AxisRotationClamp.locked(z != 0, z, QUARTER_TURN_DEGREES));
|
||||
}
|
||||
|
||||
/** Upside down: half a turn around X and no turn around Y or Z. */
|
||||
public static ObjectRotation xFlip180() {
|
||||
return of(true, AxisRotationClamp.locked(true, HALF_TURN_DEGREES, 0), new AxisRotationClamp(), new AxisRotationClamp());
|
||||
}
|
||||
|
||||
/** Upside down, then a random quarter turn around Y. */
|
||||
public static ObjectRotation xFlip180RandomY() {
|
||||
return xFlip180().withYAxis(AxisRotationClamp.of(true, false, 0, 0, QUARTER_TURN_DEGREES));
|
||||
}
|
||||
|
||||
/** Upside down, then {@code y} degrees around Y. */
|
||||
public static ObjectRotation xFlip180WithY(double y) {
|
||||
return xFlip180().withYAxis(AxisRotationClamp.locked(true, y, QUARTER_TURN_DEGREES));
|
||||
}
|
||||
|
||||
/** This rotation with {@code axis} around Y. */
|
||||
public ObjectRotation withYAxis(AxisRotationClamp axis) {
|
||||
return of(enabled, xAxis, axis, zAxis);
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public AxisRotationClamp xAxis() {
|
||||
return xAxis;
|
||||
}
|
||||
|
||||
public AxisRotationClamp yAxis() {
|
||||
return yAxis;
|
||||
}
|
||||
|
||||
public AxisRotationClamp zAxis() {
|
||||
return zAxis;
|
||||
}
|
||||
|
||||
public boolean canRotateX() {
|
||||
return enabled && xAxis.enabled();
|
||||
}
|
||||
|
||||
public boolean canRotateY() {
|
||||
return enabled && yAxis.enabled();
|
||||
}
|
||||
|
||||
public boolean canRotateZ() {
|
||||
return enabled && zAxis.enabled();
|
||||
}
|
||||
|
||||
public boolean canRotate() {
|
||||
return canRotateX() || canRotateY() || canRotateZ();
|
||||
}
|
||||
|
||||
/** The angle, in radians, the object turns around {@code axis} for the random {@code spin}; 0 when the rotation or the axis is off. */
|
||||
public double radians(AxisRotationClamp axis, int spin) {
|
||||
if (!enabled || !axis.enabled()) {
|
||||
return 0;
|
||||
}
|
||||
return axis.getRadians(spin);
|
||||
}
|
||||
|
||||
public double xRadians(int spin) {
|
||||
return radians(xAxis, spin);
|
||||
}
|
||||
|
||||
public double yRadians(int spin) {
|
||||
return radians(yAxis, spin);
|
||||
}
|
||||
|
||||
public double zRadians(int spin) {
|
||||
return radians(zAxis, spin);
|
||||
}
|
||||
|
||||
public IrisBlockVector rotate(IrisBlockVector position) {
|
||||
return rotate(position, 0, 0, 0);
|
||||
}
|
||||
|
||||
public IrisPosition rotate(IrisPosition position) {
|
||||
return rotate(position, 0, 0, 0);
|
||||
}
|
||||
|
||||
public IrisPosition rotate(IrisPosition position, int spinX, int spinY, int spinZ) {
|
||||
IrisBlockVector turned = rotate(new IrisBlockVector(position.getX(), position.getY(), position.getZ()), spinX, spinY, spinZ);
|
||||
return new IrisPosition(turned.getBlockX(), turned.getBlockY(), turned.getBlockZ());
|
||||
}
|
||||
|
||||
/** The direction closest to {@code direction} turned by this rotation. */
|
||||
public IrisDirection rotate(IrisDirection direction) {
|
||||
IrisBlockVector turned = rotate(new IrisBlockVector(direction.x(), direction.y(), direction.z()));
|
||||
double closestDistance = Double.MAX_VALUE;
|
||||
IrisDirection closest = null;
|
||||
for (IrisDirection candidate : IrisDirection.values()) {
|
||||
double distance = new IrisBlockVector(candidate.x(), candidate.y(), candidate.z()).distance(turned);
|
||||
if (distance < closestDistance) {
|
||||
closestDistance = distance;
|
||||
closest = candidate;
|
||||
}
|
||||
}
|
||||
return closest;
|
||||
}
|
||||
|
||||
/** {@code position} turned around X, then Z, then Y, each by the angle {@code spin} picks for it; a copy unless nothing turns. */
|
||||
public IrisBlockVector rotate(IrisBlockVector position, int spinX, int spinY, int spinZ) {
|
||||
if (!canRotate()) {
|
||||
return position;
|
||||
}
|
||||
IrisBlockVector turned = position.clone();
|
||||
if (canRotateX()) {
|
||||
turnAroundX(turned, spinX);
|
||||
}
|
||||
if (canRotateZ()) {
|
||||
turnAroundZ(turned, spinZ);
|
||||
}
|
||||
if (canRotateY()) {
|
||||
turnAroundY(turned, spinY);
|
||||
}
|
||||
return turned;
|
||||
}
|
||||
|
||||
private void turnAroundX(IrisBlockVector v, int spin) {
|
||||
if (!xAxis.isLocked()) {
|
||||
v.rotateAroundX(xRadians(spin));
|
||||
return;
|
||||
}
|
||||
double angle = xAxis.max();
|
||||
if (Math.abs(angle) % FULL_TURN_DEGREES == HALF_TURN_DEGREES) {
|
||||
v.setZ(-v.getZ());
|
||||
v.setY(-v.getY());
|
||||
} else if (isQuarterTurn(angle)) {
|
||||
double z = v.getZ();
|
||||
v.setZ(v.getY());
|
||||
v.setY(-z);
|
||||
} else if (isThreeQuarterTurn(angle)) {
|
||||
double z = v.getZ();
|
||||
v.setZ(-v.getY());
|
||||
v.setY(z);
|
||||
} else {
|
||||
v.rotateAroundX(xRadians(spin));
|
||||
}
|
||||
}
|
||||
|
||||
private void turnAroundZ(IrisBlockVector v, int spin) {
|
||||
if (!zAxis.isLocked()) {
|
||||
v.rotateAroundZ(zRadians(spin));
|
||||
return;
|
||||
}
|
||||
double angle = zAxis.max();
|
||||
if (Math.abs(angle) % FULL_TURN_DEGREES == HALF_TURN_DEGREES) {
|
||||
v.setY(-v.getY());
|
||||
v.setX(-v.getX());
|
||||
} else if (isQuarterTurn(angle)) {
|
||||
double y = v.getY();
|
||||
v.setY(v.getX());
|
||||
v.setX(-y);
|
||||
} else if (isThreeQuarterTurn(angle)) {
|
||||
double y = v.getY();
|
||||
v.setY(-v.getX());
|
||||
v.setX(y);
|
||||
} else {
|
||||
v.rotateAroundZ(zRadians(spin));
|
||||
}
|
||||
}
|
||||
|
||||
private void turnAroundY(IrisBlockVector v, int spin) {
|
||||
if (!yAxis.isLocked()) {
|
||||
v.rotateAroundY(yRadians(spin));
|
||||
return;
|
||||
}
|
||||
double angle = yAxis.max();
|
||||
if (Math.abs(angle) % FULL_TURN_DEGREES == HALF_TURN_DEGREES) {
|
||||
v.setX(-v.getX());
|
||||
v.setZ(-v.getZ());
|
||||
} else if (isQuarterTurn(angle)) {
|
||||
double x = v.getX();
|
||||
v.setX(v.getZ());
|
||||
v.setZ(-x);
|
||||
} else if (isThreeQuarterTurn(angle)) {
|
||||
double x = v.getX();
|
||||
v.setX(-v.getZ());
|
||||
v.setZ(x);
|
||||
} else {
|
||||
v.rotateAroundY(yRadians(spin));
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isQuarterTurn(double angle) {
|
||||
return angle % FULL_TURN_DEGREES == QUARTER_TURN_DEGREES || angle % FULL_TURN_DEGREES == -THREE_QUARTER_TURN_DEGREES;
|
||||
}
|
||||
|
||||
private static boolean isThreeQuarterTurn(double angle) {
|
||||
return angle == -QUARTER_TURN_DEGREES || angle % FULL_TURN_DEGREES == THREE_QUARTER_TURN_DEGREES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return other instanceof ObjectRotation rotation
|
||||
&& enabled == rotation.enabled
|
||||
&& Objects.equals(xAxis, rotation.xAxis)
|
||||
&& Objects.equals(yAxis, rotation.yAxis)
|
||||
&& Objects.equals(zAxis, rotation.zAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(enabled, xAxis, yAxis, zAxis);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package art.arcane.iris.builtin.prepare;
|
||||
|
||||
import art.arcane.volmlib.util.math.IrisBlockVector;
|
||||
|
||||
/**
|
||||
* Precomputed vector rotation for a single placement.
|
||||
* <p>
|
||||
* Turns vectors branch for branch as Iris's object rotation does, with two differences: it mutates the vector
|
||||
* handed to it instead of cloning, and the per-axis angle plus its cosine and sine are resolved once instead of once
|
||||
* per block. The angle is a pure function of the axis clamp and the spin, both fixed for the placement, and
|
||||
* Math.cos/Math.sin are pure, so every produced double is identical to the value the per-call form would have produced.
|
||||
*/
|
||||
public final class ObjectSpinKernel {
|
||||
private static final int MODE_NONE = 0;
|
||||
private static final int MODE_FLIP = 1;
|
||||
private static final int MODE_QUARTER = 2;
|
||||
private static final int MODE_THREE_QUARTER = 3;
|
||||
private static final int MODE_ANGLE = 4;
|
||||
|
||||
private final ObjectRotation rotation;
|
||||
|
||||
private final int xMode;
|
||||
private final int yMode;
|
||||
private final int zMode;
|
||||
private final double xCos;
|
||||
private final double xSin;
|
||||
private final double yCos;
|
||||
private final double ySin;
|
||||
private final double zCos;
|
||||
private final double zSin;
|
||||
|
||||
public ObjectSpinKernel(ObjectRotation rotation, int spinX, int spinY, int spinZ) {
|
||||
this.rotation = rotation;
|
||||
xMode = rotation.canRotateX() ? modeOf(rotation.xAxis()) : MODE_NONE;
|
||||
zMode = rotation.canRotateZ() ? modeOf(rotation.zAxis()) : MODE_NONE;
|
||||
yMode = rotation.canRotateY() ? modeOf(rotation.yAxis()) : MODE_NONE;
|
||||
double xAngle = xMode == MODE_ANGLE ? rotation.radians(rotation.xAxis(), spinX) : 0;
|
||||
double zAngle = zMode == MODE_ANGLE ? rotation.radians(rotation.zAxis(), spinZ) : 0;
|
||||
double yAngle = yMode == MODE_ANGLE ? rotation.radians(rotation.yAxis(), spinY) : 0;
|
||||
xCos = Math.cos(xAngle);
|
||||
xSin = Math.sin(xAngle);
|
||||
zCos = Math.cos(zAngle);
|
||||
zSin = Math.sin(zAngle);
|
||||
yCos = Math.cos(yAngle);
|
||||
ySin = Math.sin(yAngle);
|
||||
}
|
||||
|
||||
private static int modeOf(AxisRotationClamp clamp) {
|
||||
if (!clamp.isLocked()) {
|
||||
return MODE_ANGLE;
|
||||
}
|
||||
|
||||
if (Math.abs(clamp.max()) % 360D == 180D) {
|
||||
return MODE_FLIP;
|
||||
}
|
||||
|
||||
if (clamp.max() % 360D == 90D || clamp.max() % 360D == -270D) {
|
||||
return MODE_QUARTER;
|
||||
}
|
||||
|
||||
if (clamp.max() == -90D || clamp.max() % 360D == 270D) {
|
||||
return MODE_THREE_QUARTER;
|
||||
}
|
||||
|
||||
return MODE_ANGLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates in place. Axis order (X, then Z, then Y) is load bearing.
|
||||
*/
|
||||
public void rotate(IrisBlockVector v) {
|
||||
if (!rotation.canRotate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (xMode) {
|
||||
case MODE_FLIP -> {
|
||||
v.setZ(-v.getZ());
|
||||
v.setY(-v.getY());
|
||||
}
|
||||
case MODE_QUARTER -> {
|
||||
double z = v.getZ();
|
||||
v.setZ(v.getY());
|
||||
v.setY(-z);
|
||||
}
|
||||
case MODE_THREE_QUARTER -> {
|
||||
double z = v.getZ();
|
||||
v.setZ(-v.getY());
|
||||
v.setY(z);
|
||||
}
|
||||
case MODE_ANGLE -> {
|
||||
double y = xCos * v.getY() - xSin * v.getZ();
|
||||
double z = xSin * v.getY() + xCos * v.getZ();
|
||||
v.setY(y);
|
||||
v.setZ(z);
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
|
||||
switch (zMode) {
|
||||
case MODE_FLIP -> {
|
||||
v.setY(-v.getY());
|
||||
v.setX(-v.getX());
|
||||
}
|
||||
case MODE_QUARTER -> {
|
||||
double y = v.getY();
|
||||
v.setY(v.getX());
|
||||
v.setX(-y);
|
||||
}
|
||||
case MODE_THREE_QUARTER -> {
|
||||
double y = v.getY();
|
||||
v.setY(-v.getX());
|
||||
v.setX(y);
|
||||
}
|
||||
case MODE_ANGLE -> {
|
||||
double x = zCos * v.getX() - zSin * v.getY();
|
||||
double y = zSin * v.getX() + zCos * v.getY();
|
||||
v.setX(x);
|
||||
v.setY(y);
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
|
||||
switch (yMode) {
|
||||
case MODE_FLIP -> {
|
||||
v.setX(-v.getX());
|
||||
v.setZ(-v.getZ());
|
||||
}
|
||||
case MODE_QUARTER -> {
|
||||
double x = v.getX();
|
||||
v.setX(v.getZ());
|
||||
v.setZ(-x);
|
||||
}
|
||||
case MODE_THREE_QUARTER -> {
|
||||
double x = v.getX();
|
||||
v.setX(-v.getZ());
|
||||
v.setZ(x);
|
||||
}
|
||||
case MODE_ANGLE -> {
|
||||
double x = yCos * v.getX() + ySin * v.getZ();
|
||||
double z = -ySin * v.getX() + yCos * v.getZ();
|
||||
v.setX(x);
|
||||
v.setZ(z);
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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.builtin.prepare;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/** How far an object is shifted from where it would be placed, written as a placement's {@code translate}. */
|
||||
@Snippet("iris/prepare/object-translator")
|
||||
@Desc("Translate objects")
|
||||
public final class ObjectTranslate {
|
||||
@MinNumber(-128)
|
||||
@MaxNumber(128)
|
||||
@Desc("The x shift in blocks")
|
||||
private int x = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(-128)
|
||||
@MaxNumber(128)
|
||||
@Desc("The y shift in blocks")
|
||||
private int y = 0;
|
||||
|
||||
@MinNumber(-128)
|
||||
@MaxNumber(128)
|
||||
@Desc("Adds an additional amount of height randomly (translateY + rand(0 - yRandom))")
|
||||
private int yRandom = 0;
|
||||
|
||||
@MinNumber(-128)
|
||||
@MaxNumber(128)
|
||||
@Desc("The z shift in blocks")
|
||||
private int z = 0;
|
||||
|
||||
public ObjectTranslate() {
|
||||
}
|
||||
|
||||
/** A shift of the given size, as Iris's own translate model hands it to the placement stages. */
|
||||
public static ObjectTranslate of(int x, int y, int yRandom, int z) {
|
||||
ObjectTranslate translate = new ObjectTranslate();
|
||||
translate.x = x;
|
||||
translate.y = y;
|
||||
translate.yRandom = yRandom;
|
||||
translate.z = z;
|
||||
return translate;
|
||||
}
|
||||
|
||||
public boolean canTranslate() {
|
||||
return x != 0 || y != 0 || z != 0;
|
||||
}
|
||||
|
||||
public int x() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int y() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public int yRandom() {
|
||||
return yRandom;
|
||||
}
|
||||
|
||||
public int z() {
|
||||
return z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.builtin.prepare;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/** The terrain slopes an object placement, a decorator or a terrain layer may sit on, written as its {@code slopeCondition}. */
|
||||
@Snippet("iris/prepare/slope-clip")
|
||||
@Desc("Limits placement to a minimum and maximum terrain slope")
|
||||
public final class SlopeClip {
|
||||
private static final double DEFAULT_MINIMUM_SLOPE = 0;
|
||||
private static final double DEFAULT_MAXIMUM_SLOPE = 10;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The minimum slope for placement")
|
||||
private double minimumSlope = DEFAULT_MINIMUM_SLOPE;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The maximum slope for placement")
|
||||
private double maximumSlope = DEFAULT_MAXIMUM_SLOPE;
|
||||
|
||||
public SlopeClip() {
|
||||
}
|
||||
|
||||
public double minimumSlope() {
|
||||
return minimumSlope;
|
||||
}
|
||||
|
||||
public double maximumSlope() {
|
||||
return maximumSlope;
|
||||
}
|
||||
|
||||
/** Whether every slope passes. */
|
||||
public boolean isDefault() {
|
||||
return minimumSlope <= 0 && maximumSlope >= DEFAULT_MAXIMUM_SLOPE;
|
||||
}
|
||||
|
||||
public boolean isValid(double slope) {
|
||||
if (isDefault()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !(minimumSlope > slope) && !(maximumSlope < slope);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.builtin.prepare;
|
||||
|
||||
/** The bounds of a transformed object around its anchor, inclusive, widened by the surface warp along X and Z. */
|
||||
public record TransformedBounds(int minX, int maxX, int minY, int maxY, int minZ, int maxZ) {
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/**
|
||||
* A sound, particles, potion effect or commands that play now and then around the players in an area. The same
|
||||
* settings make the effect an entity shows when it appears ({@link EntityDefinition#spawnEffect()}).
|
||||
*/
|
||||
@Snippet("iris/spawn/effect")
|
||||
@Desc("An iris effect")
|
||||
public final class AmbientEffect {
|
||||
@Ref(Reference.POTION_EFFECT)
|
||||
@Desc("The potion effect to apply in this area")
|
||||
private String potionEffect = "";
|
||||
|
||||
@Desc("The particle effect to apply in the area")
|
||||
private String particleEffect = null;
|
||||
|
||||
@MinNumber(-32)
|
||||
@MaxNumber(32)
|
||||
@Desc("Randomly offset from the surface to this surface+value")
|
||||
private int particleOffset = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltX = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltY = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltZ = 0;
|
||||
|
||||
@Desc("Randomize the altX by -altX to altX")
|
||||
private boolean randomAltX = true;
|
||||
|
||||
@Desc("Randomize the altY by -altY to altY")
|
||||
private boolean randomAltY = false;
|
||||
|
||||
@Desc("Randomize the altZ by -altZ to altZ")
|
||||
private boolean randomAltZ = true;
|
||||
|
||||
@Desc("The sound to play")
|
||||
private String sound = null;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(512)
|
||||
@Desc("The max distance from the player the sound will play")
|
||||
private int soundDistance = 12;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.99)
|
||||
@Desc("The minimum sound pitch")
|
||||
private double minPitch = 0.5D;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.99)
|
||||
@Desc("The max sound pitch")
|
||||
private double maxPitch = 1.5D;
|
||||
|
||||
@MinNumber(0.001)
|
||||
@MaxNumber(512)
|
||||
@Desc("The sound volume.")
|
||||
private double volume = 1.5D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(512)
|
||||
@Desc("The particle count. Try setting to zero for using the alt xyz to a motion value instead of an offset")
|
||||
private int particleCount = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("How far away from the player particles can play")
|
||||
private int particleDistance = 20;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@Desc("How wide the particles can play (player's view left and right) RADIUS")
|
||||
private int particleDistanceWidth = 24;
|
||||
|
||||
@Desc("An extra value for some particles... Which bukkit doesn't even document.")
|
||||
private double extra = 0;
|
||||
|
||||
@MinNumber(-1)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The Potion Strength or -1 to disable")
|
||||
private int potionStrength = -1;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The max time the potion will last for")
|
||||
private int potionTicksMax = 155;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The min time the potion will last for")
|
||||
private int potionTicksMin = 75;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@Desc("The effect interval in milliseconds")
|
||||
private int interval = 150;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(16)
|
||||
@Desc("The effect distance start away")
|
||||
private int particleAway = 5;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@Desc("The chance is 1 in CHANCE per interval")
|
||||
private int chance = 50;
|
||||
|
||||
@Desc("Run commands, with configurable location parameters")
|
||||
private EffectCommands commandRegistry = null;
|
||||
|
||||
public AmbientEffect() {
|
||||
}
|
||||
|
||||
public String potionEffect() {
|
||||
return potionEffect;
|
||||
}
|
||||
|
||||
public String particleEffect() {
|
||||
return particleEffect;
|
||||
}
|
||||
|
||||
public int particleOffset() {
|
||||
return particleOffset;
|
||||
}
|
||||
|
||||
public double particleAltX() {
|
||||
return particleAltX;
|
||||
}
|
||||
|
||||
public double particleAltY() {
|
||||
return particleAltY;
|
||||
}
|
||||
|
||||
public double particleAltZ() {
|
||||
return particleAltZ;
|
||||
}
|
||||
|
||||
public boolean randomAltX() {
|
||||
return randomAltX;
|
||||
}
|
||||
|
||||
public boolean randomAltY() {
|
||||
return randomAltY;
|
||||
}
|
||||
|
||||
public boolean randomAltZ() {
|
||||
return randomAltZ;
|
||||
}
|
||||
|
||||
public String sound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
public int soundDistance() {
|
||||
return soundDistance;
|
||||
}
|
||||
|
||||
public double minPitch() {
|
||||
return minPitch;
|
||||
}
|
||||
|
||||
public double maxPitch() {
|
||||
return maxPitch;
|
||||
}
|
||||
|
||||
public double volume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public int particleCount() {
|
||||
return particleCount;
|
||||
}
|
||||
|
||||
public int particleDistance() {
|
||||
return particleDistance;
|
||||
}
|
||||
|
||||
public int particleDistanceWidth() {
|
||||
return particleDistanceWidth;
|
||||
}
|
||||
|
||||
public double extra() {
|
||||
return extra;
|
||||
}
|
||||
|
||||
public int potionStrength() {
|
||||
return potionStrength;
|
||||
}
|
||||
|
||||
public int potionTicksMax() {
|
||||
return potionTicksMax;
|
||||
}
|
||||
|
||||
public int potionTicksMin() {
|
||||
return potionTicksMin;
|
||||
}
|
||||
|
||||
public int interval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public int particleAway() {
|
||||
return particleAway;
|
||||
}
|
||||
|
||||
public int chance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
/** The commands the effect runs; null for none. */
|
||||
public EffectCommands commandRegistry() {
|
||||
return commandRegistry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("iris/spawn/command-registry")
|
||||
@Desc("Represents a casting location for a command")
|
||||
public final class EffectCommands {
|
||||
@Required
|
||||
@Desc("Run commands, at the exact location of the player")
|
||||
private List<SpawnCommand> rawCommands = List.of();
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetX = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetY = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetZ = 0;
|
||||
|
||||
@Desc("Randomize the altX from -altX to altX")
|
||||
private boolean commandRandomAltX = true;
|
||||
|
||||
@Desc("Randomize the altY from -altY to altY")
|
||||
private boolean commandRandomAltY = false;
|
||||
|
||||
@Desc("Randomize the altZ from -altZ to altZ")
|
||||
private boolean commandRandomAltZ = true;
|
||||
|
||||
@Desc("Randomize location for all separate commands (true), or run all on the same location (false)")
|
||||
private boolean commandAllRandomLocations = true;
|
||||
|
||||
public EffectCommands() {
|
||||
}
|
||||
|
||||
public List<SpawnCommand> rawCommands() {
|
||||
return rawCommands == null ? List.of() : Collections.unmodifiableList(rawCommands);
|
||||
}
|
||||
|
||||
public double commandOffsetX() {
|
||||
return commandOffsetX;
|
||||
}
|
||||
|
||||
public double commandOffsetY() {
|
||||
return commandOffsetY;
|
||||
}
|
||||
|
||||
public double commandOffsetZ() {
|
||||
return commandOffsetZ;
|
||||
}
|
||||
|
||||
public boolean commandRandomAltX() {
|
||||
return commandRandomAltX;
|
||||
}
|
||||
|
||||
public boolean commandRandomAltY() {
|
||||
return commandRandomAltY;
|
||||
}
|
||||
|
||||
public boolean commandRandomAltZ() {
|
||||
return commandRandomAltZ;
|
||||
}
|
||||
|
||||
public boolean commandAllRandomLocations() {
|
||||
return commandAllRandomLocations;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.builtin.loot.ItemAttributeModifier;
|
||||
import art.arcane.iris.builtin.loot.LootEntry;
|
||||
import art.arcane.iris.builtin.loot.LootSettings;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** An entity of the pack, one file of {@code entities/}: what spawners and markers spawn, with its equipment, attributes, passengers and loot. */
|
||||
@Desc("Represents an iris entity.")
|
||||
public final class EntityDefinition {
|
||||
@Required
|
||||
@Ref(Reference.ENTITY)
|
||||
@Desc("The namespaced key of the entity type to spawn, such as minecraft:zombie or alexsmobs:grizzly_bear. To spawn a mob from another plugin or provider, set this type to unknown and define the special type.")
|
||||
private String type = null;
|
||||
|
||||
@Desc("The SpawnReason name to spawn the entity with, such as NATURAL or COMMAND.")
|
||||
private String reason = null;
|
||||
|
||||
@Desc("The custom name of this entity")
|
||||
private String customName = "";
|
||||
|
||||
@Desc("Should the name on this entity be visible even if you arent looking at it.")
|
||||
private boolean customNameVisible = false;
|
||||
|
||||
@Desc("If this entity type is a mob, should it be aware of it's surroundings & interact with the world.")
|
||||
private boolean aware = true;
|
||||
|
||||
@Desc("If this entity type is a creature, should it have ai goals.")
|
||||
private boolean ai = true;
|
||||
|
||||
@Desc("Should this entity be glowing")
|
||||
private boolean glowing = false;
|
||||
|
||||
@Desc("Should gravity apply to this entity")
|
||||
private boolean gravity = true;
|
||||
|
||||
@Desc("When an entity is invulnerable it can only be damaged by players increative mode.")
|
||||
private boolean invulnerable = false;
|
||||
|
||||
@Desc("When an entity is silent it will not produce any sound.")
|
||||
private boolean silent = false;
|
||||
|
||||
@Desc("Should this entity be allowed to pickup items")
|
||||
private boolean pickupItems = false;
|
||||
|
||||
@Desc("Should this entity be removed when far away")
|
||||
private boolean removable = false;
|
||||
|
||||
@Desc("Entity helmet equipment")
|
||||
private LootEntry helmet = null;
|
||||
|
||||
@Desc("Entity chestplate equipment")
|
||||
private LootEntry chestplate = null;
|
||||
|
||||
@Desc("Entity boots equipment")
|
||||
private LootEntry boots = null;
|
||||
|
||||
@Desc("Entity leggings equipment")
|
||||
private LootEntry leggings = null;
|
||||
|
||||
@Desc("Entity main hand equipment")
|
||||
private LootEntry mainHand = null;
|
||||
|
||||
@Desc("Entity off hand equipment")
|
||||
private LootEntry offHand = null;
|
||||
|
||||
@Desc("Make other entities ride this entity")
|
||||
private List<EntityDefinition> passengers = List.of();
|
||||
|
||||
@Desc("Attribute modifiers for this entity")
|
||||
private List<ItemAttributeModifier> attributes = List.of();
|
||||
|
||||
@Desc("Loot tables for drops. Only the tables list is honored for entities; mode and multiplier are ignored, and the tables replace vanilla drops entirely.")
|
||||
private LootSettings loot = new LootSettings();
|
||||
|
||||
@Desc("If specified, this entity will be leashed by this entity. I.e. THIS ENTITY Leashed by SPECIFIED. This has no effect on EnderDragons, Withers, Players, or Bats.Non-living entities excluding leashes will not persist as leashholders.")
|
||||
private EntityDefinition leashHolder = null;
|
||||
|
||||
@Desc("If specified, this entity will spawn with an effect")
|
||||
private AmbientEffect spawnEffect = null;
|
||||
|
||||
@Desc("Simply moves the entity from below the surface slowly out of the ground as a spawn-in effect")
|
||||
private boolean spawnEffectRiseOutOfGround = false;
|
||||
|
||||
@Desc("The main gene for a panda if the entity type is a panda. One of NORMAL, LAZY, WORRIED, PLAYFUL, BROWN, WEAK or AGGRESSIVE.")
|
||||
private String pandaMainGene = null;
|
||||
|
||||
@Desc("The hidden gene for a panda if the entity type is a panda. One of NORMAL, LAZY, WORRIED, PLAYFUL, BROWN, WEAK or AGGRESSIVE.")
|
||||
private String pandaHiddenGene = null;
|
||||
|
||||
@Desc("The this entity is ageable, set it's baby status")
|
||||
private boolean baby = false;
|
||||
|
||||
@Desc("If the entity should never be culled.")
|
||||
private boolean keepEntity = false;
|
||||
|
||||
@Desc("The surface type to spawn this mob on")
|
||||
private SpawnSurface surface = SpawnSurface.LAND;
|
||||
|
||||
@Ref(Reference.SPECIAL_ENTITY)
|
||||
@Desc("Create a mob from another plugin, such as Mythic Mobs. Should be in the format of a namespace of PluginName:MobName")
|
||||
private String specialType = "";
|
||||
|
||||
@Desc("Set to true if you want to apply all of the settings here to the mob, even though an external plugin has already done so.")
|
||||
private boolean applySettingsToCustomMobAnyways = false;
|
||||
|
||||
@Desc("Run raw commands when this entity is spawned. Use {x}, {y}, and {z} for location. /summon pig {x} {y} {z}")
|
||||
private List<SpawnCommand> rawCommands = List.of();
|
||||
|
||||
public EntityDefinition() {
|
||||
}
|
||||
|
||||
public String type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String reason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public String customName() {
|
||||
return customName;
|
||||
}
|
||||
|
||||
public boolean customNameVisible() {
|
||||
return customNameVisible;
|
||||
}
|
||||
|
||||
public boolean aware() {
|
||||
return aware;
|
||||
}
|
||||
|
||||
public boolean ai() {
|
||||
return ai;
|
||||
}
|
||||
|
||||
public boolean glowing() {
|
||||
return glowing;
|
||||
}
|
||||
|
||||
public boolean gravity() {
|
||||
return gravity;
|
||||
}
|
||||
|
||||
public boolean invulnerable() {
|
||||
return invulnerable;
|
||||
}
|
||||
|
||||
public boolean silent() {
|
||||
return silent;
|
||||
}
|
||||
|
||||
public boolean pickupItems() {
|
||||
return pickupItems;
|
||||
}
|
||||
|
||||
public boolean removable() {
|
||||
return removable;
|
||||
}
|
||||
|
||||
public LootEntry helmet() {
|
||||
return helmet;
|
||||
}
|
||||
|
||||
public LootEntry chestplate() {
|
||||
return chestplate;
|
||||
}
|
||||
|
||||
public LootEntry boots() {
|
||||
return boots;
|
||||
}
|
||||
|
||||
public LootEntry leggings() {
|
||||
return leggings;
|
||||
}
|
||||
|
||||
public LootEntry mainHand() {
|
||||
return mainHand;
|
||||
}
|
||||
|
||||
public LootEntry offHand() {
|
||||
return offHand;
|
||||
}
|
||||
|
||||
public List<EntityDefinition> passengers() {
|
||||
return passengers == null ? List.of() : Collections.unmodifiableList(passengers);
|
||||
}
|
||||
|
||||
public List<ItemAttributeModifier> attributes() {
|
||||
return attributes == null ? List.of() : Collections.unmodifiableList(attributes);
|
||||
}
|
||||
|
||||
/** The loot the entity drops when it dies; only its tables count. */
|
||||
public LootSettings loot() {
|
||||
return loot == null ? new LootSettings() : loot;
|
||||
}
|
||||
|
||||
public EntityDefinition leashHolder() {
|
||||
return leashHolder;
|
||||
}
|
||||
|
||||
public AmbientEffect spawnEffect() {
|
||||
return spawnEffect;
|
||||
}
|
||||
|
||||
public boolean spawnEffectRiseOutOfGround() {
|
||||
return spawnEffectRiseOutOfGround;
|
||||
}
|
||||
|
||||
public String pandaMainGene() {
|
||||
return pandaMainGene;
|
||||
}
|
||||
|
||||
public String pandaHiddenGene() {
|
||||
return pandaHiddenGene;
|
||||
}
|
||||
|
||||
public boolean baby() {
|
||||
return baby;
|
||||
}
|
||||
|
||||
public boolean keepEntity() {
|
||||
return keepEntity;
|
||||
}
|
||||
|
||||
public SpawnSurface surface() {
|
||||
return surface == null ? SpawnSurface.LAND : surface;
|
||||
}
|
||||
|
||||
public String specialType() {
|
||||
return specialType;
|
||||
}
|
||||
|
||||
/** Whether the entity is a mob of another plugin. */
|
||||
public boolean isSpecialType() {
|
||||
return specialType != null && !specialType.isEmpty();
|
||||
}
|
||||
|
||||
public boolean applySettingsToCustomMobAnyways() {
|
||||
return applySettingsToCustomMobAnyways;
|
||||
}
|
||||
|
||||
public List<SpawnCommand> rawCommands() {
|
||||
return rawCommands == null ? List.of() : Collections.unmodifiableList(rawCommands);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("iris/spawn/entity-spawn")
|
||||
@Desc("Represents an entity spawn during initial chunk generation")
|
||||
public final class EntitySpawn {
|
||||
@ResourceRef(EntityDefinition.class)
|
||||
@Required
|
||||
@Desc("The entity")
|
||||
private String entity = "";
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The 1 in RARITY chance for this entity to spawn")
|
||||
private int rarity = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The minumum of this entity to spawn")
|
||||
private int minSpawns = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The max of this entity to spawn")
|
||||
private int maxSpawns = 1;
|
||||
|
||||
public EntitySpawn() {
|
||||
}
|
||||
|
||||
/** The key of the entity of the pack. */
|
||||
public String entity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public int rarity() {
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public int minSpawns() {
|
||||
return minSpawns;
|
||||
}
|
||||
|
||||
public int maxSpawns() {
|
||||
return maxSpawns;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** Blocks of an object placement that get a {@link SpawnMarker}, an entry of the placement's {@code markers}. */
|
||||
@Snippet("iris/spawn/object-marker")
|
||||
@Desc("Find blocks to mark")
|
||||
public final class PlacementMarker {
|
||||
@Required
|
||||
@Desc("Find block types to mark")
|
||||
private List<BlockSpec> mark = List.of();
|
||||
@MinNumber(1)
|
||||
@MaxNumber(16)
|
||||
@Desc("The maximum amount of markers to place. Use these sparingly!")
|
||||
private int maximumMarkers = 8;
|
||||
@Desc("If true, markers will only be placed if the block matches the mark list perfectly.")
|
||||
private boolean exact = false;
|
||||
@Required
|
||||
@ResourceRef(SpawnMarker.class)
|
||||
@Desc("The marker to add")
|
||||
private String marker;
|
||||
|
||||
public PlacementMarker() {
|
||||
}
|
||||
|
||||
/** The blocks that get a marker. */
|
||||
public List<BlockSpec> mark() {
|
||||
return mark == null ? List.of() : Collections.unmodifiableList(mark);
|
||||
}
|
||||
|
||||
public int maximumMarkers() {
|
||||
return maximumMarkers;
|
||||
}
|
||||
|
||||
public boolean exact() {
|
||||
return exact;
|
||||
}
|
||||
|
||||
/** The key of the {@link SpawnMarker} to place. */
|
||||
public String marker() {
|
||||
return marker;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("iris/spawn/command")
|
||||
@Desc("Represents a set of Iris commands")
|
||||
public final class SpawnCommand {
|
||||
@Required
|
||||
@Desc("List of commands. Iris replaces {x} {y} and {z} with the location of the entity spawn")
|
||||
private List<String> commands = List.of();
|
||||
|
||||
@Desc("The delay for running the command. Instant by default")
|
||||
private long delay = 0;
|
||||
|
||||
@Desc("If this should be repeated (indefinitely, cannot be cancelled). This does not persist with server-restarts, so it only repeats when the chunk is generated.")
|
||||
private boolean repeat = false;
|
||||
|
||||
@Desc("The delay between repeats, in server ticks (by default 100, so 5 seconds)")
|
||||
private long repeatDelay = 100;
|
||||
|
||||
@Desc("The block of 24 hour time in which the command should execute.")
|
||||
private SpawnTimeBlock timeBlock = new SpawnTimeBlock();
|
||||
|
||||
@Desc("The weather that is required for the command to execute.")
|
||||
private SpawnWeather weather = SpawnWeather.ANY;
|
||||
|
||||
public SpawnCommand() {
|
||||
}
|
||||
|
||||
public List<String> commands() {
|
||||
return commands == null ? List.of() : Collections.unmodifiableList(commands);
|
||||
}
|
||||
|
||||
public long delay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
public boolean repeat() {
|
||||
return repeat;
|
||||
}
|
||||
|
||||
public long repeatDelay() {
|
||||
return repeatDelay;
|
||||
}
|
||||
|
||||
public SpawnTimeBlock timeBlock() {
|
||||
return timeBlock == null ? new SpawnTimeBlock() : timeBlock;
|
||||
}
|
||||
|
||||
public SpawnWeather weather() {
|
||||
return weather == null ? SpawnWeather.ANY : weather;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Snippet("iris/spawn/duration")
|
||||
@Desc("Represents a combined duration. Fill each property to add time into a single duration")
|
||||
public final class SpawnDuration {
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_TICK = 50L;
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_HOUR = 50_000L;
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_DAY = 1_200_000L;
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_WEEK = 8_400_000L;
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_LUNAR_CYCLE = 9_600_000L;
|
||||
|
||||
@Desc("Milliseconds (1000ms = 1 second)")
|
||||
private int milliseconds = 0;
|
||||
|
||||
@Desc("Minecraft Ticks (20 minecraft ticks = 1 second)")
|
||||
private int minecraftTicks = 0;
|
||||
|
||||
@Desc("Seconds (60 seconds = 1 minute)")
|
||||
private int seconds = 0;
|
||||
|
||||
@Desc("Minutes (60 minutes = 1 hour)")
|
||||
private int minutes = 0;
|
||||
|
||||
@Desc("Minecraft Hours (about 50 real seconds)")
|
||||
private int minecraftHours = 0;
|
||||
|
||||
@Desc("Hours (24 hours = 1 day)")
|
||||
private int hours = 0;
|
||||
|
||||
@Desc("Minecraft Days (1 minecraft day = 20 real minutes)")
|
||||
private int minecraftDays = 0;
|
||||
|
||||
@Desc("Minecraft Weeks (7 minecraft days = 2 real hours and 20 real minutes)")
|
||||
private int minecraftWeeks = 0;
|
||||
|
||||
@Desc("Minecraft Lunar Cycles (8 minecraft days = 2 real hours and 40 real minutes)")
|
||||
private int minecraftLunarCycles = 0;
|
||||
|
||||
@Desc("REAL (not minecraft) Days")
|
||||
private int days = 0;
|
||||
|
||||
public SpawnDuration() {
|
||||
}
|
||||
|
||||
public long toMilliseconds() {
|
||||
return milliseconds
|
||||
+ TimeUnit.SECONDS.toMillis(seconds)
|
||||
+ TimeUnit.MINUTES.toMillis(minutes)
|
||||
+ TimeUnit.HOURS.toMillis(hours)
|
||||
+ TimeUnit.DAYS.toMillis(days)
|
||||
+ (minecraftTicks * MILLISECONDS_PER_MINECRAFT_TICK)
|
||||
+ (minecraftHours * MILLISECONDS_PER_MINECRAFT_HOUR)
|
||||
+ (minecraftDays * MILLISECONDS_PER_MINECRAFT_DAY)
|
||||
+ (minecraftWeeks * MILLISECONDS_PER_MINECRAFT_WEEK)
|
||||
+ (minecraftLunarCycles * MILLISECONDS_PER_MINECRAFT_LUNAR_CYCLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Terrain modes are used to decide the generator type currently used")
|
||||
public enum SpawnGroup {
|
||||
@Desc("Spawns on the terrain surface")
|
||||
NORMAL,
|
||||
|
||||
@Desc("Spawns in cave-air and low light level areas")
|
||||
CAVE,
|
||||
|
||||
@Desc("Spawns underwater")
|
||||
UNDERWATER,
|
||||
|
||||
@Desc("Spawns in beaches")
|
||||
BEACH
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.ResourceRef;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** A marker of the pack, one file of {@code markers/}: object placements put markers in the world and a marker names the spawners that fire there. */
|
||||
@Desc("Represents a marker")
|
||||
public final class SpawnMarker {
|
||||
@Desc("A list of spawners to add to anywhere this marker is.")
|
||||
@ResourceRef(Spawner.class)
|
||||
private List<String> spawners = List.of();
|
||||
|
||||
@Desc("Remove this marker when the block it's assigned to is changed.")
|
||||
private boolean removeOnChange = true;
|
||||
|
||||
@Desc("If true, markers will only be placed here if there is 2 air blocks above it.")
|
||||
private boolean emptyAbove = true;
|
||||
|
||||
@Desc("If this marker is used, what is the chance it removes itself. For example 25% (0.25) would mean that on average 4 uses will remove a specific marker. Set this below 0 (-1) to never exhaust & set this to 1 or higher to always exhaust on first use.")
|
||||
private double exhaustionChance = 0;
|
||||
|
||||
public SpawnMarker() {
|
||||
}
|
||||
|
||||
/** The keys of the spawners that fire at the marker. */
|
||||
public List<String> spawners() {
|
||||
return spawners == null ? List.of() : Collections.unmodifiableList(spawners);
|
||||
}
|
||||
|
||||
public boolean removeOnChange() {
|
||||
return removeOnChange;
|
||||
}
|
||||
|
||||
public boolean emptyAbove() {
|
||||
return emptyAbove;
|
||||
}
|
||||
|
||||
public double exhaustionChance() {
|
||||
return exhaustionChance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("iris/spawn/rate")
|
||||
@Desc("Represents a count of something per time duration")
|
||||
public final class SpawnRate {
|
||||
@Desc("The amount of things. Leave 0 for infinite (meaning always spawn whenever)")
|
||||
private int amount = 0;
|
||||
|
||||
@Desc("The time interval. Leave blank for infinite 0 (meaning always spawn all the time)")
|
||||
private SpawnDuration per = new SpawnDuration();
|
||||
|
||||
public SpawnRate() {
|
||||
}
|
||||
|
||||
/** The milliseconds between two things: the interval divided by the amount, at least 1. */
|
||||
public long interval() {
|
||||
long t = duration().toMilliseconds() / (amount == 0 ? 1 : amount);
|
||||
return Math.abs(t <= 0 ? 1 : t);
|
||||
}
|
||||
|
||||
/** Whether there is no limit: no interval was given. */
|
||||
public boolean isInfinite() {
|
||||
return duration().toMilliseconds() == 0;
|
||||
}
|
||||
|
||||
private SpawnDuration duration() {
|
||||
return per == null ? new SpawnDuration() : per;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("The type of surface entities should spawn on")
|
||||
public enum SpawnSurface {
|
||||
|
||||
@Desc("Land surfaces")
|
||||
LAND,
|
||||
|
||||
@Desc("Any surfaces animals can spawn on, such as dirt, grass and podzol")
|
||||
ANIMAL,
|
||||
|
||||
@Desc("Within the water")
|
||||
WATER,
|
||||
|
||||
@Desc("On land or on water")
|
||||
OVERWORLD,
|
||||
|
||||
@Desc("Within lava")
|
||||
LAVA
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("iris/spawn/time-block")
|
||||
@Desc("Represents a time of day (24h time, not 12h am/pm). Set both to the same number for any time. If they are both set to -1, it will always be not allowed.")
|
||||
public final class SpawnTimeBlock {
|
||||
private static final double NEVER = -1;
|
||||
|
||||
@Desc("The beginning hour. Set both to the same number for any time. If they are both set to -1, it will always be not allowed.")
|
||||
private double startHour = 0;
|
||||
|
||||
@Desc("The ending hour. Set both to the same number for any time. If they are both set to -1, it will always be not allowed.")
|
||||
private double endHour = 0;
|
||||
|
||||
public SpawnTimeBlock() {
|
||||
}
|
||||
|
||||
/** Whether {@code hour}, a time of day from 0 to 24, lies in the block; a block that wraps past midnight includes both ends. */
|
||||
public boolean contains(double hour) {
|
||||
if (startHour == endHour) {
|
||||
return endHour != NEVER;
|
||||
}
|
||||
|
||||
if (startHour > endHour) {
|
||||
return hour >= startHour || hour <= endHour;
|
||||
}
|
||||
|
||||
return hour >= startHour && hour <= endHour;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Represents a weather type")
|
||||
public enum SpawnWeather {
|
||||
@Desc("Represents when weather is not causing downfall")
|
||||
NONE,
|
||||
|
||||
@Desc("Represents rain or snow")
|
||||
DOWNFALL,
|
||||
|
||||
@Desc("Represents rain or snow with thunder")
|
||||
DOWNFALL_WITH_THUNDER,
|
||||
|
||||
@Desc("Any weather")
|
||||
ANY;
|
||||
|
||||
/** Whether the weather of a world, which is {@code storming} and {@code thundering} or neither, is this one. */
|
||||
public boolean matches(boolean storming, boolean thundering) {
|
||||
return switch (this) {
|
||||
case NONE -> !storming && !thundering;
|
||||
case DOWNFALL -> storming;
|
||||
case DOWNFALL_WITH_THUNDER -> storming && thundering;
|
||||
case ANY -> true;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Range;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** A spawner of the pack, one file of {@code spawners/}: which entities appear where, when and how often. */
|
||||
@Desc("Represents an entity spawn during initial chunk generation")
|
||||
public final class Spawner {
|
||||
@Desc("The entity spawns to add")
|
||||
private List<EntitySpawn> spawns = List.of();
|
||||
|
||||
@Desc("The entity spawns to add initially. EXECUTES PER CHUNK!")
|
||||
private List<EntitySpawn> initialSpawns = List.of();
|
||||
|
||||
@Desc("This spawner will not spawn in a given chunk if that chunk has more than the defined amount of living entities.")
|
||||
private int maxEntitiesPerChunk = 1;
|
||||
|
||||
@Desc("The block of 24 hour time to contain this spawn in.")
|
||||
private SpawnTimeBlock timeBlock = new SpawnTimeBlock();
|
||||
|
||||
@Desc("The weather condition required for this spawner to fire.")
|
||||
private SpawnWeather weather = SpawnWeather.ANY;
|
||||
|
||||
@Desc("The maximum rate this spawner can fire")
|
||||
private SpawnRate maximumRate = new SpawnRate();
|
||||
|
||||
@Desc("The maximum rate this spawner can fire on a specific chunk")
|
||||
private SpawnRate maximumRatePerChunk = new SpawnRate();
|
||||
|
||||
@Desc("The light levels this spawn is allowed to run in (0-15 inclusive)")
|
||||
private Range allowedLightLevels = Range.of(0, 15);
|
||||
|
||||
@Desc("Where should these spawns be placed")
|
||||
private SpawnGroup group = SpawnGroup.NORMAL;
|
||||
|
||||
public Spawner() {
|
||||
}
|
||||
|
||||
public List<EntitySpawn> spawns() {
|
||||
return spawns == null ? List.of() : Collections.unmodifiableList(spawns);
|
||||
}
|
||||
|
||||
public List<EntitySpawn> initialSpawns() {
|
||||
return initialSpawns == null ? List.of() : Collections.unmodifiableList(initialSpawns);
|
||||
}
|
||||
|
||||
public int maxEntitiesPerChunk() {
|
||||
return maxEntitiesPerChunk;
|
||||
}
|
||||
|
||||
public SpawnTimeBlock timeBlock() {
|
||||
return timeBlock == null ? new SpawnTimeBlock() : timeBlock;
|
||||
}
|
||||
|
||||
public SpawnWeather weather() {
|
||||
return weather == null ? SpawnWeather.ANY : weather;
|
||||
}
|
||||
|
||||
public SpawnRate maximumRate() {
|
||||
return maximumRate == null ? new SpawnRate() : maximumRate;
|
||||
}
|
||||
|
||||
public SpawnRate maximumRatePerChunk() {
|
||||
return maximumRatePerChunk == null ? new SpawnRate() : maximumRatePerChunk;
|
||||
}
|
||||
|
||||
public Range allowedLightLevels() {
|
||||
return allowedLightLevels == null ? Range.of(0, 15) : allowedLightLevels;
|
||||
}
|
||||
|
||||
public SpawnGroup group() {
|
||||
return group == null ? SpawnGroup.NORMAL : group;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.builtin.stilt;
|
||||
|
||||
import com.volmit.object.ObjectBlock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The bottom and top layers of the blocks a stilt can repeat, with their positions already transformed
|
||||
* around the anchor. Each layer keeps the blocks at its lowest or highest height seen so far.
|
||||
*/
|
||||
public final class StiltLayers {
|
||||
private final List<ObjectBlock> bottom = new ArrayList<>();
|
||||
private final List<ObjectBlock> top = new ArrayList<>();
|
||||
private int bottomY = Integer.MAX_VALUE;
|
||||
private int topY = Integer.MIN_VALUE;
|
||||
|
||||
public void include(ObjectBlock transformed) {
|
||||
int y = transformed.position().y();
|
||||
if (y < bottomY) {
|
||||
bottomY = y;
|
||||
bottom.clear();
|
||||
}
|
||||
if (y == bottomY) {
|
||||
bottom.add(transformed);
|
||||
}
|
||||
if (y > topY) {
|
||||
topY = y;
|
||||
top.clear();
|
||||
}
|
||||
if (y == topY) {
|
||||
top.add(transformed);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return bottom.isEmpty();
|
||||
}
|
||||
|
||||
public List<ObjectBlock> bottom() {
|
||||
return Collections.unmodifiableList(bottom);
|
||||
}
|
||||
|
||||
public List<ObjectBlock> top() {
|
||||
return Collections.unmodifiableList(top);
|
||||
}
|
||||
|
||||
public int bottomY() {
|
||||
return bottomY;
|
||||
}
|
||||
|
||||
public int topY() {
|
||||
return topY;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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.builtin.stilt;
|
||||
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/** How far and with which blocks an object stilts into the ground, written as the placement's {@code stiltSettings}. */
|
||||
@Snippet("iris/stilt/stilt-settings")
|
||||
@Desc("Defines stilting behaviour.")
|
||||
public final class StiltSettings {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("Defines the maximum amount of blocks the object stilts verticially before overstilting and randomRange.")
|
||||
private int yMax;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("Defines the upper boundary for additional blocks after overstilting and/or maxStiltRange.")
|
||||
private int yRand;
|
||||
@MaxNumber(64)
|
||||
@MinNumber(0)
|
||||
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
|
||||
private int overStilt;
|
||||
@Desc("If defined, stilting will be done using this block palette rather than the last layer of the object.")
|
||||
private PaletteSpec palette;
|
||||
@MinNumber(1)
|
||||
@MaxNumber(256)
|
||||
@Desc("For ORGANIC_STILT / CEILING_HANG: the maximum number of blocks to scan toward the cave floor (or ceiling) looking for solid ground before giving up.")
|
||||
private int organicMaxScan = 48;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(32)
|
||||
@Desc("For ORGANIC_STILT / CEILING_HANG: the maximum number of blocks each column's stilt is randomly shortened by, giving the underside a ragged organic edge instead of a flat disc.")
|
||||
private int organicJitter = 3;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("For ORGANIC_STILT / CEILING_HANG: in the deepest fraction of each stilt column, blocks are randomly skipped to break the tip up. Higher = more broken and scratchy. 0 disables.")
|
||||
private double organicScratch = 0.55;
|
||||
|
||||
public StiltSettings() {
|
||||
}
|
||||
|
||||
public int yMax() {
|
||||
return yMax;
|
||||
}
|
||||
|
||||
public int yRand() {
|
||||
return yRand;
|
||||
}
|
||||
|
||||
public int overStilt() {
|
||||
return overStilt;
|
||||
}
|
||||
|
||||
public Optional<PaletteSpec> palette() {
|
||||
return Optional.ofNullable(palette);
|
||||
}
|
||||
|
||||
public int organicMaxScan() {
|
||||
return organicMaxScan;
|
||||
}
|
||||
|
||||
public int organicJitter() {
|
||||
return organicJitter;
|
||||
}
|
||||
|
||||
public double organicScratch() {
|
||||
return organicScratch;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Iris extension: says that a text option names structures of Iris's structure model by key, which Iris completes in
|
||||
* studio and carries along when it exports the pack. The structure model is Iris's own resource kind, whose class a
|
||||
* module cannot see, so {@code @ResourceRef} cannot name it; to another host the option is plain text.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface IrisStructureRef {
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.vanilla.JigsawOverrides;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* One platform structure a structure placement starts itself, written as
|
||||
* {@code {"structure": "minecraft:ancient_city", "weight": 2, "jigsaw": {...}}}. IrisApi types only.
|
||||
*/
|
||||
@Desc("A live vanilla, datapack, or modded structure generated by Minecraft at an Iris-controlled placement.")
|
||||
public final class NativeStructureSource {
|
||||
@Required
|
||||
@Ref(Reference.STRUCTURE)
|
||||
@Desc("Registered structure key. The source retains its native generator, pieces, templates, processors, entities, markers, and data.")
|
||||
private String structure = "";
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("Relative selection weight when a placement offers multiple native structure sources.")
|
||||
private int weight = 1;
|
||||
|
||||
@Desc("Optional jigsaw-only assembly overrides. Null preserves the complete registered structure definition.")
|
||||
private JigsawOverrides jigsaw = null;
|
||||
|
||||
public NativeStructureSource() {
|
||||
}
|
||||
|
||||
/** The registry key of the platform structure, as the pack wrote it. */
|
||||
public String structure() {
|
||||
return structure;
|
||||
}
|
||||
|
||||
public int weight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
/** The overrides of the platform's jigsaw assembly; empty to keep its own. */
|
||||
public Optional<JigsawOverrides> jigsaw() {
|
||||
return Optional.ofNullable(jigsaw);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
/** Whether a structure placement replaces the platform structure its structures stand in for. */
|
||||
@Desc("Controls whether an Iris structure placement suppresses its imported native source.")
|
||||
public enum NativeStructureSuppression {
|
||||
@Desc("Leaves native generation enabled alongside this Iris structure placement.")
|
||||
NONE,
|
||||
|
||||
@Desc("Suppresses the structure's vanillaSource when used by a validated dimension-level replacement placement.")
|
||||
REPLACE_SOURCE
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/** One entry of {@link StructureSettings#adjustments()}: how the platform's own starts of the structures it matches are moved and fitted. */
|
||||
@Desc("A per-structure adjustment applied to vanilla, mod, and datapack structures that still generate natively (those NOT suppressed by an Iris 'structures' placement). Vertical shifts move the structure start, pieces, bounds, and jigsaw metadata together before references and placement. Intersecting trees are cleared automatically inside structure piece envelopes; optional postprocessing can build palette-driven foundation columns.")
|
||||
public final class StructureAdjustment {
|
||||
@Ref(Reference.STRUCTURE_PREFIX)
|
||||
@Desc("Structure keys this adjustment applies to, e.g. 'minecraft:stronghold'. A namespace:path prefix also matches, so 'minecraft:village' adjusts every village variant and 'minecraft:ruined_portal' adjusts every ruined portal. Empty matches nothing.")
|
||||
private List<String> match = List.of();
|
||||
|
||||
@MinNumber(-512)
|
||||
@MaxNumber(512)
|
||||
@Desc("Vertical block offset. Negative pushes the structure down, positive lifts it. The resolved shift is clamped so the structure remains inside the world's vertical build bounds.")
|
||||
private int yShift = 0;
|
||||
|
||||
@Desc("Optional absolute world Y band. The structure is relocated so its vertical midpoint lands inside the band, deterministically from its start chunk and clamped to the world's build bounds. Precedence: preserveSourceY wins over yBand, and yBand wins over both yShift and Iris burial repositioning. Structures with a fixed vanilla alignment (ocean monument sea level, desert and jungle pyramid surface fit) ignore it.")
|
||||
private StructureYBand yBand = null;
|
||||
|
||||
@Desc("When true, skip Iris burial repositioning so the structure keeps the Y its own vanilla placement chose. Underground structures are otherwise pushed below the lowest solid column across their whole footprint, which hides terrain-aware structures such as mineshafts that intentionally breach cliffs and surfaces. Vertical shifts still apply on top of the preserved Y: this dimension's undergroundYShift plus every matching adjustment's yShift.")
|
||||
private boolean preserveSourceY = false;
|
||||
|
||||
@Desc("Optional foundation columns placed beneath the native structure piece bases after placement.")
|
||||
private StructureStilts stilt = null;
|
||||
|
||||
@Desc("Optional terrain integration override. VACUUM raises surface terrain from processed solid rigid-template foundations at or below each authored ground plane with a 12-block falloff without lowering existing ground. BORE and FORCE_CARVE clear every intersecting chunk before native pieces are placed, while ENCASE fills it with solid blocks instead. Left unset, SOURCE replays the registered structure's authored terrain adaptation, including surface fitting, burial, and encapsulation.")
|
||||
private StructureTerrain terrain = null;
|
||||
|
||||
public StructureAdjustment() {
|
||||
}
|
||||
|
||||
public StructureAdjustment(List<String> match, int yShift, StructureYBand yBand, boolean preserveSourceY, StructureStilts stilt,
|
||||
StructureTerrain terrain) {
|
||||
this.match = List.copyOf(match);
|
||||
this.yShift = yShift;
|
||||
this.yBand = yBand;
|
||||
this.preserveSourceY = preserveSourceY;
|
||||
this.stilt = stilt;
|
||||
this.terrain = terrain;
|
||||
}
|
||||
|
||||
/** Family patterns of the structures this adjustment applies to. */
|
||||
public List<String> match() {
|
||||
return StructureSettings.listOrEmpty(match);
|
||||
}
|
||||
|
||||
public int yShift() {
|
||||
return yShift;
|
||||
}
|
||||
|
||||
public Optional<StructureYBand> yBand() {
|
||||
return Optional.ofNullable(yBand);
|
||||
}
|
||||
|
||||
public boolean preserveSourceY() {
|
||||
return preserveSourceY;
|
||||
}
|
||||
|
||||
public Optional<StructureStilts> stilt() {
|
||||
return Optional.ofNullable(stilt);
|
||||
}
|
||||
|
||||
public Optional<StructureTerrain> terrain() {
|
||||
return Optional.ofNullable(terrain);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
/** How a structure placement picks the height it anchors a structure at. The placement identity hashes the order. */
|
||||
@Desc("Selects the vertical environment used to anchor an Iris structure placement.")
|
||||
public enum StructureAnchorMode {
|
||||
@Desc("Preserve the historical underground boolean behavior.")
|
||||
LEGACY,
|
||||
|
||||
@Desc("Anchor to the terrain surface and use minHeight/maxHeight as a surface gate.")
|
||||
SURFACE,
|
||||
|
||||
@Desc("Choose a deterministic Y inside the minHeight/maxHeight band.")
|
||||
HEIGHT_BAND,
|
||||
|
||||
@Desc("Anchor in carved space with solid support below.")
|
||||
CAVE_FLOOR,
|
||||
|
||||
@Desc("Anchor in carved space with solid support above.")
|
||||
CAVE_CEILING,
|
||||
|
||||
@Desc("Anchor in carved space without nearby floor or ceiling support.")
|
||||
CAVE_CENTER,
|
||||
|
||||
@Desc("Anchor at any carved-space position.")
|
||||
CAVE_ANY;
|
||||
|
||||
/** Whether the anchor looks for carved space. */
|
||||
public boolean isCave() {
|
||||
return switch (this) {
|
||||
case CAVE_FLOOR, CAVE_CEILING, CAVE_CENTER, CAVE_ANY -> true;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Controls the shape of the expanded terrain carve around an overbored structure.")
|
||||
public enum StructureCarveShape {
|
||||
@Desc("Carves the full expanded rectangular volume with straight walls, ceiling, and floor.")
|
||||
BOX,
|
||||
|
||||
@Desc("Carves a smooth rounded volume around the structure without erosion noise.")
|
||||
ROUNDED,
|
||||
|
||||
@Desc("Carves a rounded volume whose outer boundary is eroded by deterministic noise.")
|
||||
ERODED;
|
||||
|
||||
private static final double ERODED_CEILING_GROWTH = 0.8D;
|
||||
|
||||
public double maximumCeilingScale() {
|
||||
return maximumCeilingScale(1D);
|
||||
}
|
||||
|
||||
/** How far above its configured head room a carve of this shape may reach, as a multiple of it. */
|
||||
public double maximumCeilingScale(double erosionStrength) {
|
||||
double strength = Double.isFinite(erosionStrength)
|
||||
? Math.max(0D, Math.min(1D, erosionStrength)) : 1D;
|
||||
return switch (this) {
|
||||
case BOX, ROUNDED -> 1D;
|
||||
case ERODED -> 1D + ERODED_CEILING_GROWTH * strength;
|
||||
};
|
||||
}
|
||||
|
||||
public int maximumCeilingExtension(int configuredHeight) {
|
||||
return maximumCeilingExtension(configuredHeight, 1D);
|
||||
}
|
||||
|
||||
public int maximumCeilingExtension(int configuredHeight, double erosionStrength) {
|
||||
return (int) Math.ceil(Math.max(0, configuredHeight) * maximumCeilingScale(erosionStrength));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
/** How a structure placement scatters its starts. The placement identity hashes the order. */
|
||||
@Desc("Controls how structure start positions are scattered across the world.")
|
||||
public enum StructureDistribution {
|
||||
@Desc("Vanilla-style spacing/separation grid. One placement attempt per grid cell, randomly offset within it by the separation. Use spacing, separation and salt.")
|
||||
RANDOM_SPREAD,
|
||||
|
||||
@Desc("A per-chunk probability roll, like object density. Use density (0-1).")
|
||||
DENSITY,
|
||||
|
||||
@Desc("Concentric rings around the world origin, like vanilla strongholds. Use rings.")
|
||||
CONCENTRIC_RINGS
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.generation.InvocationContext;
|
||||
import com.volmit.resource.ResourceId;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* What {@code iris:structure} asks of Iris: Iris places its jigsaw structures itself. The structure model (structures,
|
||||
* pools, pieces), the assembler that builds a structure from them and the locator that spreads them over the world are
|
||||
* Iris's, shared with the jigsaw studio and the structure importers and exporters. Iris offers it as an extension of its
|
||||
* worlds and of the settings of the pack it loads: {@code world.extension(StructureHost.class)}.
|
||||
*/
|
||||
public interface StructureHost {
|
||||
/** Places the structures that start in the chunk whose mantle the mantle invocation {@code context} generates. */
|
||||
void placeChunk(InvocationContext context);
|
||||
|
||||
/** How far, in blocks along X and Z, a structure may write beyond the chunk it starts in. */
|
||||
int reach();
|
||||
|
||||
/** The loot tables the structure gives its pieces' containers; empty when the pack has no such structure. */
|
||||
Optional<List<String>> lootTables(ResourceId structure);
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.world.PackBiome;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Where and how often the structures of a dimension, region or biome start, written as one entry of its
|
||||
* {@code "structures": [...]}: the pack's own structures to assemble or the platform's to start natively, the
|
||||
* distribution of the starts, the height they anchor at, and how they meet the terrain. IrisApi types only.
|
||||
*/
|
||||
@Desc("Attaches structures to a biome, region or dimension and controls where and how often they generate. This is independent of a structure's own native generation, so you can add custom placements in tandem with native generation or instead of it.")
|
||||
public final class StructurePlacement {
|
||||
@IrisStructureRef
|
||||
@Desc("Editable Iris assembly resources offered by this placement. Leave empty when nativeStructures supplies the source.")
|
||||
private List<String> structures = List.of();
|
||||
|
||||
@Desc("Live registered vanilla, datapack, and modded structures offered by this placement. Minecraft runs their native generator directly, independent of normal biome or dimension eligibility.")
|
||||
private List<NativeStructureSource> nativeStructures = List.of();
|
||||
|
||||
@Desc("Stable authored identity for this placement. Set this when multiple placements use the same structure and settings. When empty, Iris derives identity from the placement content so list reordering does not move generated structures.")
|
||||
private String placementId = "";
|
||||
|
||||
@Desc("Controls native replacement for this placement. REPLACE_SOURCE suppresses each selected Iris structure's vanillaSource or registered native source, and is honored only for dimension-level placements. NONE leaves native generation untouched.")
|
||||
private NativeStructureSuppression nativeSuppression = NativeStructureSuppression.NONE;
|
||||
|
||||
@Desc("How start positions are scattered.")
|
||||
private StructureDistribution distribution = StructureDistribution.RANDOM_SPREAD;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(4096)
|
||||
@Desc("RANDOM_SPREAD only: the grid cell size in chunks. One placement attempt per cell. Larger = rarer.")
|
||||
private int spacing = 32;
|
||||
|
||||
@MinNumber(0)
|
||||
@Desc("RANDOM_SPREAD only: the minimum chunk separation between placements within the grid. Must be smaller than spacing.")
|
||||
private int separation = 8;
|
||||
|
||||
@Desc("RANDOM_SPREAD only: a salt mixed into the placement RNG so different structures using the same spacing do not stack.")
|
||||
private int salt = 165745296;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("DENSITY only: the per-chunk probability (0-1) of a placement starting in a chunk.")
|
||||
private double density = 0.02;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("CONCENTRIC_RINGS only: the number of placements distributed across the rings.")
|
||||
private int ringCount = 128;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("CONCENTRIC_RINGS only: the ring spacing in chunks.")
|
||||
private int ringDistance = 32;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("CONCENTRIC_RINGS only: how many placements share each ring before moving outward.")
|
||||
private int ringSpread = 3;
|
||||
|
||||
@Desc("Minimum world Y. SURFACE uses it as a terrain-height gate; HEIGHT_BAND and cave anchors use it as the lower candidate bound. LEGACY follows underground.")
|
||||
private int minHeight = -2032;
|
||||
|
||||
@Desc("Maximum world Y. SURFACE uses it as a terrain-height gate; HEIGHT_BAND and cave anchors use it as the upper candidate bound. LEGACY follows underground.")
|
||||
private int maxHeight = 2032;
|
||||
|
||||
@Desc("LEGACY anchor only: if true, choose a deterministic world Y inside [minHeight, maxHeight]; otherwise gate the terrain surface. Explicit anchor modes override this field.")
|
||||
private boolean underground = false;
|
||||
|
||||
@Desc("Vertical anchor policy. LEGACY preserves the underground boolean. Cave modes search existing carved-space data and implicitly behave as underground placements.")
|
||||
private StructureAnchorMode anchor = StructureAnchorMode.LEGACY;
|
||||
|
||||
@ResourceRef(PackBiome.class)
|
||||
@Desc("Optional cave-biome allowlist for cave anchor modes. Empty accepts the cave biome resolved at the selected anchor. Entries match by load key, including prefix matches.")
|
||||
private List<String> caveBiomes = List.of();
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(64)
|
||||
@Desc("Cave anchor modes only: deterministic X/Z columns tested inside the start chunk before the placement is skipped.")
|
||||
private int caveAnchorAttempts = 8;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(16)
|
||||
@Desc("Cave anchor modes only: vertical scan step in blocks. One is exact; larger values trade precision for speed.")
|
||||
private int caveAnchorScanStep = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(64)
|
||||
@Desc("Cave anchor modes only: minimum contiguous carved-space height required at the selected anchor.")
|
||||
private int caveMinimumClearance = 3;
|
||||
|
||||
@Desc("Terrain integration for this placement. The editable structures backend supports SOURCE, PRESERVE, BORE, and FORCE_CARVE. The nativeStructures backend supports every terrain mode.")
|
||||
private StructureTerrain terrain = new StructureTerrain();
|
||||
|
||||
@Desc("Optional foundation columns placed beneath the assembled structure's occupied bottom cells. Columns pass through air and fluids until they reach solid ground, up to maxDepth.")
|
||||
private StructureStilts stilt = null;
|
||||
|
||||
@Desc("If false, the placement is skipped when its selected surface or cave column is submerged.")
|
||||
private boolean underwater = false;
|
||||
|
||||
public StructurePlacement() {
|
||||
}
|
||||
|
||||
/** Keys of the pack's structures the placement assembles, one picked per start. */
|
||||
public List<String> structures() {
|
||||
return listOrEmpty(structures);
|
||||
}
|
||||
|
||||
/** The platform structures the placement starts natively, one picked per start by weight. */
|
||||
public List<NativeStructureSource> nativeStructures() {
|
||||
return listOrEmpty(nativeStructures);
|
||||
}
|
||||
|
||||
public String placementId() {
|
||||
return placementId;
|
||||
}
|
||||
|
||||
public NativeStructureSuppression nativeSuppression() {
|
||||
return nativeSuppression == null ? NativeStructureSuppression.NONE : nativeSuppression;
|
||||
}
|
||||
|
||||
public StructureDistribution distribution() {
|
||||
return distribution == null ? StructureDistribution.RANDOM_SPREAD : distribution;
|
||||
}
|
||||
|
||||
public int spacing() {
|
||||
return spacing;
|
||||
}
|
||||
|
||||
public int separation() {
|
||||
return separation;
|
||||
}
|
||||
|
||||
public int salt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public double density() {
|
||||
return density;
|
||||
}
|
||||
|
||||
public int ringCount() {
|
||||
return ringCount;
|
||||
}
|
||||
|
||||
public int ringDistance() {
|
||||
return ringDistance;
|
||||
}
|
||||
|
||||
public int ringSpread() {
|
||||
return ringSpread;
|
||||
}
|
||||
|
||||
public int minHeight() {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
public int maxHeight() {
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
public boolean underground() {
|
||||
return underground;
|
||||
}
|
||||
|
||||
/** The anchor as written; {@link #resolvedAnchor} says what {@code LEGACY} means for this placement. */
|
||||
public StructureAnchorMode anchor() {
|
||||
return anchor == null ? StructureAnchorMode.LEGACY : anchor;
|
||||
}
|
||||
|
||||
/** Cave biome keys or key prefixes a cave anchor accepts; empty for any. */
|
||||
public List<String> caveBiomes() {
|
||||
return listOrEmpty(caveBiomes);
|
||||
}
|
||||
|
||||
public int caveAnchorAttempts() {
|
||||
return caveAnchorAttempts;
|
||||
}
|
||||
|
||||
public int caveAnchorScanStep() {
|
||||
return caveAnchorScanStep;
|
||||
}
|
||||
|
||||
public int caveMinimumClearance() {
|
||||
return caveMinimumClearance;
|
||||
}
|
||||
|
||||
/** How the placement's structures meet the terrain; the defaults when the pack wrote none. */
|
||||
public StructureTerrain resolvedTerrain() {
|
||||
return terrain == null ? new StructureTerrain() : terrain;
|
||||
}
|
||||
|
||||
/** The foundation columns under the structures; empty for none. */
|
||||
public Optional<StructureStilts> stilt() {
|
||||
return Optional.ofNullable(stilt);
|
||||
}
|
||||
|
||||
public boolean underwater() {
|
||||
return underwater;
|
||||
}
|
||||
|
||||
public boolean hasIrisStructures() {
|
||||
return !structures().isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasNativeStructures() {
|
||||
return !nativeStructures().isEmpty();
|
||||
}
|
||||
|
||||
/** The anchor this placement uses: {@code LEGACY} is the band when {@link #underground}, else the surface. */
|
||||
public StructureAnchorMode resolvedAnchor() {
|
||||
if (anchor() == StructureAnchorMode.LEGACY) {
|
||||
return underground ? StructureAnchorMode.HEIGHT_BAND : StructureAnchorMode.SURFACE;
|
||||
}
|
||||
return anchor();
|
||||
}
|
||||
|
||||
public boolean isAnchoredUnderground() {
|
||||
StructureAnchorMode activeAnchor = resolvedAnchor();
|
||||
return activeAnchor == StructureAnchorMode.HEIGHT_BAND || activeAnchor.isCave();
|
||||
}
|
||||
|
||||
private static <T> List<T> listOrEmpty(List<T> list) {
|
||||
return list == null ? List.of() : Collections.unmodifiableList(list);
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The structure placements of a dimension, region or biome, written as {@code "structures": [...]}: one
|
||||
* {@link StructurePlacement} per entry. IrisApi types only.
|
||||
*/
|
||||
@Desc("Iris structure placements of this dimension, region or biome: where and how often its structures start.")
|
||||
@Feature(id = "iris:structure/placements", name = "Structure placements", key = "structures", root = "placements",
|
||||
targets = {Level.DIMENSION, Level.REGION, Level.BIOME})
|
||||
public final class StructurePlacementSettings implements IrisFeature {
|
||||
@Desc("Iris structure placements, each independent of the others.")
|
||||
private List<StructurePlacement> placements = List.of();
|
||||
|
||||
public StructurePlacementSettings() {
|
||||
}
|
||||
|
||||
public List<StructurePlacement> placements() {
|
||||
return placements == null ? List.of() : Collections.unmodifiableList(placements);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
|
||||
/** One entry of {@link StructureSettings#frequencyOverrides()}: how often the structures of one platform structure set start. */
|
||||
@Desc("An exact registered structure-set frequency multiplier. Iris retains the set's structures, weights, biome eligibility, placement algorithm, salt, exclusion zone, starts, processors, mobs, loot, and locate behavior while scaling only its native placement density.")
|
||||
public final class StructureSetFrequency {
|
||||
@Ref(Reference.STRUCTURE_SET)
|
||||
@Desc("Exact registered structure-set key, for example 'minecraft:nether_complexes'. Structure keys such as 'minecraft:fortress' are not valid here.")
|
||||
private String structureSet = "";
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(16)
|
||||
@Desc("Requested placement-density multiplier. Random-spread sets scale their placement frequency first and then their integer chunk spacing; integer spacing and separation constraints can make the realized increase slightly lower or higher. The default 1 leaves the registered placement unchanged.")
|
||||
private double multiplier = 1D;
|
||||
|
||||
public StructureSetFrequency() {
|
||||
}
|
||||
|
||||
public StructureSetFrequency(String structureSet, double multiplier) {
|
||||
this.structureSet = structureSet;
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public String structureSet() {
|
||||
return structureSet == null ? "" : structureSet;
|
||||
}
|
||||
|
||||
public double multiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* How a dimension treats the platform's own structures (vanilla, data pack and mod structures), written as
|
||||
* {@code "importedStructures": {"disabled": [...], "adjustments": [...]}}: which ones it disables, how the ones that still
|
||||
* generate are moved and fitted, how often structure sets start, and whether installed data packs may replace the
|
||||
* platform's own definitions. IrisApi types only.
|
||||
*/
|
||||
@Desc("Controls native vanilla, mod, and ingested datapack structure generation for this dimension. Every registered structure generates through its native placement unless its key matches 'disabled', equals a key in 'disabledExact', or a viable dimension-level Iris placement explicitly replaces its source. Family matching uses namespace, slash, or underscore boundaries, while exact matching compares normalized complete keys only. Run '/iris module structure list' to dump every valid key. Only affects newly generated chunks and is separate from Iris structure placements.")
|
||||
@Feature(id = "iris:structure", name = "Structures", key = "importedStructures", targets = Level.DIMENSION)
|
||||
public final class StructureSettings implements IrisFeature {
|
||||
@Ref(Reference.STRUCTURE_PREFIX)
|
||||
@Desc("Structure keys to deny explicitly, e.g. 'minecraft:stronghold'. A namespace:path prefix also matches, so 'minecraft:village' disables every village variant and 'minecraft:ruined_portal' disables every ruined portal. Every key not matched here remains enabled.")
|
||||
private List<String> disabled = List.of();
|
||||
|
||||
@Ref(Reference.STRUCTURE)
|
||||
@Desc("Exact structure keys to deny after trimming and case normalization. Unlike 'disabled', entries never match key families, so 'minecraft:ruined_portal' does not disable 'minecraft:ruined_portal_nether'.")
|
||||
private List<String> disabledExact = List.of();
|
||||
|
||||
@MinNumber(-512)
|
||||
@MaxNumber(512)
|
||||
@Desc("Vertical block offset applied only to UNDERGROUND vanilla structures (the UNDERGROUND_STRUCTURES, UNDERGROUND_DECORATION, and STRONGHOLDS generation steps: strongholds, trial chambers, mineshafts, ancient cities, etc.). Surface structures (villages, outposts, etc.) are never shifted. Use a negative value to push deep structures lower when your dimension's sea/terrain level differs from vanilla's (e.g. -64 if you lowered the fluid height to 0). 0 = no shift.")
|
||||
private int undergroundYShift = 0;
|
||||
|
||||
@Desc("Controls whether ingested datapacks may replace minecraft-namespaced structure definitions, sets, pools, and templates. When false, those overrides are stripped from installed datapack copies so vanilla definitions stay intact. Non-minecraft structures from datapacks and mods remain governed by disabled because namespace alone cannot identify their origin. Resolved globally across loaded packs: if any dimension sets this false, minecraft-namespaced overrides are stripped from every installed datapack copy.")
|
||||
private boolean datapackOverrides = true;
|
||||
|
||||
@Desc("Exact registered structure-set frequency overrides for native generation. The last entry for a normalized structure-set key wins. These do not convert native structures into Iris placements and affect only newly generated chunks.")
|
||||
private List<StructureSetFrequency> frequencyOverrides = List.of();
|
||||
|
||||
@Desc("Per-structure adjustments applied to vanilla, mod, and datapack structures that still generate natively. Vertical shifts from every matching entry stack. A matching preserveSourceY option disables Iris burial repositioning for that structure. The last matching entry with stilt settings controls foundation columns, and likewise for terrain and yBand settings. A structure suppressed by an Iris placement is unaffected.")
|
||||
private List<StructureAdjustment> adjustments = List.of();
|
||||
|
||||
public StructureSettings() {
|
||||
}
|
||||
|
||||
public StructureSettings(List<String> disabled, List<String> disabledExact, int undergroundYShift, boolean datapackOverrides,
|
||||
List<StructureSetFrequency> frequencyOverrides, List<StructureAdjustment> adjustments) {
|
||||
this.disabled = List.copyOf(disabled);
|
||||
this.disabledExact = List.copyOf(disabledExact);
|
||||
this.undergroundYShift = undergroundYShift;
|
||||
this.datapackOverrides = datapackOverrides;
|
||||
this.frequencyOverrides = List.copyOf(frequencyOverrides);
|
||||
this.adjustments = List.copyOf(adjustments);
|
||||
}
|
||||
|
||||
/** Family patterns of the structures the dimension disables. */
|
||||
public List<String> disabled() {
|
||||
return listOrEmpty(disabled);
|
||||
}
|
||||
|
||||
/** Complete keys of the structures the dimension disables. */
|
||||
public List<String> disabledExact() {
|
||||
return listOrEmpty(disabledExact);
|
||||
}
|
||||
|
||||
public int undergroundYShift() {
|
||||
return undergroundYShift;
|
||||
}
|
||||
|
||||
public boolean datapackOverrides() {
|
||||
return datapackOverrides;
|
||||
}
|
||||
|
||||
public List<StructureSetFrequency> frequencyOverrides() {
|
||||
return listOrEmpty(frequencyOverrides);
|
||||
}
|
||||
|
||||
public List<StructureAdjustment> adjustments() {
|
||||
return listOrEmpty(adjustments);
|
||||
}
|
||||
|
||||
static <T> List<T> listOrEmpty(List<T> list) {
|
||||
return list == null ? List.of() : Collections.unmodifiableList(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Foundation columns built beneath a structure's pieces after they are placed, as packs write it:
|
||||
* {"maxDepth": 32, "palette": {"palette": [{"block": "stone_bricks"}]}, "spacing": 2}. Held by structure placements and
|
||||
* by the {@code importedStructures} adjustments; ownership records keep its JSON for the starts they track.
|
||||
*/
|
||||
@Desc("Defines foundation columns placed beneath a structure.")
|
||||
public final class StructureStilts {
|
||||
private static final String DEFAULT_BLOCK = "minecraft:cobblestone";
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(4064)
|
||||
@Desc("Maximum number of blocks each foundation column may descend while searching for solid ground.")
|
||||
private int maxDepth = 64;
|
||||
|
||||
@Desc("Block palette used for foundation columns.")
|
||||
private PaletteSpec palette = PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK)));
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(64)
|
||||
@Desc("Horizontal spacing between support columns. One fills every eligible foundation column; larger values create sparse stilts.")
|
||||
private int spacing = 1;
|
||||
|
||||
@Desc("For Iris-authored structures, whether solid partial blocks such as slabs, stairs, and walls may seed foundation columns instead of requiring a fully occluding base block.")
|
||||
private boolean supportNonOccluding = false;
|
||||
|
||||
public StructureStilts() {
|
||||
}
|
||||
|
||||
public int maxDepth() {
|
||||
return maxDepth;
|
||||
}
|
||||
|
||||
/** The blocks of the columns; empty when the pack wrote {@code "palette": null}. */
|
||||
public Optional<PaletteSpec> palette() {
|
||||
return Optional.ofNullable(palette);
|
||||
}
|
||||
|
||||
public int spacing() {
|
||||
return spacing;
|
||||
}
|
||||
|
||||
public boolean supportNonOccluding() {
|
||||
return supportNonOccluding;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* How a structure meets the terrain, as packs write it: {"mode": "FORCE_CARVE", "horizontalPadding": 4, "shape": "ERODED"}.
|
||||
* Held by structure placements and by the {@code importedStructures} adjustments; ownership records keep its JSON for
|
||||
* the starts they track, so its field names and defaults are the persisted format.
|
||||
*/
|
||||
@Desc("Terrain integration applied after a structure graph is assembled and before its pieces are placed.")
|
||||
public final class StructureTerrain {
|
||||
private static final double AUTO_LOBE_FREQUENCY_RATIO = 0.3D;
|
||||
private static final double DEFAULT_EROSION_STRENGTH = 0.8D;
|
||||
private static final double DEFAULT_EROSION_FREQUENCY = 0.07D;
|
||||
private static final double DEFAULT_LOBE_STRENGTH = 0.85D;
|
||||
private static final double MIN_EROSION_FREQUENCY = 0.001D;
|
||||
private static final double MAX_EROSION_FREQUENCY = 1D;
|
||||
private static final double MAX_LOBE_FREQUENCY = 1D;
|
||||
|
||||
@Desc("Terrain operation. SOURCE applies the registered native structure's authored terrain adaptation and is a no-op for editable Iris structures. PRESERVE disables terrain integration. VACUUM raises terrain from processed rigid-template foundations at or below each authored ground plane with a 12-block falloff without lowering existing ground. BORE and FORCE_CARVE clear the requested envelope, while ENCASE fills it before placement so native shells are not lost to pre-carved air.")
|
||||
private StructureTerrainMode mode = StructureTerrainMode.SOURCE;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@Desc("Horizontal clearance around the assembled pieces for BORE, FORCE_CARVE, and ENCASE. VACUUM uses its fixed 12-block terrain falloff.")
|
||||
private int horizontalPadding = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@Desc("Air clearance above the assembled pieces.")
|
||||
private int ceilingPadding = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("Terrain cleared below the assembled pieces. Zero preserves their supporting floor.")
|
||||
private int floorPadding = 0;
|
||||
|
||||
@Desc("Shape used by FORCE_CARVE.")
|
||||
private StructureCarveShape shape = StructureCarveShape.BOX;
|
||||
|
||||
@Desc("Block palette used by ENCASE. When unset, the Overworld uses stone or deepslate, the Nether uses netherrack, and the End uses end stone.")
|
||||
private PaletteSpec encasePalette = null;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Boundary erosion strength for ERODED force carving.")
|
||||
private double erosionStrength = DEFAULT_EROSION_STRENGTH;
|
||||
|
||||
@MinNumber(MIN_EROSION_FREQUENCY)
|
||||
@MaxNumber(MAX_EROSION_FREQUENCY)
|
||||
@Desc("Boundary noise frequency for ERODED force carving.")
|
||||
private double erosionFrequency = DEFAULT_EROSION_FREQUENCY;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Low frequency lobe wavelength for ERODED force carving. Zero derives it from the erosion frequency.")
|
||||
private double lobeFrequency = 0D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Fraction of the horizontal padding the lobes may remove for ERODED force carving. Zero keeps a uniform boundary.")
|
||||
private double lobeStrength = DEFAULT_LOBE_STRENGTH;
|
||||
|
||||
public StructureTerrain() {
|
||||
}
|
||||
|
||||
/** The terrain operation; SOURCE where the pack wrote none or one Iris does not know. */
|
||||
public StructureTerrainMode resolvedMode() {
|
||||
return mode == null ? StructureTerrainMode.SOURCE : mode;
|
||||
}
|
||||
|
||||
public int horizontalPadding() {
|
||||
return horizontalPadding;
|
||||
}
|
||||
|
||||
public int ceilingPadding() {
|
||||
return ceilingPadding;
|
||||
}
|
||||
|
||||
public int floorPadding() {
|
||||
return floorPadding;
|
||||
}
|
||||
|
||||
/** The carve shape; BOX where the pack wrote none or one Iris does not know. */
|
||||
public StructureCarveShape resolvedShape() {
|
||||
return shape == null ? StructureCarveShape.BOX : shape;
|
||||
}
|
||||
|
||||
/** The blocks ENCASE fills with; empty for the dimension's own stone. */
|
||||
public Optional<PaletteSpec> encasePalette() {
|
||||
return Optional.ofNullable(encasePalette);
|
||||
}
|
||||
|
||||
public double resolvedErosionStrength() {
|
||||
if (!Double.isFinite(erosionStrength)) {
|
||||
return DEFAULT_EROSION_STRENGTH;
|
||||
}
|
||||
return Math.max(0D, Math.min(1D, erosionStrength));
|
||||
}
|
||||
|
||||
public double resolvedErosionFrequency() {
|
||||
if (!Double.isFinite(erosionFrequency)) {
|
||||
return DEFAULT_EROSION_FREQUENCY;
|
||||
}
|
||||
return Math.max(MIN_EROSION_FREQUENCY, Math.min(MAX_EROSION_FREQUENCY, erosionFrequency));
|
||||
}
|
||||
|
||||
public double resolvedLobeFrequency() {
|
||||
if (!Double.isFinite(lobeFrequency) || lobeFrequency <= 0D) {
|
||||
return resolvedErosionFrequency() * AUTO_LOBE_FREQUENCY_RATIO;
|
||||
}
|
||||
return Math.min(MAX_LOBE_FREQUENCY, lobeFrequency);
|
||||
}
|
||||
|
||||
public double resolvedLobeStrength() {
|
||||
if (!Double.isFinite(lobeStrength)) {
|
||||
return DEFAULT_LOBE_STRENGTH;
|
||||
}
|
||||
return Math.max(0D, Math.min(1D, lobeStrength));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Controls how terrain is integrated with a structure.")
|
||||
public enum StructureTerrainMode {
|
||||
@Desc("Replays the registered native structure's own authored terrain adaptation (beard surface fitting, BURY/ENCAPSULATE fill, legacy template-air clearing). Does nothing for editable Iris structures, which have no source adaptation to replay.")
|
||||
SOURCE,
|
||||
|
||||
@Desc("Disables all terrain integration. Pieces are placed into completely unmodified terrain and may end up embedded in solid rock or floating over dips.")
|
||||
PRESERVE,
|
||||
|
||||
@Desc("Clears one straight axis-aligned box around the assembled pieces, expanded by horizontalPadding, ceilingPadding, and floorPadding. Ignores the carve shape and erosion settings.")
|
||||
BORE,
|
||||
|
||||
@Desc("Clears the padded envelope using the configured carve shape (BOX, ROUNDED, or noise-eroded ERODED) so the cavity hugs the assembled pieces instead of a straight box.")
|
||||
FORCE_CARVE,
|
||||
|
||||
@Desc("Raises surface terrain from processed solid rigid-template foundations at or below each authored ground plane with a 12-block falloff, even when the registered structure has no terrain adaptation. Existing higher terrain and authored air remain untouched.")
|
||||
VACUUM,
|
||||
|
||||
@Desc("Fills the padded piece volume with solid blocks before any piece is placed so shells, walls, and floors land in solid ground instead of pre-carved air. Only air and liquid cells are filled; existing terrain and structures are never overwritten. Native pieces then carve their own interiors.")
|
||||
ENCASE
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
/**
|
||||
* A band of absolute world heights a platform structure is moved into, as packs write it: {"min": -120, "max": -20}.
|
||||
* Unlike the API's heights these are world Y, as the platform's own structure definitions use them. Reversed bounds
|
||||
* mean the same band.
|
||||
*/
|
||||
@Desc("An absolute world Y band a native structure is relocated into. Reversed bounds are normalized.")
|
||||
public final class StructureYBand {
|
||||
@MinNumber(-4064)
|
||||
@MaxNumber(4064)
|
||||
@Desc("Lowest absolute world Y of the band.")
|
||||
private int min = 0;
|
||||
|
||||
@MinNumber(-4064)
|
||||
@MaxNumber(4064)
|
||||
@Desc("Highest absolute world Y of the band.")
|
||||
private int max = 0;
|
||||
|
||||
public StructureYBand() {
|
||||
}
|
||||
|
||||
public int resolvedMin() {
|
||||
return Math.min(min, max);
|
||||
}
|
||||
|
||||
public int resolvedMax() {
|
||||
return Math.max(min, max);
|
||||
}
|
||||
}
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** Whether a dimension has a layer of bedrock at its bottom, written as {@code "bedrock": false}. A dimension without the key has it. */
|
||||
@Desc("Should bedrock be generated or not.")
|
||||
@Feature(id = "iris:terrain/bedrock", name = "Bedrock", key = "bedrock", root = "bedrock", targets = Level.DIMENSION)
|
||||
public final class BedrockSettings implements IrisFeature {
|
||||
@Desc("Should bedrock be generated or not.")
|
||||
private boolean bedrock = true;
|
||||
|
||||
public BedrockSettings() {
|
||||
}
|
||||
|
||||
public boolean bedrock() {
|
||||
return bedrock;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.builtin.terrain;
|
||||
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The layers of material a biome is made of below its surface, written as {@code "layers": [...]}, the list of layers. A biome
|
||||
* that declares none gets one layer of grass, so the settings class default is what a biome without the key has.
|
||||
*/
|
||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||
@Feature(id = "iris:terrain/layers", name = "Layers", key = "layers", root = "layers", targets = Level.BIOME)
|
||||
public final class LayersSettings implements IrisFeature {
|
||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||
private List<PaletteLayer> layers = List.of(new PaletteLayer());
|
||||
|
||||
public LayersSettings() {
|
||||
}
|
||||
|
||||
public List<PaletteLayer> layers() {
|
||||
return layers == null ? List.of() : layers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.builtin.terrain;
|
||||
|
||||
import art.arcane.iris.builtin.prepare.SlopeClip;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One layer of surface or subsurface material of a biome, as packs write it in the biome's layers, sea layers, cave
|
||||
* ceiling layers, slab and wall, in a floating island's bottom palette or under {@code snippet/iris/terrain/biome-palette/}. A value of
|
||||
* IrisApi types only; the terrain module resolves the blocks and builds the noise.
|
||||
*/
|
||||
@Snippet("iris/terrain/biome-palette")
|
||||
@Desc("A layer of surface / subsurface material in biomes")
|
||||
public final class PaletteLayer {
|
||||
private static final String STATIC_NOISE = "STATIC";
|
||||
private static final String DEFAULT_BLOCK = "grass_block";
|
||||
|
||||
@Desc("The style of noise")
|
||||
private NoiseStyle style = NoiseStyle.of(STATIC_NOISE);
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(2032)
|
||||
@Desc("The min thickness of this layer")
|
||||
private int minHeight = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(2032)
|
||||
@Desc("The max thickness of this layer")
|
||||
private int maxHeight = 1;
|
||||
|
||||
@Desc("If set, this layer only shows where the terrain slope is within these bounds; outside them the layer is skipped entirely. Thickness is not scaled by slope.")
|
||||
private SlopeClip slopeCondition = new SlopeClip();
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
|
||||
private double zoom = 5;
|
||||
|
||||
@Required
|
||||
@MinItems(1)
|
||||
@Desc("The palette of blocks to be used in this layer")
|
||||
private List<BlockSpec> palette = List.of(BlockSpec.of(DEFAULT_BLOCK));
|
||||
|
||||
/** A layer with every option at its default, as packs get it from {@code {}}. */
|
||||
public PaletteLayer() {
|
||||
}
|
||||
|
||||
/** A layer with the default options and no block to place, which is what a biome without a slab or wall has. */
|
||||
public static PaletteLayer withoutBlocks() {
|
||||
PaletteLayer layer = new PaletteLayer();
|
||||
layer.palette = List.of();
|
||||
return layer;
|
||||
}
|
||||
|
||||
public NoiseStyle style() {
|
||||
return style == null ? NoiseStyle.of(STATIC_NOISE) : style;
|
||||
}
|
||||
|
||||
public int minHeight() {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
public int maxHeight() {
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
public SlopeClip slopeCondition() {
|
||||
return slopeCondition == null ? new SlopeClip() : slopeCondition;
|
||||
}
|
||||
|
||||
public double zoom() {
|
||||
return zoom;
|
||||
}
|
||||
|
||||
public List<BlockSpec> palette() {
|
||||
return palette == null ? List.of() : palette;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.builtin.vacuum;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/** How a VACUUM place mode bends terrain to meet an object's base, written as the placement's {@code vacuumSettings}. */
|
||||
@Snippet("iris/vacuum/vacuum-settings")
|
||||
@Desc("Defines how a VACUUM place mode bends terrain to meet an object's base.")
|
||||
public final class VacuumSettings {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@Desc("The horizontal radius (in blocks) the terrain deformation extends beyond the object footprint before it blends back to the natural surface. 0 = derive automatically from the place mode (VACUUM, VACUUM_HIGH larger, VACUUM_FAST smaller).")
|
||||
private int radius = 0;
|
||||
@MinNumber(0.25)
|
||||
@MaxNumber(8)
|
||||
@Desc("The falloff exponent controlling how the deformation eases out across the radius. 1 = linear (cone), 2 = parabolic (default, gentle bowl), higher = flatter near the object with a sharper drop at the edge.")
|
||||
private double falloff = 2.0;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("For VACUUM_ORGANIC: the maximum number of blocks the effective radius is randomly perturbed per column, giving the meeting edge an irregular organic outline instead of a clean circle.")
|
||||
private int organicJitter = 4;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("For VACUUM_WAVY: the vertical amplitude (in blocks) of the rolling simplex wave applied across the terrain bend. The wave fades to zero under the object (so it stays flush) and at the outer radius (so it blends back to the surface), peaking across the mid-slope. 0 disables the wave.")
|
||||
private int waveAmplitude = 3;
|
||||
@MinNumber(0.1)
|
||||
@MaxNumber(64)
|
||||
@Desc("For VACUUM_WAVY: the frequency of the simplex wave. Higher values make tighter, choppier ripples; lower values make broad, gentle swells. The wavelength in blocks is roughly 100 / waveScale.")
|
||||
private double waveScale = 5.0;
|
||||
|
||||
public VacuumSettings() {
|
||||
}
|
||||
|
||||
public int radius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public double falloff() {
|
||||
return falloff;
|
||||
}
|
||||
|
||||
public int organicJitter() {
|
||||
return organicJitter;
|
||||
}
|
||||
|
||||
public int waveAmplitude() {
|
||||
return waveAmplitude;
|
||||
}
|
||||
|
||||
public double waveScale() {
|
||||
return waveScale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.builtin.validate;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/** The heights an object placement may sit between, written as the placement's {@code clamp}. */
|
||||
@Snippet("iris/validate/object-limit")
|
||||
@Desc("Limits object placement by minimum and maximum world height")
|
||||
public final class ObjectLimit {
|
||||
@MinNumber(-2048)
|
||||
@MaxNumber(2048)
|
||||
@Desc("The minimum height for placement (bottom of object)")
|
||||
private int minimumHeight = -2048;
|
||||
|
||||
@MinNumber(-2048)
|
||||
@MaxNumber(2048)
|
||||
@Desc("The maximum height for placement (top of object)")
|
||||
private int maximumHeight = 2048;
|
||||
|
||||
public ObjectLimit() {
|
||||
}
|
||||
|
||||
public int minimumHeight() {
|
||||
return minimumHeight;
|
||||
}
|
||||
|
||||
public int maximumHeight() {
|
||||
return maximumHeight;
|
||||
}
|
||||
|
||||
/** Whether an object whose top is at {@code highest} and bottom at {@code lowest} fits between the limits. */
|
||||
public boolean canPlace(int highest, int lowest) {
|
||||
return highest <= maximumHeight && lowest >= minimumHeight;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.builtin.decorant.DecorantSettings;
|
||||
import art.arcane.iris.modules.decorant.DecorateSettings;
|
||||
import art.arcane.iris.engine.decorator.BiomeDecorators;
|
||||
import art.arcane.iris.engine.decorator.DecoratedBiome;
|
||||
import art.arcane.iris.engine.decorator.DecorationScene;
|
||||
import art.arcane.iris.engine.decorator.IrisSeaFloorDecorator;
|
||||
import art.arcane.iris.engine.decorator.IrisSeaSurfaceDecorator;
|
||||
import art.arcane.iris.engine.decorator.IrisShoreLineDecorator;
|
||||
import art.arcane.iris.engine.decorator.IrisSurfaceDecorator;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.ModuleLifecycle;
|
||||
import com.volmit.ModuleSetup;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
import com.volmit.hunk.Hunk;
|
||||
import com.volmit.stage.ChunkStageContext;
|
||||
import com.volmit.world.BiomeKind;
|
||||
import com.volmit.world.PackWorld;
|
||||
import com.volmit.world.TerrainSampler;
|
||||
|
||||
/**
|
||||
* Module {@code iris:decorant}: the biomes' decorators ({@link DecorantSettings}), placed on the surface the mantle's
|
||||
* blocks left: the surface itself, the sea surface and floor, and the shore line. A dimension turns decorating off with
|
||||
* {@link DecorateSettings}. The decorators' noise is built ahead of generation, in {@link #warmUp}.
|
||||
*/
|
||||
public final class DecorantModule implements IrisModule, ModuleLifecycle {
|
||||
private static final String VERSION = "built-in";
|
||||
|
||||
@Override
|
||||
public ModuleInfo info() {
|
||||
return ModuleInfo.of("iris:decorant", "Decorators", VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(ModuleSetup setup) {
|
||||
// Ordering only: iris:matter ships in the built-ins jar, which a pack may not have.
|
||||
setup.stages().define(IrisStages.Decorant.DECORATE).softAfter(IrisStages.Matter.INSERT).run(DecorantModule::decorate);
|
||||
var registry = setup.registry();
|
||||
registry.registerSettings(DecorantSettings.class);
|
||||
registry.registerSettings(DecorateSettings.class);
|
||||
registry.registerLifecycle(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warmUp(PackWorld world) {
|
||||
BiomeDecorators.of(world).warm();
|
||||
}
|
||||
|
||||
private static void decorate(ChunkStageContext context) {
|
||||
if (!decorates(context)) {
|
||||
return;
|
||||
}
|
||||
decorate(DecorationScene.of(context), context.settings(), context.originX(), context.originZ());
|
||||
}
|
||||
|
||||
/** A dimension decorates unless it says {@code decorate: false}. */
|
||||
private static boolean decorates(ChunkStageContext context) {
|
||||
return context.settings().at(DecorateSettings.class, context.centreX(), context.centreZ()).dimension()
|
||||
.map(DecorateSettings::decorate).orElse(true);
|
||||
}
|
||||
|
||||
/** Decorates the 16 x 16 columns of the chunk whose first block is {@code x}, {@code z}, a biome's decorators on the surface its blocks left. */
|
||||
static void decorate(DecorationScene scene, FeatureSettings settings, int x, int z) {
|
||||
Hunk<BlockState> output = scene.blocks();
|
||||
TerrainSampler terrain = scene.terrain();
|
||||
BiomeDecorators decorators = scene.decorators();
|
||||
IrisSurfaceDecorator surfaceDecorator = new IrisSurfaceDecorator(scene);
|
||||
IrisSeaSurfaceDecorator seaSurfaceDecorator = new IrisSeaSurfaceDecorator(scene);
|
||||
IrisSeaFloorDecorator seaFloorDecorator = new IrisSeaFloorDecorator(scene);
|
||||
IrisShoreLineDecorator shoreLineDecorator = new IrisShoreLineDecorator(scene);
|
||||
int fluidHeight = scene.fluidHeight();
|
||||
int worldHeight = scene.worldHeight();
|
||||
|
||||
for (int i = 0; i < output.width(); i++) {
|
||||
int realX = Math.round(x + i);
|
||||
for (int j = 0; j < output.depth(); j++) {
|
||||
int realZ = Math.round(z + j);
|
||||
DecoratedBiome biome = BiomeDecorators.biomeOf(settings, realX, realZ, terrain.surfaceKind(realX, realZ));
|
||||
if (!decorators.hasDecorators(biome)) {
|
||||
continue;
|
||||
}
|
||||
int height = terrain.surfaceHeight(realX, realZ);
|
||||
|
||||
if (height >= 0 && height < fluidHeight && scene.isSolid(output.get(i, height, j))
|
||||
&& height + 1 < output.height() && scene.isWater(output.get(i, height + 1, j))) {
|
||||
seaSurfaceDecorator.decorate(i, j,
|
||||
realX, Math.round(i + 1), Math.round(x + i - 1),
|
||||
realZ, Math.round(z + j + 1), Math.round(z + j - 1),
|
||||
biome, fluidHeight, worldHeight);
|
||||
seaFloorDecorator.decorate(i, j,
|
||||
realX, realZ, biome, height + 1,
|
||||
fluidHeight + 1);
|
||||
}
|
||||
|
||||
if (height == fluidHeight) {
|
||||
shoreLineDecorator.decorate(i, j,
|
||||
realX, Math.round(x + i + 1), Math.round(x + i - 1),
|
||||
realZ, Math.round(z + j + 1), Math.round(z + j - 1),
|
||||
biome, height, worldHeight);
|
||||
}
|
||||
|
||||
if (height >= 0 && height < output.height()) {
|
||||
surfaceDecorator.decorate(i, j, realX, realZ, biome, height, worldHeight - height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.IrisSeedPurposes;
|
||||
import art.arcane.iris.modules.terrain.OreSettings;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.config.SettingsStack;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
/**
|
||||
* Builds the noise of every ore generator the world's biomes, regions and dimension declare before generation needs it.
|
||||
* A generator keeps the noise of the first seed it is given, so each one is warmed with the seed of its place in
|
||||
* this order: the biomes by key, the regions by key, then the dimension. The order is part of what a world generates.
|
||||
*/
|
||||
final class OreWarmUp {
|
||||
private static final long ROOT_SEED_SALT = 7777L;
|
||||
|
||||
private final PackWorld world;
|
||||
private final TerrainOres ores;
|
||||
private final RNG root;
|
||||
private int warmed;
|
||||
|
||||
OreWarmUp(PackWorld world) {
|
||||
this(world, TerrainOres.of(world));
|
||||
}
|
||||
|
||||
OreWarmUp(PackWorld world, TerrainOres ores) {
|
||||
this.world = world;
|
||||
this.ores = ores;
|
||||
this.root = new RNG(world.seed(IrisSeedPurposes.COMPONENT) + ROOT_SEED_SALT);
|
||||
}
|
||||
|
||||
void warm() {
|
||||
LongSupplier seeds = () -> root.nextParallelRNG(warmed++).getSeed();
|
||||
|
||||
SettingsStack<OreSettings> declared = world.settings().declared(OreSettings.class);
|
||||
warmLevel(declared, Level.BIOME, seeds);
|
||||
warmLevel(declared, Level.REGION, seeds);
|
||||
warmLevel(declared, Level.DIMENSION, seeds);
|
||||
}
|
||||
|
||||
/** The ores of every owner at {@code level}, ordered by the key of the biome, region or dimension that declares them. */
|
||||
private void warmLevel(SettingsStack<OreSettings> declared, Level level, LongSupplier seeds) {
|
||||
declared.entries().stream()
|
||||
.filter(entry -> entry.level() == level)
|
||||
.sorted(Comparator.comparing((Entry<OreSettings> entry) -> key(entry.source())))
|
||||
.forEach(entry -> ores.of(entry.value()).warm(seeds));
|
||||
}
|
||||
|
||||
private static String key(ResourceId source) {
|
||||
String path = source.path();
|
||||
return path.substring(path.indexOf('/') + 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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.actuator;
|
||||
|
||||
import art.arcane.iris.modules.terrain.OreGenerator;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.block.PaletteSampler;
|
||||
import com.volmit.noise.NoiseFactory;
|
||||
import com.volmit.noise.NoiseSampler;
|
||||
import com.volmit.resource.PackResources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One {@link OreGenerator} made ready for one world: its palette resolved to blocks and the noise that
|
||||
* decides where it places ore, built from the seed it is warmed with or, when nothing warmed it, from the terrain seed
|
||||
* of its first use. The palette picks with the terrain seed. What the generator describes stays in the settings;
|
||||
* everything that needs the platform, the pack or the world seed is here.
|
||||
*/
|
||||
final class ResolvedOre {
|
||||
private final OreGenerator settings;
|
||||
private final NoiseFactory noise;
|
||||
private final BlockRegistry blockRegistry;
|
||||
private final long terrainSeed;
|
||||
private final List<BlockState> blocks;
|
||||
private final AtomicCache<NoiseSampler> chance = new AtomicCache<>();
|
||||
private final AtomicCache<PaletteSampler> palette = new AtomicCache<>();
|
||||
|
||||
/**
|
||||
* @param terrainSeed the seed the palette picks with, and the noise is built from when nothing warmed it first
|
||||
* @param blocks the palette as the platform's blocks, each repeated by its weight
|
||||
*/
|
||||
ResolvedOre(OreGenerator settings, NoiseFactory noise, BlockRegistry blockRegistry, long terrainSeed, List<BlockState> blocks) {
|
||||
this.settings = settings;
|
||||
this.noise = noise;
|
||||
this.blockRegistry = blockRegistry;
|
||||
this.terrainSeed = terrainSeed;
|
||||
this.blocks = List.copyOf(blocks);
|
||||
}
|
||||
|
||||
/** {@code settings} ready for a world with {@code resources}: its blocks resolved through the pack, its picks seeded with the terrain seed. */
|
||||
static ResolvedOre of(OreGenerator settings, PackResources resources, long terrainSeed) {
|
||||
BlockRegistry registry = resources.blocks();
|
||||
return new ResolvedOre(settings, resources.noise(), registry, terrainSeed, weighted(registry, settings.palette().palette()));
|
||||
}
|
||||
|
||||
private static List<BlockState> weighted(BlockRegistry registry, List<BlockSpec> specs) {
|
||||
List<BlockState> weighted = new ArrayList<>();
|
||||
for (BlockSpec spec : specs) {
|
||||
BlockState state = registry.resolve(spec);
|
||||
for (int n = 0; n < spec.weight(); n++) {
|
||||
weighted.add(state);
|
||||
}
|
||||
}
|
||||
return weighted;
|
||||
}
|
||||
|
||||
boolean generatesSurface() {
|
||||
return settings.generateSurface();
|
||||
}
|
||||
|
||||
double minY() {
|
||||
return settings.range().min();
|
||||
}
|
||||
|
||||
double maxY() {
|
||||
return settings.range().max();
|
||||
}
|
||||
|
||||
/** Builds the chance noise from {@code seed}, unless it is built already: the first seed it is given is the one it keeps. */
|
||||
void warm(long seed) {
|
||||
chance.aquire(() -> noise.sampler(settings.chanceStyle(), seed));
|
||||
}
|
||||
|
||||
/** The ore block at the position, or null when the position is out of the band, the chance noise is above the threshold or the palette has no block. */
|
||||
BlockState generate(int x, int y, int z) {
|
||||
if (!settings.range().contains(y)) {
|
||||
return null;
|
||||
}
|
||||
if (settings.palette().palette().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (chanceNoise().sample(x, y, z) > settings.threshold()) {
|
||||
return null;
|
||||
}
|
||||
return pick(x, y, z);
|
||||
}
|
||||
|
||||
/** The chance noise, which this runs per block of the terrain, so a built one is read without creating a supplier. */
|
||||
private NoiseSampler chanceNoise() {
|
||||
NoiseSampler built = chance.getIfPresent();
|
||||
if (built != null) {
|
||||
return built;
|
||||
}
|
||||
return chance.aquire(() -> noise.sampler(settings.chanceStyle(), terrainSeed));
|
||||
}
|
||||
|
||||
private BlockState pick(int x, int y, int z) {
|
||||
if (blocks.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (blocks.size() == 1) {
|
||||
return blocks.getFirst();
|
||||
}
|
||||
PaletteSampler sampler = palette.aquire(() -> blockRegistry.palette(settings.palette(), terrainSeed));
|
||||
return sampler.at(x, y, z);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 391 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user