mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Let every number that shapes a cave vary across the world
A cave value is a plain number, {min, max} that a smooth noise picks
from, or {min, max, style} where the pack's style picks. The noise's low
end gives min and its high end max. A plain number keeps the constant
path, and the carver checks for constants so they cost no more than
before. Each varying value has its own seed, named after its key, so
writing a range leaves every other field of the cave where it was.
The form covers fade, surfaceClearance and both ends of depth on the
cave; width, height, the coverage share and verticalWarp on tunnels;
size, height, coverage and roughness on caverns; spacing, thickness,
flare and vertical on pillars. Three constants become keys with
defaults that carve what they did: ceilingFade (8 blocks),
verticalWarp (0.5) and the coverage softness (0.3, an edge of 0.15).
Roughness (0.3) replaces the fixed wall detail. Tunnel coverage also
takes a plain number as the share.
Sizes do not stretch the noise, which sheared rooms into air pockets
and floating rock. A size or height that varies blends a field built at
min with one built at max, so each varying size doubles the fields read.
With size, height or roughness varying the coverage share is
approximate: a size range carves about 14% more than its ends average.
JsonForms codecs get Parts, which read a part of a form as the host
reads that type anywhere else. A cave value's style can then name a
pack's expression. A cave value is not a number to the host's bounds
check, so a validator reports values outside their key's range.
natureplanet's four cave files carve block for block what they carved
before, and the first pass's five pinned caves still match.
This commit is contained in:
1 parent
5695cf053e
commit
8e19a7ed63
26 files changed
+2028
-238
No files matched your search
+2
-1
@@ -272,7 +272,8 @@ running Iris is the pack publisher's responsibility.
|
||||
- Decode IrisApi's value types like settings: `BlockSpec`, `PaletteSpec`, `NoiseStyle`, `StyledRange`, `Range` and
|
||||
`BlockPosition` from the JSON shapes in their docs, `Object` as maps, lists, `Double`s, strings and booleans.
|
||||
Read and write a `@JsonForms` class through its codec, created once with its no-argument constructor, handing it
|
||||
those same plain values; a member written as `null` stays left out and never reaches the codec.
|
||||
those same plain values; a member written as `null` stays left out and never reaches the codec. Its `Parts` read a
|
||||
part of a form exactly as the host reads that type anywhere else.
|
||||
Read a `"snippet/<name>"` or `"snippet/<folder>/<name>"` string of a `@Snippet` type from
|
||||
`snippet/<folder>/<name>.json`. Complete `NOISE_STYLE` references and `@ResourceRef` of the host kinds
|
||||
(`EXPRESSIONS`, `IMAGE_MAPS` among them);
|
||||
|
||||
+3
-1
@@ -919,7 +919,9 @@ Every settings class, value type and pack resource kind is read the same way, by
|
||||
- A class annotated `@JsonForms(Codec.class)` is the one exception: a value packs write in several shapes, such as a
|
||||
number, a `[min, max]` range or a curve object. The host reads its JSON as plain values (maps, lists, `Double`s,
|
||||
strings, booleans), hands them to the codec, and writes the value back through it. It never creates the class or
|
||||
reads its fields, and studio describes it as any JSON value.
|
||||
reads its fields, and studio describes it as any JSON value. A form may hold a part of another type, such as a
|
||||
`NoiseStyle`; the codec reads it with the `Parts` the host hands it, so the part reads as that type does anywhere
|
||||
else, a pack's expression included.
|
||||
- A member the JSON leaves out keeps the field's initialiser. A member written as `null` counts as left out.
|
||||
- The host never writes `null` into a field. An enum name the enum does not know is an error that lists the known
|
||||
names; it does not become `null` or the default.
|
||||
|
||||
@@ -22,11 +22,23 @@ public @interface JsonForms {
|
||||
/**
|
||||
* The value {@code json} writes; never null, since a member written as {@code null} counts as left out.
|
||||
*
|
||||
* @param parts reads a part of a form that is a type of its own, such as a {@code NoiseStyle}
|
||||
* @throws IllegalArgumentException when {@code json} is none of the forms, saying which forms there are
|
||||
*/
|
||||
T read(Object json);
|
||||
T read(Object json, Parts parts);
|
||||
|
||||
/** {@code value} as plain values {@link #read} reads back as an equal value. */
|
||||
Object write(T value);
|
||||
}
|
||||
|
||||
/** Reads a part of a form exactly as the host reads that type anywhere else, so a style in a form may name a pack's expression. */
|
||||
interface Parts {
|
||||
/**
|
||||
* {@code json}, as plain values, read as a {@code type}: a settings class, a value type or another
|
||||
* {@code @JsonForms} class.
|
||||
*
|
||||
* @throws IllegalArgumentException when {@code json} does not read as a {@code type}
|
||||
*/
|
||||
<V> V read(Object json, Class<V> type);
|
||||
}
|
||||
}
|
||||
@@ -542,7 +542,7 @@ class PackSchemaTest {
|
||||
|
||||
public static final class Forms implements JsonForms.Codec<Height> {
|
||||
@Override
|
||||
public Height read(Object json) {
|
||||
public Height read(Object json, JsonForms.Parts parts) {
|
||||
return new Height((Double) json);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user