Hand Iris the placement, its record, the shuffle seed and the floor

ObjectRun gives the placement's name and JSON to the run, iris:objects declares
the placement type with its JSON names, and placements are recorded as typed
PlacementRecords instead of key@id texts (Iris keeps the text form, so
StructurePlacementMarker moves to Iris). iris:loot gives the seed a container is
shuffled with and iris:terrain says it protects the floor. The five Iris-only
entity knobs are fields of the EntitySpec, so IrisEntityExtras is gone.
This commit is contained in:
piexel committed 2026-10-28 04:02:52 +01:00
1 parent 98c3c96881
commit 83bc859b31
17 files changed
+103 -196

No files matched your search

@@ -52,9 +52,14 @@ 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
@@ -437,6 +442,29 @@ public final class ObjectPlacement implements PlacementSource {
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;
}
/**
* 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.
@@ -110,7 +110,8 @@ public final class ObjectRun {
object = objects.smartBored(object);
}
PlacementRequest request = new PlacementRequest(object.geometry(), new BlockPosition(x, requestedY, z));
return new PlacementRun(request, area(), terrain, this, placementSeed(worldSeed));
return new PlacementRun(request, object.name(), Optional.ofNullable(settings.json()), area(), terrain, this,
placementSeed(worldSeed));
}
public PlaceableObject object() {
@@ -1,46 +0,0 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.spawn;
import java.util.Objects;
import java.util.Optional;
/**
* Iris extension of an {@link com.volmit.entity.EntitySpec}, read by Iris's Bukkit host with
* {@code spec.extension(IrisEntityExtras.class)}: what Iris packs set on an entity that only Bukkit has a name for or
* only Iris does. Other hosts ignore it.
*
* @param reason Bukkit's spawn reason by name, such as {@code COMMAND}; empty for a natural spawn
* @param riseOutOfGround whether the entity slowly climbs out of the ground when players are near
* @param pandaMainGene for pandas the main gene by Bukkit's name; empty to leave it to the platform
* @param pandaHiddenGene for pandas the hidden gene by Bukkit's name; empty to leave it to the platform
* @param applySettingsToProvidedMob whether the rest of the spec also applies to a mob of a content provider, which is
* otherwise left as the provider set it up
*/
public record IrisEntityExtras(Optional<String> reason, boolean riseOutOfGround, Optional<String> pandaMainGene,
Optional<String> pandaHiddenGene, boolean applySettingsToProvidedMob) {
/** What an entity without the extension gets: a natural spawn, standing, with the platform's genes. */
public static final IrisEntityExtras NONE = new IrisEntityExtras(Optional.empty(), false, Optional.empty(), Optional.empty(), false);
public IrisEntityExtras {
Objects.requireNonNull(reason, "reason");
Objects.requireNonNull(pandaMainGene, "pandaMainGene");
Objects.requireNonNull(pandaHiddenGene, "pandaHiddenGene");
}
}
@@ -18,6 +18,7 @@
package art.arcane.iris.builtin.structure;
import com.volmit.generation.InvocationContext;
import com.volmit.resource.ResourceId;
import java.util.List;
import java.util.Optional;
@@ -36,5 +37,5 @@ public interface StructureHost {
int reach();
/** The loot tables the structure gives its pieces' containers; empty when the pack has no such structure. */
Optional<List<String>> lootTables(String structureKey);
Optional<List<String>> lootTables(ResourceId structure);
}
@@ -1,95 +0,0 @@
package art.arcane.iris.builtin.structure;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Objects;
public final class StructurePlacementMarker {
private static final String FAMILY_PREFIX = "@iris-structure:";
private static final String VERSION_PREFIX = FAMILY_PREFIX + "v1:";
private StructurePlacementMarker() {
}
public static String encodeStructure(String objectKey, int placementId, String structureKey) {
String normalizedObjectKey = requireKey(objectKey, "objectKey");
String normalizedStructureKey = requireKey(structureKey, "structureKey");
return VERSION_PREFIX
+ encodeKey(normalizedObjectKey)
+ ":" + placementId
+ ":" + encodeKey(normalizedStructureKey);
}
public static Decoded decode(String marker) {
if (marker == null || marker.isBlank()) {
return null;
}
if (marker.startsWith(FAMILY_PREFIX)) {
return decodeStructure(marker);
}
return decodeLegacy(marker);
}
private static Decoded decodeStructure(String marker) {
if (!marker.startsWith(VERSION_PREFIX)) {
return null;
}
String[] fields = marker.split(":", -1);
if (fields.length != 5 || !fields[0].equals("@iris-structure") || !fields[1].equals("v1")) {
return null;
}
try {
String objectKey = decodeCanonicalKey(fields[2]);
int placementId = Integer.parseInt(fields[3]);
String structureKey = decodeCanonicalKey(fields[4]);
if (objectKey.isBlank() || structureKey.isBlank()) {
return null;
}
return new Decoded(objectKey, placementId, structureKey);
} catch (IllegalArgumentException exception) {
return null;
}
}
private static Decoded decodeLegacy(String marker) {
int separator = marker.indexOf('@');
if (separator <= 0 || separator != marker.lastIndexOf('@') || separator == marker.length() - 1) {
return null;
}
String objectKey = marker.substring(0, separator);
if (objectKey.isEmpty() || objectKey.equals("null")) {
return null;
}
try {
return new Decoded(objectKey, Integer.parseInt(marker.substring(separator + 1)), null);
} catch (NumberFormatException exception) {
return null;
}
}
private static String requireKey(String key, String name) {
String required = Objects.requireNonNull(key, name);
if (required.isBlank()) {
throw new IllegalArgumentException(name + " must not be blank");
}
return required;
}
private static String encodeKey(String key) {
return Base64.getUrlEncoder().withoutPadding().encodeToString(key.getBytes(StandardCharsets.UTF_8));
}
private static String decodeCanonicalKey(String key) {
String decoded = new String(Base64.getUrlDecoder().decode(key), StandardCharsets.UTF_8);
if (!encodeKey(decoded).equals(key)) {
throw new IllegalArgumentException("Non-canonical marker key");
}
return decoded;
}
public record Decoded(String objectKey, int placementId, String structureKey) {
public boolean structureAware() {
return structureKey != null;
}
}
}
@@ -36,6 +36,7 @@ import com.volmit.IrisModule;
import com.volmit.ModuleInfo;
import com.volmit.ModuleLifecycle;
import com.volmit.ModuleSetup;
import com.volmit.service.ProtectedFloor;
import com.volmit.stage.ChunkStageContext;
import com.volmit.world.PackWorld;
@@ -63,9 +64,15 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
WallSettings.class, LockLayersSettings.class, LockLayersMaxSettings.class, RockPaletteSettings.class, FluidPaletteSettings.class,
OreSettings.class, HideOresSettings.class, BedrockSettings.class, ExplodeBiomePalettesSettings.class,
ExplodeBiomePaletteSizeSettings.class);
registry.registerService(ProtectedFloor.class, TerrainModule::protectsFloor);
registry.registerLifecycle(this);
}
/** The bedrock row belongs to the terrain while the dimension has bedrock, as it does unless the pack says otherwise. */
private static boolean protectsFloor(PackWorld world) {
return world.settings().declared(BedrockSettings.class).dimension().map(BedrockSettings::bedrock).orElse(true);
}
@Override
public void warmUp(PackWorld world) {
TerrainPalettes.of(world).warm();
@@ -31,6 +31,7 @@ import com.volmit.world.PackWorld;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.OptionalLong;
/**
* How {@code iris:loot} fills containers: the tables of the object placed around a container, then those of the
@@ -78,6 +79,12 @@ public final class LootGiving implements Loot {
.draw(tableId.path(), table, lootSeed(world), site.position().x(), worldY, site.position().z());
}
@Override
public OptionalLong shuffleSeed(PackWorld world, Site site) {
int worldY = site.position().y() + world.minWorldY();
return OptionalLong.of(LootResolver.containerSeed(lootSeed(world), site.position().x(), worldY, site.position().z()));
}
private static PlacementLoot placementLoot(PackWorld world) {
return new PlacementLoot(world.resources(), () -> world.running().orElseThrow().platformLootTables(), lootSeed(world), world.log());
}
@@ -23,10 +23,11 @@ import art.arcane.iris.builtin.loot.ObjectVanillaLoot;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.builtin.objects.ObjectSettings;
import art.arcane.iris.builtin.structure.StructureHost;
import art.arcane.iris.builtin.structure.StructurePlacementMarker;
import com.volmit.config.Level;
import com.volmit.config.SettingsStack;
import com.volmit.placement.PlacementRecord;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.world.PackWorld;
import com.volmit.world.RunningWorld;
@@ -68,39 +69,39 @@ final class PlacedObjectLoot {
/** The loot of the object placed at the block; empty when no object placement covers the block. Y is above the dimension's bottom. */
static Optional<ObjectLoots> at(PackWorld world, int x, int y, int z) {
RunningWorld running = world.running().orElseThrow();
Optional<StructurePlacementMarker.Decoded> marker = running.placementAt(x, y, z).map(StructurePlacementMarker::decode);
if (marker.isEmpty() || marker.get().objectKey().startsWith(PROCEDURAL_PREFIX)) {
Optional<PlacementRecord> recorded = running.placementAt(x, y, z);
if (recorded.isEmpty() || recorded.get().object().path().startsWith(PROCEDURAL_PREFIX)) {
return Optional.empty();
}
String objectKey = marker.get().objectKey();
Optional<ObjectPlacement> placement = marker.get().structureAware()
? structurePlacement(world, marker.get().structureKey(), objectKey)
: columnPlacement(running.settings().at(ObjectSettings.class, x, z), objectKey);
ResourceId object = recorded.get().object();
Optional<ObjectPlacement> placement = recorded.get().structure().isPresent()
? structurePlacement(world, recorded.get().structure().get(), object)
: columnPlacement(world.resources(), running.settings().at(ObjectSettings.class, x, z), object);
return placement.map(found -> new ObjectLoots(found.loot(), found.vanillaLoot(), found.overrideGlobalLoot()));
}
/** A structure piece's object gives every table its structure names, each once. */
private static Optional<ObjectPlacement> structurePlacement(PackWorld world, String structureKey, String objectKey) {
Optional<List<String>> tables = world.extension(StructureHost.class).orElseThrow().lootTables(structureKey);
PackResources resources = world.resources();
if (tables.isEmpty() || resources.objects().object(resources.idOf(objectKey)).isEmpty()) {
private static Optional<ObjectPlacement> structurePlacement(PackWorld world, ResourceId structure, ResourceId object) {
Optional<List<String>> tables = world.extension(StructureHost.class).orElseThrow().lootTables(structure);
if (tables.isEmpty() || world.resources().objects().object(object).isEmpty()) {
return Optional.empty();
}
List<ObjectLoot> loot = new ArrayList<>();
for (String table : tables.get()) {
loot.add(new ObjectLoot(table, STRUCTURE_TABLE_WEIGHT));
}
return Optional.of(ObjectPlacement.builder().place(List.of(objectKey)).loot(loot).build());
return Optional.of(ObjectPlacement.builder().place(List.of(object.path())).loot(loot).build());
}
private static Optional<ObjectPlacement> columnPlacement(SettingsStack<ObjectSettings> declared, String objectKey) {
Optional<ObjectPlacement> fromRegion = declared.level(Level.REGION).flatMap(settings -> placing(settings, objectKey));
return fromRegion.isPresent() ? fromRegion : declared.level(Level.BIOME).flatMap(settings -> placing(settings, objectKey));
private static Optional<ObjectPlacement> columnPlacement(PackResources resources, SettingsStack<ObjectSettings> declared,
ResourceId object) {
Optional<ObjectPlacement> fromRegion = declared.level(Level.REGION).flatMap(settings -> placing(resources, settings, object));
return fromRegion.isPresent() ? fromRegion : declared.level(Level.BIOME).flatMap(settings -> placing(resources, settings, object));
}
private static Optional<ObjectPlacement> placing(ObjectSettings settings, String objectKey) {
private static Optional<ObjectPlacement> placing(PackResources resources, ObjectSettings settings, ResourceId object) {
return settings.objects().stream()
.filter(placement -> placement.place().contains(objectKey))
.filter(placement -> placement.place().stream().anyMatch(key -> resources.idOf(key).equals(object)))
.findFirst();
}
}
@@ -47,6 +47,7 @@ import com.volmit.config.SettingsStack;
import com.volmit.object.PlaceableObject;
import com.volmit.resource.ResourceId;
import com.volmit.stage.MantleStageContext;
import com.volmit.placement.PlacementRecord;
import com.volmit.world.TerrainSampler;
import java.util.List;
@@ -570,7 +571,7 @@ final class ChunkObjectPlacing {
return new PlacementTags(placementMarker(object, id, context), treePlacement, buriedTreasure);
}
private String placementMarker(PlaceableObject object, int id, String context) {
private PlacementRecord placementMarker(PlaceableObject object, int id, String context) {
String key = object == null ? null : object.name();
if (key == null || key.isEmpty() || key.equals("null")) {
String fingerprint = context + "|" + (object == null ? "<null>" : object.getClass().getSimpleName());
@@ -578,7 +579,7 @@ final class ChunkObjectPlacing {
+ "This would previously produce 'Couldn't find Object: null' warnings on chunk reload.");
return null;
}
return key + "@" + id;
return PlacementRecord.of(this.context.world().resources().idOf(key), id);
}
private static boolean isTreePlacement(PlaceableObject object, ObjectPlacement placement) {
@@ -36,6 +36,7 @@ import com.volmit.object.BlockEntityData;
import com.volmit.object.ObjectBlock;
import com.volmit.object.PlaceableObject;
import com.volmit.placement.PlacedMarker;
import com.volmit.placement.PlacementRecord;
import com.volmit.placement.PlacementTerrain;
import com.volmit.stage.MantleStageContext;
import com.volmit.world.PackWorld;
@@ -161,10 +162,10 @@ final class FloatingPlacer {
if (!run.placeIn(world, terrain).isPlaced()) {
return false;
}
String placementName = object.name() + "@" + id;
PlacementRecord placement = PlacementRecord.of(world.resources().idOf(object.name()), id);
for (BlockPosition position : run.objectBlocks()) {
if (placesBlock(terrain.get(position.x(), position.y(), position.z()))) {
terrain.recordPlacement(position.x(), position.y(), position.z(), placementName);
terrain.recordPlacement(position.x(), position.y(), position.z(), placement);
}
}
return true;
@@ -211,7 +212,7 @@ final class FloatingPlacer {
}
@Override
public void recordPlacement(int x, int y, int z, String placement) {
public void recordPlacement(int x, int y, int z, PlacementRecord placement) {
if (anchor.writes(x, y, z)) {
delegate().recordPlacement(x, y, z, placement);
}
@@ -19,6 +19,7 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.builtin.objects.ObjectSettings;
import art.arcane.iris.modules.objects.ProceduralObjectSettings;
import art.arcane.iris.builtin.objects.RequireSurfaceSupportSettings;
@@ -65,6 +66,7 @@ public final class ObjectModule implements IrisModule, ModuleLifecycle {
registry.registerSettings(ObjectSettings.class, ProceduralObjectSettings.class, TreeGrowthSettings.class,
RequireSurfaceSupportSettings.class, SurfaceSupportBufferSettings.class, UpperObjectsSettings.class,
UpperObjectsForceSettings.class);
registry.registerPlacementType(ObjectPlacement.class, ObjectPlacement.jsonFields());
registry.registerLifecycle(this);
}
@@ -38,6 +38,7 @@ import com.volmit.object.BlockEntityData;
import com.volmit.object.PlaceableObject;
import com.volmit.placement.PlacedBlock;
import com.volmit.placement.PlacedMarker;
import com.volmit.placement.PlacementRecord;
import com.volmit.placement.PlacementTerrain;
import com.volmit.placement.StructureVolumes;
import com.volmit.resource.ResourceId;
@@ -242,11 +243,11 @@ public final class TreeGrowing implements SaplingGrowth {
}
@Override
public void recordPlacement(int x, int y, int z, String placement) {
public void recordPlacement(int x, int y, int z, PlacementRecord placement) {
}
@Override
public Optional<String> placementAt(int x, int y, int z) {
public Optional<PlacementRecord> placementAt(int x, int y, int z) {
return Optional.empty();
}
@@ -21,7 +21,6 @@ package art.arcane.iris.engine.spawn;
import art.arcane.iris.builtin.loot.LootEntry;
import art.arcane.iris.builtin.spawn.AmbientEffect;
import art.arcane.iris.builtin.spawn.EntityDefinition;
import art.arcane.iris.builtin.spawn.IrisEntityExtras;
import art.arcane.iris.builtin.spawn.SpawnCommand;
import art.arcane.iris.builtin.loot.LootResolver;
import art.arcane.iris.engine.loot.LootItems;
@@ -88,7 +87,7 @@ final class EntityResolution {
return typeOf(entity).map(type -> new EntitySpec(type, appearanceOf(entity), behaviourOf(entity), equipment, attributes,
new EntitySpec.Company(passengers, leashHolder), new EntitySpec.Drops(lootTables, lootShuffleSeed),
new EntitySpec.Arrival(spawnEffectOf(entity), commandsOf(entity)), List.of(extrasOf(entity))));
arrivalOf(entity), entity.applySettingsToCustomMobAnyways(), List.of()));
}
/** The provider's mob when the pack names one, otherwise the entity type. */
@@ -106,7 +105,13 @@ final class EntityResolution {
}
private static EntitySpec.Appearance appearanceOf(EntityDefinition entity) {
return new EntitySpec.Appearance(textOf(entity.customName()), entity.customNameVisible(), entity.glowing(), entity.baby());
return new EntitySpec.Appearance(textOf(entity.customName()), entity.customNameVisible(), entity.glowing(), entity.baby(),
textOf(entity.pandaMainGene()), textOf(entity.pandaHiddenGene()));
}
private EntitySpec.Arrival arrivalOf(EntityDefinition entity) {
return new EntitySpec.Arrival(spawnEffectOf(entity), commandsOf(entity), textOf(entity.reason()),
entity.spawnEffectRiseOutOfGround());
}
private static EntitySpec.Behaviour behaviourOf(EntityDefinition entity) {
@@ -114,11 +119,6 @@ final class EntityResolution {
entity.pickupItems(), entity.removable(), entity.keepEntity());
}
private static IrisEntityExtras extrasOf(EntityDefinition entity) {
return new IrisEntityExtras(textOf(entity.reason()), entity.spawnEffectRiseOutOfGround(), textOf(entity.pandaMainGene()),
textOf(entity.pandaHiddenGene()), entity.applySettingsToCustomMobAnyways());
}
private Optional<ItemDrop> equip(LootEntry piece, RNG rng) {
if (piece == null || !LootResolver.oneIn(rng, piece.rarity())) {
return Optional.empty();
@@ -21,6 +21,7 @@ package art.arcane.iris.modules.objects;
import com.volmit.block.BlockState;
import com.volmit.object.BlockEntityData;
import com.volmit.placement.PlacedMarker;
import com.volmit.placement.PlacementRecord;
import com.volmit.placement.PlacementTerrain;
import com.volmit.placement.StructureVolumes;
@@ -85,12 +86,12 @@ public abstract class ForwardingTerrain implements PlacementTerrain {
}
@Override
public void recordPlacement(int x, int y, int z, String placement) {
public void recordPlacement(int x, int y, int z, PlacementRecord placement) {
delegate.recordPlacement(x, y, z, placement);
}
@Override
public Optional<String> placementAt(int x, int y, int z) {
public Optional<PlacementRecord> placementAt(int x, int y, int z) {
return delegate.placementAt(x, y, z);
}
@@ -18,12 +18,14 @@
package art.arcane.iris.modules.objects;
import com.volmit.placement.PlacementRecord;
/**
* What a placement writes into the mantle besides the blocks, beside each block of the object.
*
* @param marker the placement marker to write beside every block the object places, or null for none
* @param marker the placement to record beside every block the object places, or null for none
* @param treeMaterial whether the block is also written as the tree material the mantle keeps for felling and growth
* @param buriedTreasure whether storage chests among the blocks are marked as buried treasure
*/
public record PlacementTags(String marker, boolean treeMaterial, boolean buriedTreasure) {
public record PlacementTags(PlacementRecord marker, boolean treeMaterial, boolean buriedTreasure) {
}
@@ -22,6 +22,7 @@ import com.volmit.block.BlockState;
import com.volmit.geometry.BlockPosition;
import com.volmit.object.BlockEntityData;
import com.volmit.placement.PlacedMarker;
import com.volmit.placement.PlacementRecord;
import com.volmit.placement.PlacementTerrain;
import java.util.ArrayList;
@@ -97,16 +98,16 @@ public abstract class TerrainTransaction extends ForwardingTerrain {
}
@Override
public void recordPlacement(int x, int y, int z, String placement) {
writes.add(new PlacementRecord(new BlockPosition(x, y, z), placement));
public void recordPlacement(int x, int y, int z, PlacementRecord placement) {
writes.add(new PlacementWrite(new BlockPosition(x, y, z), placement));
}
@Override
public Optional<String> placementAt(int x, int y, int z) {
public Optional<PlacementRecord> placementAt(int x, int y, int z) {
BlockPosition position = new BlockPosition(x, y, z);
for (int index = writes.size() - 1; index >= 0; index--) {
if (writes.get(index) instanceof PlacementRecord record && record.position().equals(position)) {
return Optional.of(record.placement());
if (writes.get(index) instanceof PlacementWrite write && write.position().equals(position)) {
return Optional.of(write.placement());
}
}
return delegate().placementAt(x, y, z);
@@ -123,7 +124,7 @@ public abstract class TerrainTransaction extends ForwardingTerrain {
blockWrites++;
}
private sealed interface Write permits BlockWrite, PlacementRecord, MarkerWrite {
private sealed interface Write permits BlockWrite, PlacementWrite, MarkerWrite {
BlockPosition position();
void applyTo(PlacementTerrain terrain);
@@ -140,7 +141,7 @@ public abstract class TerrainTransaction extends ForwardingTerrain {
}
}
private record PlacementRecord(BlockPosition position, String placement) implements Write {
private record PlacementWrite(BlockPosition position, PlacementRecord placement) implements Write {
@Override
public void applyTo(PlacementTerrain terrain) {
terrain.recordPlacement(position.x(), position.y(), position.z(), placement);
@@ -18,9 +18,9 @@
package art.arcane.iris.modules.placement;
import art.arcane.iris.builtin.structure.StructurePlacementMarker;
import art.arcane.iris.modules.blocks.SmartBoreDebugSettings;
import com.volmit.placement.PlacementContext;
import com.volmit.placement.PlacementRecord;
import com.volmit.placement.PlacementTerrain;
import com.volmit.placement.StructureVolumes;
import com.volmit.resource.ResourceId;
@@ -115,15 +115,9 @@ public final class StageTerrain {
/** The pack object placed at the block; empty when none was, or when a procedural object was. */
public Optional<ResourceId> objectAt(int x, int y, int z) {
Optional<String> recorded = terrain.placementAt(x, y, z);
if (recorded.isEmpty()) {
return Optional.empty();
}
StructurePlacementMarker.Decoded marker = StructurePlacementMarker.decode(recorded.get());
if (marker == null || marker.objectKey().startsWith(PROCEDURAL_PREFIX)) {
return Optional.empty();
}
return Optional.of(context.world().resources().idOf(marker.objectKey()));
return terrain.placementAt(x, y, z)
.map(PlacementRecord::object)
.filter(object -> !object.path().startsWith(PROCEDURAL_PREFIX));
}
private TerrainSampler sampler() {