mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Batch 4 of the API review: api and host artifacts, ModuleLoadException
- Split into Gradle subprojects api (com.volmit:iris-api) and host (com.volmit:iris-host). ExposedPackages never exposes com.volmit.host. - One unchecked ModuleLoadException(moduleId, origin, message, cause) for every load error; messages unchanged. - PlacementAccess.set(x, y, z, state) next to set(PlacedBlock). - BlockState: precompiled patterns, withProperty copies once. - Mantle and layer views are made once per invocation. - Hunk getters are width(), height(), depth(). - Held types and host types are deprecated for removal at the cut-over. - Docs: artifacts, one-or-more modules per jar, no option shorthand.
This commit is contained in:
1 parent
3a307b5b8e
commit
b6c2992752
309 files changed
+547
-178
No files matched your search
+10
-4
@@ -67,8 +67,8 @@ Packs write settings under the short key the feature declares, as the settings o
|
||||
one option its `root` names; there is no second form. A key is unique per target across modules and the host's own
|
||||
JSON fields. The description is in a fixed order and holds module entries only.
|
||||
|
||||
Modules compile against the API `compileOnly` and never ship it. At runtime they can use the API
|
||||
(`com.volmit.*`), the host packages the host chooses to expose, the JDK and the classes in their
|
||||
Modules compile against the API (`com.volmit:iris-api`) `compileOnly` and never ship it. At runtime they can use the
|
||||
API (`com.volmit.*` except the host side `com.volmit.host`, artifact `com.volmit:iris-host`), the host packages the host chooses to expose, the JDK and the classes in their
|
||||
own pack's jars. A host may expose libraries it shares with modules (Iris exposes VolmLib and Gson); any other
|
||||
library a module ships in the pack, never borrowing the host's copy. JDK modules
|
||||
outside the platform class loader, such as `jdk.compiler`, are not available, and neither are JDK
|
||||
@@ -107,7 +107,8 @@ running Iris is the pack publisher's responsibility.
|
||||
`ConfiguredSettings.placement(...)`; the chunk and mantle runners collect a chunk's settings
|
||||
themselves.
|
||||
- Name the packages of the classes Iris describes itself with `ModuleHost.describingHostTypesIn(...)`,
|
||||
decode them as Iris does, and render each `HostKind` with Iris's own description of the class.
|
||||
decode them as Iris does, and render each `HostKind` with Iris's own description of the class. These, and
|
||||
`registerHeldType`, are deprecated for removal: transitional, until the cut-over.
|
||||
- Back each module's log with the host's own: `ModuleHost.loggingTo(logger)` where `logger` writes `DEBUG` only when the
|
||||
host's debug setting is on and writes an `ERROR` with a cause as the host reports its own failures. Implement
|
||||
`PackWorld.log()` (the host's own log) and hand services a world scoped to the provider's module
|
||||
@@ -159,7 +160,12 @@ running Iris is the pack publisher's responsibility.
|
||||
- Build one `ModuleHost` at startup with the built-in modules, exposed packages, reserved JSON
|
||||
fields. Its methods accumulate, so the configuration can be
|
||||
built in steps. Load each pack with `LoadedPack.load(packRoot, host)`
|
||||
and close it only after nothing built from it is in use.
|
||||
and close it only after nothing built from it is in use. Catch `ModuleLoadException`, the one type of every load
|
||||
error, not `RuntimeException`.
|
||||
- Depend on both `com.volmit:iris-api` and `com.volmit:iris-host` and ship both; expose neither the host side nor
|
||||
anything below it to packs (the loader refuses to).
|
||||
- Implement both `PlacementEdit.set` overloads; buffer a plain block (`set(x, y, z, state)`) without building a
|
||||
`PlacedBlock` for it.
|
||||
- Pass a `System.Logger` that writes to the server log to `ModuleHost.loggingTo(...)`, so the
|
||||
per-pack module summary and missing-classes warning are visible, and a cache directory of the host
|
||||
to `ModuleHost.copyingJarsTo(...)` for the jar copies.
|
||||
|
||||
@@ -52,6 +52,14 @@ the JSON fields the host uses itself, host type packages and reserved folders. E
|
||||
configured, and all names are checked when it is built. `LoadedPack` runs `PackModules.load` (below), then
|
||||
`LoadedModules.load` on the built-ins followed by the pack's modules. If the second step fails it
|
||||
closes the first before rethrowing, so a failed load leaves no class loader or jar copy behind.
|
||||
|
||||
Every load error is one unchecked type, `ModuleLoadException`, with `moduleId()` and `origin()` when the error is
|
||||
one module's or one jar's. Jar errors throw it directly with the jar. Anything a module's `setup` throws, the
|
||||
registry's and stage graph's checks included, is wrapped with that module's id and jar, the message unchanged; errors
|
||||
after setup (catalog, studio description, resolution) are wrapped without a module unless the check knows the stage's
|
||||
module. So hosts catch `ModuleLoadException` instead of `RuntimeException`, and a bug in the host itself still
|
||||
surfaces as what it is. `ModuleHost`'s own argument checks stay `IllegalArgumentException`: they are the host's
|
||||
configuration, not a pack's.
|
||||
`close()` closes the pack's class loader, then deletes its jar copies.
|
||||
|
||||
A jar names its entry classes, one per line, in `META-INF/services/com.volmit.IrisModule`, the
|
||||
@@ -136,7 +144,19 @@ Iris provides it at runtime; in production it is shaded into the Iris plugin jar
|
||||
holds Iris internals and the libraries Iris bundles, so it is not the pack loader's parent.
|
||||
`ExposedHostClassLoader` is: it delegates every class in an exposed package, and its subpackages,
|
||||
to the host's loader (the loader that defines the API) and everything else to the platform class
|
||||
loader, which holds the JDK. The api/host split is deferred, so `com.volmit.host` is visible too.
|
||||
loader, which holds the JDK.
|
||||
|
||||
The host side, `com.volmit.host` (with `com.volmit.host.schema`), is never exposed, although it lies inside the
|
||||
API's root package. It is its own Gradle subproject and artifact (`host`, `com.volmit:iris-host`) next to the API
|
||||
(`api`, `com.volmit:iris-api`); Iris depends on both and shades both. `ExposedPackages` carves the host package out
|
||||
of every exposed package (`com.volmit` and anything the host passes), and the host may not expose it explicitly. A
|
||||
pack class that references a host class is therefore a hidden host class and fails the load, and a jar that ships a
|
||||
class anywhere under `com.volmit`, the host side included, fails as shipping API classes.
|
||||
|
||||
*Why keep the name `com.volmit.host`.* The finding allowed a new root such as `com.volmit.hosting`, but any name
|
||||
under `com.volmit` would be exposed as well, and a root outside it (`com.volmithost`) reads like a different
|
||||
vendor. The exposure check can exclude one package exactly, so the carve-out is a single rule in one class, and no
|
||||
import in Iris or the tests changes.
|
||||
|
||||
The platform loader provides the JDK modules defined to it and to the boot loader: `java.base`,
|
||||
`java.sql`, `java.net.http`, `java.compiler` and the other standard modules. JDK modules defined to
|
||||
@@ -424,6 +444,13 @@ return null, since no later stage reads its output; a null output without a reje
|
||||
attempt. Stages receive a buffered
|
||||
`PlacementAccess` view of the edit without commit or close, and it expires with the attempt.
|
||||
|
||||
`PlacementAccess.set(x, y, z, state)` is the per-block write: a placement writes thousands of blocks, and the record
|
||||
form (`set(PlacedBlock)`, for a block entity) costs a position, a record and an `Optional` per block. The edit
|
||||
implements both, so a host buffers a plain block as it likes (Iris keeps states and block entities in separate maps,
|
||||
so a plain block costs only its position key; an index into the placement area does not work, because a placement's
|
||||
area may be unbounded). The access view, its mantle view and that mantle's layer views are made once per attempt, as
|
||||
the chunk runner's mantle view is once per chunk invocation; asking again returns the same object.
|
||||
|
||||
## Random streams
|
||||
|
||||
Every stage has its own random stream per invocation, `StageContext.random()`. There is no shared
|
||||
@@ -690,7 +717,8 @@ core engine is modules as well. The host's own JSON fields are not in it; no key
|
||||
inlined copy, so a class used in many places is described once, and a class that contains itself,
|
||||
directly or through others, ends the walk at its own name. Two different classes with one name fail
|
||||
the load; only a built-in class and a pack class can collide that way.
|
||||
- Modules may also register a class that Iris's own classes hold (`registerHeldType`, `FeatureCatalog.heldTypes()`):
|
||||
- Modules may also register a class that Iris's own classes hold (`registerHeldType`, `FeatureCatalog.heldTypes()`;
|
||||
deprecated for removal, transitional until the cut-over):
|
||||
it is described like any settings class reachable from a feature, but no `FeatureSchema` names it. This is for
|
||||
settings that live in a host class until their feature owns them, such as the clamp of an object placement. The class
|
||||
must be loaded by the host: a built-in module's, or one of a package the host exposes (the built-ins jar's modules
|
||||
@@ -722,7 +750,8 @@ core engine is modules as well. The host's own JSON fields are not in it; no key
|
||||
|
||||
Host types are classes the host describes in studio itself, such as Iris's palettes and noise styles,
|
||||
which built-in settings keep while their features move into modules. The host names their packages with
|
||||
`ModuleHost.describingHostTypesIn(...)`; the builder neither reads their fields nor describes them, and
|
||||
`ModuleHost.describingHostTypesIn(...)` (deprecated for removal with `HostKind`: transitional, until the cut-over, so
|
||||
it does not become permanent); the builder neither reads their fields nor describes them, and
|
||||
the host renders its own description where a `HostKind` appears. Pack modules' settings cannot use them:
|
||||
pack modules never see host classes anyway, and a host type in their settings fails the load. Without
|
||||
this, built-in settings would have to replace every Iris type with a describable copy before any feature
|
||||
|
||||
@@ -8,6 +8,17 @@ in the public contracts. Nothing here is stable yet.
|
||||
what the Iris host adapter still has to provide. Existing Iris features are not ported or wired
|
||||
into this project; the test sources contain example ports only.
|
||||
|
||||
The build has two subprojects, one artifact each:
|
||||
|
||||
| Subproject | Artifact | Packages | Who uses it |
|
||||
| --- | --- | --- | --- |
|
||||
| `api` | `com.volmit:iris-api` | `com.volmit` and its subpackages, except `com.volmit.host` | modules, `compileOnly`; the host |
|
||||
| `host` | `com.volmit:iris-host` | `com.volmit.host` and `com.volmit.host.schema` (depends on `iris-api`) | the host only |
|
||||
|
||||
Pack jars never see the host side, though it lies inside `com.volmit`: the pack loader leaves it out, and a module
|
||||
that references a class of it fails the load. Tests that need both (the loader, the runners, the example ports) live
|
||||
in `host`; `api` tests the value types and `WorldRandom` alone.
|
||||
|
||||
## Modules own their stages
|
||||
|
||||
There are no host-defined hooks or phases. A module declares stages as constants and defines
|
||||
@@ -107,8 +118,9 @@ it treats as its origin. In a placement `ctx.configured(type)` gives the placeme
|
||||
placement declares each settings type once. An entry is found under the class whose `@Feature` declares
|
||||
it, so a value of a subclass counts as its annotated superclass.
|
||||
|
||||
A feature whose settings class has exactly one option may be written as that option's value, such as
|
||||
`"snow": 0.5` for `"snow": {"amount": 0.5}` or a bare list for a class holding one list.
|
||||
Each feature has one JSON shape: the object of its settings class's options, or, when `@Feature` declares
|
||||
`root`, exactly the value of that one option (see "Settings for studio"). There is no shorthand that accepts
|
||||
either form.
|
||||
|
||||
## Coordinates
|
||||
|
||||
@@ -422,8 +434,9 @@ of its classes, passes the stripped ones too (`check(jar, exposedHostPackages, l
|
||||
`--left-out=<file>` on the command line; one Ant pattern or class per line): a jar that references one
|
||||
fails, naming the class.
|
||||
|
||||
A module compiles against the Iris API as `compileOnly` (Maven: `provided`) and never ships it;
|
||||
Iris provides the API at runtime. At runtime a module can use the Iris API (`com.volmit.*`), the
|
||||
A module compiles against the Iris API (`com.volmit:iris-api`) as `compileOnly` (Maven: `provided`) and never ships it;
|
||||
Iris provides the API at runtime. At runtime a module can use the Iris API (`com.volmit.*` except the host side,
|
||||
`com.volmit.host`), the
|
||||
packages the host exposes besides it (the built-in modules' stages and types, so packs can require
|
||||
their stages, and the libraries the host shares: Iris exposes VolmLib, `art.arcane.volmlib`, and Gson,
|
||||
`com.google.gson`), the JDK and the classes in its pack's module jars. Iris internals and the other
|
||||
@@ -530,7 +543,7 @@ public final class FloraSettings implements IrisFeature {
|
||||
it reaches and ignores blank keys and keys naming no biome.
|
||||
- Built-in settings may hold classes the host describes itself, such as Iris's palettes, which the host
|
||||
names with `ModuleHost.describingHostTypesIn(...)`. They appear as `HostKind` and pack modules cannot
|
||||
use them.
|
||||
use them. Both are deprecated for removal: transitional, until the cut-over.
|
||||
- Settings named in `when(...)` and object generator settings are described automatically. Settings
|
||||
that no stage names, such as ones read only through `FeatureSettings.at(...)`, are registered with
|
||||
`setup.registry().registerSettings(WindSettings.class, GustSettings.class)` in `setup`. Their feature id follows the module
|
||||
@@ -538,6 +551,8 @@ public final class FloraSettings implements IrisFeature {
|
||||
- A class of a built-in module that Iris's own classes hold, such as the clamp field of an object placement, is
|
||||
registered with `registry.registerHeldType(Clamp.class)`, so studio describes it from the class (as an
|
||||
`ObjectType`, with no feature). Only built-in modules may; a pack module's class can never be a field of an Iris class.
|
||||
`registerHeldType` (with `HeldTypeRegistration` and `FeatureCatalog.heldTypes()`) is deprecated for removal:
|
||||
transitional, until the cut-over.
|
||||
|
||||
A load error names the field, the settings and the module:
|
||||
|
||||
@@ -717,7 +732,8 @@ once, here), the host packages pack modules may use, the JSON fields it uses its
|
||||
packages of the classes it describes itself and the pack folders it reads itself. Each method adds to what earlier calls configured. Package names,
|
||||
reserved fields and reserved folders are checked when it is built. `LoadedPack.load`
|
||||
loads the pack's jars, sets them up after the built-ins, catalogs settings and registrations,
|
||||
describes them for studio and resolves the three pipelines. It returns a complete pack or throws with nothing left open. `close()`
|
||||
describes them for studio and resolves the three pipelines. It returns a complete pack or throws a
|
||||
`ModuleLoadException` with nothing left open. `close()`
|
||||
releases the pack's class loader and its jar copies. `PackModules` and `LoadedModules`, which it
|
||||
uses, stay available for tests and special cases.
|
||||
|
||||
@@ -737,7 +753,8 @@ Pack modules see the API plus the packages given to `ModuleHost.exposing(...)`,
|
||||
subpackages. The host chooses those packages, such as the ones that hold built-in modules' stage
|
||||
constants. The load (`PackModules`, under `LoadedPack`) reads the entry points of each jar, in jar file
|
||||
name order and in the order each jar lists them, and loads every jar of the pack through one class loader. A pack without a `modules`
|
||||
directory has no modules. Errors name the
|
||||
directory has no modules. Every load error is a `ModuleLoadException` (unchecked), the one type a host catches;
|
||||
`moduleId()` and `origin()` name the module and jar at fault when the error is one module's or one jar's. Errors name the
|
||||
jar: no entry point, a class of an exposed package in the jar, a class that is
|
||||
also in another jar of the pack (both jars are named), a class that uses a class Iris has but hides,
|
||||
a class of a JDK module modules cannot see, a class of a JDK package not exported to modules, a
|
||||
@@ -879,7 +896,11 @@ Optional<Clock> clock = pack.catalog().service(Clock.class); // a Pro
|
||||
`PackResources.noise()` builds noise samplers from `NoiseStyle`s.
|
||||
- `GeneratedObject` is sparse, immutable local geometry. `PlacementRequest` aligns its anchor
|
||||
with a world position using checked arithmetic.
|
||||
- `Hunk<T>` is a dense local volume; `ArrayHunk<T>` is the bounds-checked reference.
|
||||
- `Hunk<T>` is a dense local volume (`width()`, `height()`, `depth()`); `ArrayHunk<T>` is the bounds-checked reference.
|
||||
- A placement stage writes a plain block with `access.set(x, y, z, state)`, without a position, record or `Optional`;
|
||||
a block with a block entity goes through `access.set(PlacedBlock)`. `BlockState.withProperty` copies the properties once.
|
||||
- Invocation views (`ctx.mantle()`, its layers and blocks, a placement's `access().mantle()`) are made once per
|
||||
invocation, so asking again returns the same view.
|
||||
- The `mantle` package keeps namespaced typed layers, codecs, lifetimes and buffered edits.
|
||||
- `IrisFeature`, `@Feature`, the config annotations (`@Desc`, `@Required`, `@MinNumber`,
|
||||
`@MaxNumber`, `@MinItems`, `@Snippet`, `@Ref`) describe settings; the host reads them with `OptionsMetadata`
|
||||
@@ -905,7 +926,7 @@ requirements, chunk stages that declare reach or mantle writes (`StageGraphTest`
|
||||
that draws leaves the other stages' draws unchanged, block stages draw one stream across their pass,
|
||||
and the derivation is pinned to values computed from its specification (`StageStreamsTest`).
|
||||
`WorldRandomTest` pins every `WorldRandom` method, bounds and edge cases to values computed by an
|
||||
independent Python reference (`python3 -B src/test/reference/world_random.py`; the build does not
|
||||
independent Python reference (`python3 -B api/src/test/reference/world_random.py`; the build does not
|
||||
need Python) and fails if the type gains an unpinned method or implements `RandomGenerator`.
|
||||
`PackSchemaTest` loads module jars and checks their description: features under their targets by key, a root option,
|
||||
options in declaration order,
|
||||
@@ -947,8 +968,9 @@ which JDK packages they may not use. `PackModulesAddExportsTest` runs in its own
|
||||
`addExportsTest` task that `check` runs, started with
|
||||
`--add-exports java.base/jdk.internal.misc=ALL-UNNAMED`; it checks that the exported package then
|
||||
loads and that other internal packages are still reported. `PackModulesSummaryTest` and `MissingClassesWarningTest` check the log texts. The example
|
||||
ports in `src/test/java/com/volmit/example` rebuild preparation, anchoring, block writes, stilt and
|
||||
ports in `host/src/test/java/com/volmit/example` rebuild preparation, anchoring, block writes, stilt and
|
||||
snow as separate modules, add a third-party moss module, and add a two-module chunk pipeline whose
|
||||
`ChunkPipelineTest` checks any-column activation, per-column reads, stacked levels, a mantle stage
|
||||
whose reach follows the pack's longest vein writing into the next chunk that a chunk stage then reads, and that a chunk stage writes the mantle of its own chunk only. There
|
||||
is no Minecraft integration or production storage in these tests.
|
||||
whose reach follows the pack's longest vein writing into the next chunk that a chunk stage then reads, that a chunk stage writes the mantle of its own chunk only, and that
|
||||
one invocation makes its mantle views once (`StageGraphTest` checks the same for a placement). `ExposedPackagesTest`
|
||||
also checks that the host side is never exposed. There is no Minecraft integration or production storage in these tests.
|
||||
@@ -0,0 +1,4 @@
|
||||
// The module API (com.volmit and its subpackages except com.volmit.host). Modules compile against this artifact only.
|
||||
base {
|
||||
archivesName.set("iris-api")
|
||||
}
|
||||
+4
@@ -40,7 +40,11 @@ public interface FeatureRegistry {
|
||||
* one of the host's classes, so registering one fails the load). The host reads the class
|
||||
* with its fields in pack JSON, and the class follows the rules of settings classes. Registering a class twice
|
||||
* changes nothing.
|
||||
*
|
||||
* @deprecated Transitional, until the cut-over: only while Iris's own classes still hold built-in module types.
|
||||
* Removed once they do not.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
void registerHeldType(Class<?> type);
|
||||
|
||||
/** Declares a kind of pack resource this module reads: the JSON files under the kind's folder, served through
|
||||
File renamed without changes.
+2
-2
@@ -3,8 +3,8 @@ package com.volmit;
|
||||
/** A unit of world-generation behavior. The core engine is an ordinary module too.
|
||||
*
|
||||
* <p>In a pack's module jar this class is the entry point. The jar names it in
|
||||
* {@code META-INF/services/com.volmit.IrisModule}, and it needs a public no-argument constructor.
|
||||
* One jar holds exactly one module.
|
||||
* {@code META-INF/services/com.volmit.IrisModule}, one entry class per line, and it needs a public no-argument
|
||||
* constructor. A jar holds one or more modules.
|
||||
*/
|
||||
public interface IrisModule {
|
||||
ModuleInfo info();
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+53
-11
@@ -1,10 +1,13 @@
|
||||
package com.volmit.block;
|
||||
|
||||
import com.volmit.resource.ResourceId;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/** Immutable, platform-neutral block description with value equality.
|
||||
@@ -15,18 +18,16 @@ public record BlockState(ResourceId material, Map<String, String> properties) {
|
||||
private static final String PROPERTIES_START = "[";
|
||||
private static final String PROPERTIES_END = "]";
|
||||
private static final String PROPERTY_SEPARATOR = ",";
|
||||
private static final Pattern PROPERTY_NAME = Pattern.compile("[a-z0-9_]+");
|
||||
private static final Pattern PROPERTY_VALUE = Pattern.compile("[a-z0-9_.-]+");
|
||||
|
||||
public BlockState {
|
||||
Objects.requireNonNull(material, "material");
|
||||
var copy = new TreeMap<String, String>();
|
||||
properties.forEach((name, value) -> {
|
||||
if (name == null || value == null) throw new NullPointerException("Block property");
|
||||
if (!name.matches("[a-z0-9_]+") || !value.matches("[a-z0-9_.-]+")) {
|
||||
throw new IllegalArgumentException("Invalid block property: " + name + "=" + value);
|
||||
}
|
||||
copy.put(name, value);
|
||||
});
|
||||
properties = Collections.unmodifiableMap(copy);
|
||||
if (!(properties instanceof CheckedProperties)) {
|
||||
var copy = new TreeMap<String, String>();
|
||||
properties.forEach((name, value) -> copy.put(requireValid(name, value), value));
|
||||
properties = new CheckedProperties(copy);
|
||||
}
|
||||
}
|
||||
|
||||
public BlockState(String material) { this(ResourceId.parse(material), Map.of()); }
|
||||
@@ -49,10 +50,11 @@ public record BlockState(ResourceId material, Map<String, String> properties) {
|
||||
return new BlockState(ResourceId.parse(key.substring(0, open)), properties);
|
||||
}
|
||||
|
||||
/** This state with {@code name} set to {@code value}. Copies the properties once and checks only the new one. */
|
||||
public BlockState withProperty(String name, String value) {
|
||||
var changed = new TreeMap<>(properties);
|
||||
changed.put(name, value);
|
||||
return new BlockState(material, changed);
|
||||
changed.put(requireValid(name, value), value);
|
||||
return new BlockState(material, new CheckedProperties(changed));
|
||||
}
|
||||
|
||||
/** Stable representation with properties in lexical order. */
|
||||
@@ -62,4 +64,44 @@ public record BlockState(ResourceId material, Map<String, String> properties) {
|
||||
.map(entry -> entry.getKey() + "=" + entry.getValue())
|
||||
.collect(Collectors.joining(PROPERTY_SEPARATOR, PROPERTIES_START, PROPERTIES_END));
|
||||
}
|
||||
|
||||
/** Returns {@code name} once it and {@code value} are a valid property. */
|
||||
private static String requireValid(String name, String value) {
|
||||
if (name == null || value == null) throw new NullPointerException("Block property");
|
||||
if (!PROPERTY_NAME.matcher(name).matches() || !PROPERTY_VALUE.matcher(value).matches()) {
|
||||
throw new IllegalArgumentException("Invalid block property: " + name + "=" + value);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/** Validated properties in key order that nobody can change. Only this class makes them, so the constructor takes
|
||||
* them as they are instead of checking and copying them again.
|
||||
*/
|
||||
private static final class CheckedProperties extends AbstractMap<String, String> {
|
||||
private final Map<String, String> sorted;
|
||||
|
||||
private CheckedProperties(TreeMap<String, String> sorted) {
|
||||
this.sorted = Collections.unmodifiableMap(sorted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<String, String>> entrySet() {
|
||||
return sorted.entrySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(Object key) {
|
||||
return sorted.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return sorted.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return sorted.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-3
@@ -8,9 +8,9 @@ package com.volmit.hunk;
|
||||
* This is a new minimal contract, not a copy of Iris's full Hunk implementation.
|
||||
*/
|
||||
public interface Hunk<T> {
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
int getDepth();
|
||||
int width();
|
||||
int height();
|
||||
int depth();
|
||||
T get(int x, int y, int z);
|
||||
void set(int x, int y, int z, T value);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5
@@ -1,5 +1,6 @@
|
||||
package com.volmit.placement;
|
||||
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.mantle.Mantle;
|
||||
import com.volmit.world.BlockView;
|
||||
|
||||
@@ -10,6 +11,10 @@ import com.volmit.world.BlockView;
|
||||
* Out-of-area access throws; nested mantle edits are unsupported. Do not retain this view.
|
||||
*/
|
||||
public interface PlacementAccess extends BlockView {
|
||||
/** Writes {@code state} without a block entity, replacing any block entity buffered there. The per-block write. */
|
||||
void set(int x, int y, int z, BlockState state);
|
||||
|
||||
/** Writes a block with its block entity, if it has one. */
|
||||
void set(PlacedBlock block);
|
||||
void marker(PlacedMarker marker);
|
||||
Mantle mantle();
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 309 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user