diff --git a/README.md b/README.md index 8f1513f25..1404c8a15 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,8 @@ stilt, `VacuumProfile`, `PlaceTrait`s) that the placement stages ask; the pack J 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` describes -the same JSON as Iris's `IrisObjectPlacement` and keeps the JSON it was read from, because Iris's placement stages still read -a placement as their own class (`ObjectPlacements.host`). What a jar cannot do, Iris does through the facades `ObjectHost` and +`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 @@ -94,13 +93,13 @@ only: `DepositSettings` (`art.arcane.iris.modules.deposit`) holds `DepositGenera 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). -Settings that live inside a class of Iris's own, such as an object placement's 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.*`). A module registers each with -`registry.registerHeldType(...)` so studio describes it from the module's own annotations. A module in the built-ins jar may -too, because the classes are in the exposed package: the placement stages register what Iris's `IrisObjectPlacement` holds -(`iris:prepare` its slope clip and rotation clamp, `iris:validate` its limit, `iris:stilt`, `iris:vacuum`, `iris:blocks` its -replace). Packs write the same JSON as before. Behaviour +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()`), and keeps +what it makes of the placement in `hostForm()`; 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`). @@ -210,11 +209,10 @@ IrisApi purpose seeds: `world.seed(IrisSeedPurposes.CARVE)` (`iris:seed/carve`), had, so existing worlds generate the same; `spawn.SpawnCooldowns` (the spawner cooldowns Iris saves with the world's data, so they survive a restart), `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`, which the modules -register as held types, because Iris's `IrisObjectPlacement` holds them). The placement stages need more of the object being +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 -Iris's `IrisObjectPlacement`), the terrain questions of its placer and the world around it (`PlacementTerrain`), the surface warp, +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 diff --git a/src/main/java/art/arcane/iris/builtin/objects/ObjectPlacement.java b/src/main/java/art/arcane/iris/builtin/objects/ObjectPlacement.java index faf5429a6..f012c04ad 100644 --- a/src/main/java/art/arcane/iris/builtin/objects/ObjectPlacement.java +++ b/src/main/java/art/arcane/iris/builtin/objects/ObjectPlacement.java @@ -185,9 +185,93 @@ public final class ObjectPlacement implements PlacementSource { 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; + 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; + hostForm = source.hostForm; + } + + /** 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 place() { - return place == null ? List.of() : Collections.unmodifiableList(place); + return listOf(place); + } + + public ObjectRotation rotation() { + return rotation; + } + + public ObjectLimit clamp() { + return clamp; + } + + public double snow() { + return snow; + } + + @Override + public boolean isDolphinTarget() { + return isDolphinTarget; + } + + public SlopeClip slopeCondition() { + return slopeCondition; + } + + public boolean rotateTowardsSlope() { + return rotateTowardsSlope; } @Override @@ -212,16 +296,86 @@ public final class ObjectPlacement implements PlacementSource { return (int) ((densityStyle.max() + densityStyle.min()) / 2); } - public ObjectRotation rotation() { - return rotation; + public Optional stiltSettings() { + return Optional.ofNullable(stiltSettings); } - public ObjectTranslate translate() { - return translate; + public Optional vacuumSettings() { + return Optional.ofNullable(vacuumSettings); } - public ObjectScale scale() { - return scale; + public int boreExtendMaxY() { + return boreExtendMaxY; + } + + public List markers() { + return listOf(markers); + } + + public int boreExtendMinY() { + return boreExtendMinY; + } + + @Override + public boolean underwater() { + return underwater; + } + + @Override + public CarvingMode carvingSupport() { + return carvingSupport; + } + + @Override + public int surfaceSupportBuffer() { + return surfaceSupportBuffer; + } + + public int surfaceSupportDepth() { + return surfaceSupportDepth; + } + + @Override + public boolean requireSurfaceSupport() { + return requireSurfaceSupport; + } + + @Override + public CaveAnchorMode caveAnchorMode() { + return caveAnchorMode; + } + + /** The virtual heightmap the objects place on instead of the terrain, if one is set. */ + public Optional 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() { @@ -233,55 +387,58 @@ public final class ObjectPlacement implements PlacementSource { return mode; } - public Optional vacuumSettings() { - return Optional.ofNullable(vacuumSettings); + public List edit() { + return listOf(edit); } - @Override - public CarvingMode carvingSupport() { - return carvingSupport; + public ObjectTranslate translate() { + return translate; } - @Override - public CaveAnchorMode caveAnchorMode() { - return caveAnchorMode; + public ObjectScale scale() { + return scale; } - @Override - public boolean underwater() { - return underwater; + public List loot() { + return listOf(loot); } - @Override - public boolean isDolphinTarget() { - return isDolphinTarget; + public List vanillaLoot() { + return listOf(vanillaLoot); + } + + public boolean overrideGlobalLoot() { + return overrideGlobalLoot; + } + + public List 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 allowedCollisions() { + return listOf(allowedCollisions); + } + + public List forbiddenCollisions() { + return listOf(forbiddenCollisions); } public boolean forcePlace() { return forcePlace; } - @Override - public boolean requireSurfaceSupport() { - return requireSurfaceSupport; - } - - @Override - public int surfaceSupportBuffer() { - return surfaceSupportBuffer; - } - - public List trees() { - return trees == null ? List.of() : Collections.unmodifiableList(trees); - } - - /** The JSON this placement was read from, which Iris reads again as its own placement; null for one made in code. */ + /** The JSON this placement was read from, which declares its module settings; null for one made in code. */ public String json() { return json; } /** - * What Iris made of {@link #json()} the last time it asked, kept here so it asks once. Only Iris sets or reads it, + * What Iris made of this placement the last time it asked, kept here so it asks once. Only Iris sets or reads it, * and it is its own type. */ public Object hostForm() { @@ -292,6 +449,228 @@ public final class ObjectPlacement implements PlacementSource { this.hostForm = form; } + private static List listOf(List 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 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; + placement.hostForm = null; + 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 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; + placement.hostForm = null; + 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; + placement.hostForm = null; + return this; + } + + public Builder mode(ObjectPlaceMode mode) { + placement.mode = mode; + return this; + } + + public Builder edit(List 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 loot) { + placement.loot = List.copyOf(loot); + return this; + } + + public Builder vanillaLoot(List vanillaLoot) { + placement.vanillaLoot = List.copyOf(vanillaLoot); + return this; + } + + public Builder overrideGlobalLoot(boolean override) { + placement.overrideGlobalLoot = override; + return this; + } + + public Builder trees(List trees) { + placement.trees = List.copyOf(trees); + return this; + } + + public Builder allowedCollisions(List keys) { + placement.allowedCollisions = List.copyOf(keys); + return this; + } + + public Builder forbiddenCollisions(List 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 diff --git a/src/main/java/art/arcane/iris/builtin/prepare/ObjectRotation.java b/src/main/java/art/arcane/iris/builtin/prepare/ObjectRotation.java index 8cde2c559..9e3c51289 100644 --- a/src/main/java/art/arcane/iris/builtin/prepare/ObjectRotation.java +++ b/src/main/java/art/arcane/iris/builtin/prepare/ObjectRotation.java @@ -18,14 +18,25 @@ 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; -/** How an object is turned around each axis, written as a placement's {@code rotation}. */ +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("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; @@ -42,7 +53,7 @@ public final class ObjectRotation { public ObjectRotation() { } - /** A rotation with the given axes, as Iris's own rotation model hands them to the placement stages. */ + /** 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; @@ -52,6 +63,34 @@ public final class ObjectRotation { 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; } @@ -91,4 +130,150 @@ public final class ObjectRotation { } 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); + } } diff --git a/src/main/java/art/arcane/iris/engine/loot/LootModule.java b/src/main/java/art/arcane/iris/engine/loot/LootModule.java index 3da073e4d..4e4b10285 100644 --- a/src/main/java/art/arcane/iris/engine/loot/LootModule.java +++ b/src/main/java/art/arcane/iris/engine/loot/LootModule.java @@ -20,8 +20,6 @@ package art.arcane.iris.engine.loot; import art.arcane.iris.modules.loot.BlockDropSettings; import art.arcane.iris.builtin.loot.LootSettings; -import art.arcane.iris.builtin.loot.ObjectLoot; -import art.arcane.iris.builtin.loot.ObjectVanillaLoot; import com.volmit.IrisModule; import com.volmit.ModuleInfo; import com.volmit.ModuleSetup; @@ -46,8 +44,6 @@ public final class LootModule implements IrisModule { public void setup(ModuleSetup setup) { var registry = setup.registry(); registry.registerSettings(LootSettings.class, BlockDropSettings.class); - registry.registerHeldType(ObjectLoot.class); - registry.registerHeldType(ObjectVanillaLoot.class); LootResources.kinds().forEach(registry::registerResourceKind); registry.registerValidator(new LootValidator()); registry.registerService(Loot.class, new LootGiving()); diff --git a/src/main/java/art/arcane/iris/engine/object/placement/BlocksModule.java b/src/main/java/art/arcane/iris/engine/object/placement/BlocksModule.java index efc33ebaa..29eb88f06 100644 --- a/src/main/java/art/arcane/iris/engine/object/placement/BlocksModule.java +++ b/src/main/java/art/arcane/iris/engine/object/placement/BlocksModule.java @@ -21,7 +21,6 @@ package art.arcane.iris.engine.object.placement; import art.arcane.iris.builtin.IrisStages; import art.arcane.iris.builtin.anchor.PlaceTrait; import art.arcane.iris.builtin.blocks.ObjectMarkers; -import art.arcane.iris.builtin.blocks.ObjectReplace; import art.arcane.iris.builtin.blocks.WrittenBlocks; import art.arcane.iris.builtin.carve.CarvingMode; import art.arcane.iris.builtin.placement.MarkerRule; @@ -87,7 +86,6 @@ public final class BlocksModule implements IrisModule { .requires(IrisStages.Blocks.WRITE, IrisStages.Blocks.MARKERS) .run(context -> { }); - setup.registry().registerHeldType(ObjectReplace.class); } private static void write(BlockStageContext context, WrittenBlocks written) { diff --git a/src/main/java/art/arcane/iris/engine/object/placement/PrepareModule.java b/src/main/java/art/arcane/iris/engine/object/placement/PrepareModule.java index 3479bfc8a..d5df41e61 100644 --- a/src/main/java/art/arcane/iris/engine/object/placement/PrepareModule.java +++ b/src/main/java/art/arcane/iris/engine/object/placement/PrepareModule.java @@ -31,7 +31,6 @@ import art.arcane.iris.builtin.prepare.ObjectRotation; import art.arcane.iris.builtin.prepare.ObjectSpinKernel; import art.arcane.iris.builtin.prepare.ObjectTranslate; import art.arcane.iris.builtin.prepare.PreparedPlacement; -import art.arcane.iris.builtin.prepare.SlopeClip; import art.arcane.iris.builtin.prepare.TransformedBounds; import art.arcane.volmlib.util.math.IrisBlockVector; import art.arcane.volmlib.util.math.RNG; @@ -66,9 +65,6 @@ public final class PrepareModule implements IrisModule { graph.define(IrisStages.Prepare.TRANSFORMS) .requires(IrisStages.Prepare.SLOPE) .produce(PrepareModule::transforms); - var registry = setup.registry(); - registry.registerHeldType(SlopeClip.class); - registry.registerHeldType(AxisRotationClamp.class); } private static ObjectRotation slope(PlacementStageContext context) { diff --git a/src/main/java/art/arcane/iris/engine/object/placement/StiltModule.java b/src/main/java/art/arcane/iris/engine/object/placement/StiltModule.java index a1ee111bd..5ef55b48c 100644 --- a/src/main/java/art/arcane/iris/engine/object/placement/StiltModule.java +++ b/src/main/java/art/arcane/iris/engine/object/placement/StiltModule.java @@ -79,7 +79,6 @@ public final class StiltModule implements IrisModule { graph.define(IrisStages.Stilt.FILL) .requires(IrisStages.Stilt.LAYERS, IrisStages.Anchor.FINAL, IrisStages.Blocks.COMPLETE) .run(StiltModule::fill); - setup.registry().registerHeldType(StiltSettings.class); } private static void collectLayer(BlockStageContext context, StiltLayers layers) { diff --git a/src/main/java/art/arcane/iris/engine/object/placement/VacuumModule.java b/src/main/java/art/arcane/iris/engine/object/placement/VacuumModule.java index 9627612ba..f263a2ae9 100644 --- a/src/main/java/art/arcane/iris/engine/object/placement/VacuumModule.java +++ b/src/main/java/art/arcane/iris/engine/object/placement/VacuumModule.java @@ -61,7 +61,6 @@ public final class VacuumModule implements IrisModule { .requires(IrisStages.Blocks.WRITE, IrisStages.Blocks.COMPLETE, IrisStages.Prepare.TRANSFORMS) .reach(IrisObjectVacuum.MAX_RADIUS_BLOCKS) .run(VacuumModule::bendTerrain); - setup.registry().registerHeldType(VacuumSettings.class); } private static void bendTerrain(PlacementStageContext context) { diff --git a/src/main/java/art/arcane/iris/engine/object/placement/ValidateModule.java b/src/main/java/art/arcane/iris/engine/object/placement/ValidateModule.java index a8e8d03cd..487e21d8f 100644 --- a/src/main/java/art/arcane/iris/engine/object/placement/ValidateModule.java +++ b/src/main/java/art/arcane/iris/engine/object/placement/ValidateModule.java @@ -29,7 +29,6 @@ import art.arcane.iris.builtin.placement.PlacementTerrain; import art.arcane.iris.builtin.placement.StructureVolumes; import art.arcane.iris.builtin.prepare.PreparedPlacement; import art.arcane.iris.builtin.terrain.BedrockSettings; -import art.arcane.iris.builtin.validate.ObjectLimit; import com.volmit.IrisModule; import com.volmit.ModuleInfo; import com.volmit.ModuleLog; @@ -75,7 +74,6 @@ public final class ValidateModule implements IrisModule { graph.define(IrisStages.Validate.COLLISIONS) .requires(IrisStages.Validate.STRUCTURES, IrisStages.Anchor.HEIGHT) .run(ValidateModule::checkCollisions); - setup.registry().registerHeldType(ObjectLimit.class); } private static void checkSurface(PlacementStageContext context) { diff --git a/src/main/java/art/arcane/iris/engine/object/prefab/IrisObjectPlacementScaleInterpolator.java b/src/main/java/art/arcane/iris/engine/object/prefab/IrisObjectPlacementScaleInterpolator.java deleted file mode 100644 index 4df6edd8a..000000000 --- a/src/main/java/art/arcane/iris/engine/object/prefab/IrisObjectPlacementScaleInterpolator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 . - */ - -package art.arcane.iris.engine.object.prefab; - -import art.arcane.iris.engine.object.annotations.Desc; - -@Desc("Use 3D Interpolation on scaled objects if they are larger than the origin.") -public enum IrisObjectPlacementScaleInterpolator { - @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 -} diff --git a/src/main/java/art/arcane/iris/engine/spawn/SpawnModule.java b/src/main/java/art/arcane/iris/engine/spawn/SpawnModule.java index 78f805d35..791a3ae65 100644 --- a/src/main/java/art/arcane/iris/engine/spawn/SpawnModule.java +++ b/src/main/java/art/arcane/iris/engine/spawn/SpawnModule.java @@ -19,7 +19,6 @@ package art.arcane.iris.engine.spawn; import art.arcane.iris.modules.spawn.EffectSettings; -import art.arcane.iris.builtin.spawn.PlacementMarker; import art.arcane.iris.modules.spawn.SpawnerSettings; import com.volmit.IrisModule; import com.volmit.ModuleInfo; @@ -46,7 +45,6 @@ public final class SpawnModule implements IrisModule { public void setup(ModuleSetup setup) { var registry = setup.registry(); registry.registerSettings(SpawnerSettings.class, EffectSettings.class); - registry.registerHeldType(PlacementMarker.class); SpawnResources.kinds().forEach(registry::registerResourceKind); registry.registerService(EntitySpawns.class, new EntitySpawning()); registry.registerService(AmbientEffects.class, new AmbientEffecting());