Show the biome that placed an object in dust

An object reaches past the chunk whose centre biome placed it, so dust on a
block near a biome edge named the neighbouring biome. Placements now record
their owning biome or region, and dust shows it as "Placed from biome: ...".
Chunks generated before this change carry no owner and show no such line.
This commit is contained in:
piexel committed 2026-11-12 17:14:46 +01:00
1 parent e550c5c77b
commit ecc08197e8
29 files changed
+281 -52

No files matched your search

@@ -23,6 +23,7 @@ import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.localization.IrisLanguage;
import art.arcane.iris.core.localization.RuntimeUiMessages;
import art.arcane.iris.core.modules.ModuleServices;
import art.arcane.iris.core.modules.PlacementMarkers;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.core.tools.IrisToolbelt;
import art.arcane.iris.engine.framework.Engine;
@@ -31,6 +32,7 @@ import art.arcane.iris.engine.object.world.region.IrisRegion;
import art.arcane.iris.engine.platform.PlatformChunkGenerator;
import art.arcane.iris.util.common.format.C;
import art.arcane.volmlib.util.collection.KList;
import com.volmit.config.Level;
import art.arcane.volmlib.util.math.BlockPosition;
import art.arcane.volmlib.util.math.M;
import art.arcane.volmlib.util.math.RNG;
@@ -232,6 +234,10 @@ public class DustRevealer {
objectKey == null ? IrisLanguage.text(RuntimeUiMessages.DUST_NONE) : objectKey
)
), false));
PlacementMarkers.OwnerKey owner = objectKey == null ? null : safe(() -> engine.getObjectPlacementOwner(x, relativeY, z));
if (owner != null) {
lines.add(new DustLine(ownerLine(owner), true));
}
if (objectKey == null && structurePiece == null) {
String columnObject = findColumnObject(engine, x, relativeY, z, minHeight);
lines.add(new DustLine(IrisLanguage.text(
@@ -302,6 +308,12 @@ public class DustRevealer {
sendCopyButton(sender, payload.toString());
}
private static String ownerLine(PlacementMarkers.OwnerKey owner) {
return owner.level() == Level.REGION
? IrisLanguage.text(RuntimeUiMessages.DUST_OBJECT_FROM_REGION, MessageArgument.untrusted("region", owner.key()))
: IrisLanguage.text(RuntimeUiMessages.DUST_OBJECT_FROM_BIOME, MessageArgument.untrusted("biome", owner.key()));
}
private static String findColumnObject(Engine engine, int x, int relativeY, int z, int minHeight) {
for (int dy = 1; dy <= 64; dy++) {
if (relativeY + dy >= 0) {
@@ -77,7 +77,9 @@ public final class RuntimeUiMessages {
public static final TextKey DUST_PLACED_BY_BURIED_OBJECT = text("iris.runtime.dust.placed_by.buried_object");
public static final TextKey DUST_PLACED_BY_TERRAIN = text("iris.runtime.dust.placed_by.terrain");
public static final TextKey DUST_PLACED_BY_STRUCTURE_PIECE = text("iris.runtime.dust.placed_by.structure_piece");
public static final TextKey DUST_COLUMN_OBJECT = text("iris.runtime.dust.column_object");
public static final TextKey DUST_OBJECT_FROM_BIOME = text("iris.runtime.dust.object_from.biome");
public static final TextKey DUST_OBJECT_FROM_REGION = text("iris.runtime.dust.object_from.region");
public static final TextKey DUST_COLUMN_OBJECT =text("iris.runtime.dust.column_object");
public static final TextKey DUST_COLUMN_OBJECT_NONE = text("iris.runtime.dust.column_object_none");
public static final TextKey DUST_COLUMN_NONE = text("iris.runtime.dust.column_none");
public static final TextKey DUST_COLUMN_ABOVE = text("iris.runtime.dust.column.above");
@@ -18,18 +18,23 @@
package art.arcane.iris.core.modules;
import com.volmit.config.Level;
import com.volmit.placement.PlacementOwner;
import com.volmit.placement.PlacementRecord;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.resource.ResourceKind;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
/**
* The text Iris keeps beside a placed block in its mantle to say which placement the block belongs to: {@code key@id}
* for an object placed on its own, and a delimiter-safe {@code @iris-structure:v1:...} form for a piece of a structure.
* Either form may end in {@code #biome:...} or {@code #region:...}, naming the biome or region that placed the object.
* Worlds already generated hold these texts, so the forms never change. A module hands Iris a {@link PlacementRecord},
* and Iris reads one back from the text with the pack's keys and ids.
*/
@@ -37,6 +42,8 @@ public final class PlacementMarkers {
private static final String FAMILY_PREFIX = "@iris-structure:";
private static final String VERSION_PREFIX = FAMILY_PREFIX + "v1:";
private static final char PLACEMENT_SEPARATOR = '@';
private static final char OWNER_SEPARATOR = '#';
private static final char OWNER_LEVEL_SEPARATOR = ':';
private PlacementMarkers() {
}
@@ -56,8 +63,12 @@ public final class PlacementMarkers {
+ ":" + encodeKey(normalizedStructureKey);
}
/** The text of {@code record}, with the pack keys of its object and structure. */
/** The text of {@code record}, with the pack keys of its object, structure and owner. */
public static String encode(PlacementRecord record, IrisPackResources resources) {
return encodePlacement(record, resources) + record.owner().map(owner -> encodeOwner(owner, resources)).orElse("");
}
private static String encodePlacement(PlacementRecord record, IrisPackResources resources) {
String objectKey = resources.keyOf(PackResources.OBJECTS, record.object());
if (record.structure().isEmpty()) {
return encode(objectKey, record.placementId());
@@ -65,6 +76,15 @@ public final class PlacementMarkers {
return encodeStructure(objectKey, record.placementId(), resources.keyOf(record.structure().get()));
}
private static String encodeOwner(PlacementOwner owner, IrisPackResources resources) {
String ownerKey = resources.keyOf(kindOf(owner.level()), owner.source());
return OWNER_SEPARATOR + owner.level().name().toLowerCase(Locale.ROOT) + OWNER_LEVEL_SEPARATOR + encodeKey(ownerKey);
}
private static ResourceKind<?> kindOf(Level ownerLevel) {
return ownerLevel == Level.REGION ? PackResources.REGIONS : PackResources.BIOMES;
}
/** What the text says, or empty for a text that names no placement. */
public static Optional<PlacementRecord> recordOf(String marker, IrisPackResources resources) {
Decoded decoded = decode(marker);
@@ -75,13 +95,40 @@ public final class PlacementMarkers {
Optional<ResourceId> structure = decoded.structureAware()
? Optional.of(resources.idOf(decoded.structureKey()))
: Optional.empty();
return Optional.of(new PlacementRecord(object, decoded.placementId(), structure));
Optional<PlacementOwner> owner = Optional.ofNullable(decoded.owner())
.map(ownerKey -> new PlacementOwner(ownerKey.level(), resources.idOf(ownerKey.key())));
return Optional.of(new PlacementRecord(object, decoded.placementId(), structure, owner));
}
public static Decoded decode(String marker) {
if (marker == null || marker.isBlank()) {
return null;
}
int ownerStart = marker.lastIndexOf(OWNER_SEPARATOR);
OwnerKey owner = ownerStart > 0 ? decodeOwner(marker.substring(ownerStart + 1)) : null;
Decoded placement = decodePlacement(owner == null ? marker : marker.substring(0, ownerStart));
return placement == null || owner == null ? placement : placement.ownedBy(owner);
}
/** The owner a text's end names, or null when the end names none. */
private static OwnerKey decodeOwner(String text) {
int levelEnd = text.indexOf(OWNER_LEVEL_SEPARATOR);
if (levelEnd <= 0) {
return null;
}
try {
Level level = Level.valueOf(text.substring(0, levelEnd).toUpperCase(Locale.ROOT));
String key = decodeCanonicalKey(text.substring(levelEnd + 1));
if (key.isBlank() || (level != Level.BIOME && level != Level.REGION)) {
return null;
}
return new OwnerKey(level, key);
} catch (IllegalArgumentException exception) {
return null;
}
}
private static Decoded decodePlacement(String marker) {
if (marker.startsWith(FAMILY_PREFIX)) {
return decodeStructure(marker);
}
@@ -103,7 +150,7 @@ public final class PlacementMarkers {
if (objectKey.isBlank() || structureKey.isBlank()) {
return null;
}
return new Decoded(objectKey, placementId, structureKey);
return new Decoded(objectKey, placementId, structureKey, null);
} catch (IllegalArgumentException exception) {
return null;
}
@@ -119,7 +166,7 @@ public final class PlacementMarkers {
return null;
}
try {
return new Decoded(objectKey, Integer.parseInt(marker.substring(separator + 1)), null);
return new Decoded(objectKey, Integer.parseInt(marker.substring(separator + 1)), null, null);
} catch (NumberFormatException exception) {
return null;
}
@@ -145,10 +192,26 @@ public final class PlacementMarkers {
return decoded;
}
/** A placement text read as pack keys; {@code structureKey} is null for an object placed on its own. */
public record Decoded(String objectKey, int placementId, String structureKey) {
/**
* A placement text read as pack keys; {@code structureKey} is null for an object placed on its own, {@code owner}
* null when the text names no biome or region that placed it.
*/
public record Decoded(String objectKey, int placementId, String structureKey, OwnerKey owner) {
public boolean structureAware() {
return structureKey != null;
}
/** The object and placement as {@code key@id}, the form the block inspection tools show. */
public String placementKey() {
return objectKey + PLACEMENT_SEPARATOR + placementId;
}
Decoded ownedBy(OwnerKey placedBy) {
return new Decoded(objectKey, placementId, structureKey, placedBy);
}
}
/** The biome or region that placed an object, by its pack key; {@code level} is {@link Level#BIOME} or {@link Level#REGION}. */
public record OwnerKey(Level level, String key) {
}
}
@@ -427,10 +427,24 @@ public interface Engine extends DataProvider, Fallible, BlockUpdater, Renderer,
return o.getObject().getLoadKey() + "@" + o.getId();
}
String raw = getObjectPlacementMarker(x, y, z);
if (raw == null || raw.isEmpty()) {
return null;
}
PlacementMarkers.Decoded marker = PlacementMarkers.decode(raw);
return marker == null ? raw : marker.placementKey();
}
/** The biome or region that placed the object at the block; null when no object is there or its placement names none. */
default PlacementMarkers.OwnerKey getObjectPlacementOwner(int x, int y, int z) {
PlacementMarkers.Decoded marker = PlacementMarkers.decode(getObjectPlacementMarker(x, y, z));
return marker == null ? null : marker.owner();
}
private String getObjectPlacementMarker(int x, int y, int z) {
MantleChunk<Matter> chunk = getMantle().getMantle().getChunk(x >> 4, z >> 4).use();
try {
String raw = chunk.get(x & 15, y, z & 15, String.class);
return (raw == null || raw.isEmpty()) ? null : raw;
return chunk.get(x & 15, y, z & 15, String.class);
} finally {
chunk.release();
}
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Position: {offset} unter der Oberfläche (Oberflächen-Y={surfaceY})",
"iris.runtime.dust.position.at": "Position: an der Oberfläche (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Objekt @block: {object}",
"iris.runtime.dust.object_from.biome": "Platziert von Biom: {biome}",
"iris.runtime.dust.object_from.region": "Platziert von Region: {region}",
"iris.runtime.dust.none": "keine",
"iris.runtime.dust.placed_by.object_above": "Platziert von: Objekt / Stelze '{object}' (über der Oberfläche)",
"iris.runtime.dust.placed_by.decoration_above": "Platziert von: Dekoration/Objekt/Stelze (über der Oberfläche)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Posición: {offset} bajo la superficie (Y de superficie={surfaceY})",
"iris.runtime.dust.position.at": "Posición: en la superficie (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Objeto @bloque: {object}",
"iris.runtime.dust.object_from.biome": "Colocado desde el bioma: {biome}",
"iris.runtime.dust.object_from.region": "Colocado desde la región: {region}",
"iris.runtime.dust.none": "ninguno",
"iris.runtime.dust.placed_by.object_above": "Colocado por: objeto/pilar '{object}' (sobre la superficie)",
"iris.runtime.dust.placed_by.decoration_above": "Colocado por: decoración/objeto/pilar (sobre la superficie)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Sijainti: {offset} pinnan alla (pinta Y ={surfaceY})",
"iris.runtime.dust.position.at": "Sijainti: pinnalla (Y ={surfaceY})",
"iris.runtime.dust.object_at_block": "Kohde @ lohko: {object}",
"iris.runtime.dust.object_from.biome": "Sijoittanut biomi: {biome}",
"iris.runtime.dust.object_from.region": "Sijoittanut alue: {region}",
"iris.runtime.dust.none": "ei yhtään",
"iris.runtime.dust.placed_by.object_above": "Sijaitsee: esine/kallistus '{object}\" (pinnan yläpuolella)",
"iris.runtime.dust.placed_by.decoration_above": "Sijaitsee: sisustus/objekti/kalleus (pinnan yläpuolella)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Position : {offset} sous la surface (Y de surface={surfaceY})",
"iris.runtime.dust.position.at": "Position : à la surface (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Objet @bloc : {object}",
"iris.runtime.dust.object_from.biome": "Placé par le biome : {biome}",
"iris.runtime.dust.object_from.region": "Placé par la région : {region}",
"iris.runtime.dust.none": "aucune",
"iris.runtime.dust.placed_by.object_above": "Placé par : objet/pilotis '{object}' (au-dessus de la surface)",
"iris.runtime.dust.placed_by.decoration_above": "Placé par : décoration/objet/pilotis (au-dessus de la surface)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "מיקום: {offset} מתחת לפני השטח (surface Y={surfaceY})",
"iris.runtime.dust.position.at": "מיקום: על פני השטח (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "אובייקטים @בלוק: {object}",
"iris.runtime.dust.object_from.biome": "הוצב על ידי ביום: {biome}",
"iris.runtime.dust.object_from.region": "הוצב על ידי אזור: {region}",
"iris.runtime.dust.none": "אף אחד לא",
"iris.runtime.dust.placed_by.object_above": "הוצב על ידי: object/stilt '{object}' (מעל פני השטח)",
"iris.runtime.dust.placed_by.decoration_above": "הוצב על ידי: decoration/object/stilt (מעל פני השטח)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Posizione: {offset} sotto la superficie (superficie Y={surfaceY})",
"iris.runtime.dust.position.at": "Posizione: in superficie (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Oggetto @block: {object}",
"iris.runtime.dust.object_from.biome": "Piazzato dal bioma: {biome}",
"iris.runtime.dust.object_from.region": "Piazzato dalla regione: {region}",
"iris.runtime.dust.none": "Nessuno",
"iris.runtime.dust.placed_by.object_above": "Posizionato da: oggetto/pilastro '{object}' (sopra la superficie)",
"iris.runtime.dust.placed_by.decoration_above": "Posizionato da: decorazione/oggetto/pilastro (sopra la superficie)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "位置: 地表より {offset} 下(地表 Y={surfaceY})",
"iris.runtime.dust.position.at": "位置: 地表(Y={surfaceY})",
"iris.runtime.dust.object_at_block": "このブロックのオブジェクト: {object}",
"iris.runtime.dust.object_from.biome": "配置元バイオーム: {biome}",
"iris.runtime.dust.object_from.region": "配置元リージョン: {region}",
"iris.runtime.dust.none": "なし",
"iris.runtime.dust.placed_by.object_above": "配置元: object/stilt '{object}'(地表より上)",
"iris.runtime.dust.placed_by.decoration_above": "配置元: decoration/object/stilt(地表より上)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "위치: {offset} 표면의 밑에 (표면 Y={surfaceY})",
"iris.runtime.dust.position.at": "위치: 표면에 (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "오브젝트 @block: {object}",
"iris.runtime.dust.object_from.biome": "배치한 바이옴: {biome}",
"iris.runtime.dust.object_from.region": "배치한 지역: {region}",
"iris.runtime.dust.none": "없음",
"iris.runtime.dust.placed_by.object_above": "배치 원인: object/stilt '{object}'(표면 위)",
"iris.runtime.dust.placed_by.decoration_above": "배치 원인: decoration/object/stilt(표면 위)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Pareigos: {offset} po paviršiumi (paviršius Y ={surfaceY})",
"iris.runtime.dust.position.at": "Padėtis: paviršiuje (Y ={surfaceY})",
"iris.runtime.dust.object_at_block": "Objektas @ block: {object}",
"iris.runtime.dust.object_from.biome": "Pastatė biomas: {biome}",
"iris.runtime.dust.object_from.region": "Pastatė regionas: {region}",
"iris.runtime.dust.none": "nėra",
"iris.runtime.dust.placed_by.object_above": "Pateikta: objektas / stilt \"{object}\"(virš paviršiaus)",
"iris.runtime.dust.placed_by.decoration_above": "Pateikta: dekoravimas / objektas / stilt (virš paviršiaus)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Positie: {offset} onder het oppervlak (oppervlakte Y={surfaceY})",
"iris.runtime.dust.position.at": "Positie: aan het oppervlak (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Object-@blok: {object}",
"iris.runtime.dust.object_from.biome": "Geplaatst door bioom: {biome}",
"iris.runtime.dust.object_from.region": "Geplaatst door regio: {region}",
"iris.runtime.dust.none": "geen",
"iris.runtime.dust.placed_by.object_above": "Geplaatst door: object/stilt '{object}\" (boven)",
"iris.runtime.dust.placed_by.decoration_above": "Geplaatst door: decoratie/object/stilt (bovenzijde)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Pozycja: {offset} poniżej powierzchni (powierzchnia Y ={surfaceY})",
"iris.runtime.dust.position.at": "Położenie: na powierzchni (Y ={surfaceY})",
"iris.runtime.dust.object_at_block": "Obiekt @ block: {object}",
"iris.runtime.dust.object_from.biome": "Umieszczony przez biom: {biome}",
"iris.runtime.dust.object_from.region": "Umieszczony przez region: {region}",
"iris.runtime.dust.none": "brak",
"iris.runtime.dust.placed_by.object_above": "Umieszczone przez: obiekt / stilt '{object}\"(nad powierzchnią)",
"iris.runtime.dust.placed_by.decoration_above": "Umieszczone przez: dekoracje / obiekt / stilt (nad powierzchnią)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Posição: {offset} abaixo da superfície (superfície Y={surfaceY})",
"iris.runtime.dust.position.at": "Posição: à superfície (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Objecto @ block: {object}",
"iris.runtime.dust.object_from.biome": "Colocado pelo bioma: {biome}",
"iris.runtime.dust.object_from.region": "Colocado pela região: {region}",
"iris.runtime.dust.none": "nenhum",
"iris.runtime.dust.placed_by.object_above": "Colocado por: objeto/tilt '{object}« (superfície superior)",
"iris.runtime.dust.placed_by.decoration_above": "Colocado por: decoração/objeto/tilt (superfície superior)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Должность: {offset} ниже поверхности (поверхность Y ={surfaceY})",
"iris.runtime.dust.position.at": "Положение: на поверхности (Y ={surfaceY})",
"iris.runtime.dust.object_at_block": "Объект @block: {object}",
"iris.runtime.dust.object_from.biome": "Размещён биомом: {biome}",
"iris.runtime.dust.object_from.region": "Размещён регионом: {region}",
"iris.runtime.dust.none": "ни одного",
"iris.runtime.dust.placed_by.object_above": "Помещение: объект/наклон{object}(над поверхностью)",
"iris.runtime.dust.placed_by.decoration_above": "Размещено: отделка/объект/наклон (над поверхностью)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Pozisyon: {offset} Aşağıdaki yüzey (surface Y={surfaceY})",
"iris.runtime.dust.position.at": "Pozisyon: Yüzeyde (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Object @block : {object}",
"iris.runtime.dust.object_from.biome": "Yerleştiren biyom: {biome}",
"iris.runtime.dust.object_from.region": "Yerleştiren bölge: {region}",
"iris.runtime.dust.none": "Hiçbir kimse hiçbir şey yok",
"iris.runtime.dust.placed_by.object_above": "Tarafından Yeri: nesne /{object}\" (üstünde yüzeyi)",
"iris.runtime.dust.placed_by.decoration_above": "Yer: dekorasyon/object /stilt (üstünde yüzeyi)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Vị trí: {offset} Bên dưới bề mặt (mặt đất Y={surfaceY})",
"iris.runtime.dust.position.at": "Vị trí: tại bề mặt (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Đối tượng {object}",
"iris.runtime.dust.object_from.biome": "Được đặt bởi quần xã: {biome}",
"iris.runtime.dust.object_from.region": "Được đặt bởi vùng: {region}",
"iris.runtime.dust.none": "không có",
"iris.runtime.dust.placed_by.object_above": "Được đặt bởi đối tượng/ giây{object}' (mặt trên)",
"iris.runtime.dust.placed_by.decoration_above": "Đặt theo: trang trí/ thu hút/ Linh tinh (mặt đất)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "位置 : {offset} 低于表面(表Y={surfaceY})",
"iris.runtime.dust.position.at": "位置:在表面(Y={surfaceY})",
"iris.runtime.dust.object_at_block": "对象@ 方块: {object}",
"iris.runtime.dust.object_from.biome": "放置来源群系: {biome}",
"iris.runtime.dust.object_from.region": "放置来源区域: {region}",
"iris.runtime.dust.none": "无",
"iris.runtime.dust.placed_by.object_above": "位置: 对象/斜体 '{object}'(以上表面)",
"iris.runtime.dust.placed_by.decoration_above": "由:装饰/物件/斜体(上表面)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "位置 : {offset} 低於表面(表Y={surfaceY})",
"iris.runtime.dust.position.at": "位置:在表面(Y={surfaceY})",
"iris.runtime.dust.object_at_block": "物件@ 方塊: {object}",
"iris.runtime.dust.object_from.biome": "放置來源生態域: {biome}",
"iris.runtime.dust.object_from.region": "放置來源區域: {region}",
"iris.runtime.dust.none": "無",
"iris.runtime.dust.placed_by.object_above": "位置: 物件/斜體 '{object}'(以上表面)",
"iris.runtime.dust.placed_by.decoration_above": "由:裝飾/物件/斜體(上表面)",
@@ -943,6 +943,8 @@
"iris.runtime.dust.position.below": "Position: {offset} below surface (surface Y={surfaceY})",
"iris.runtime.dust.position.at": "Position: at surface (Y={surfaceY})",
"iris.runtime.dust.object_at_block": "Object @block: {object}",
"iris.runtime.dust.object_from.biome": "Placed from biome: {biome}",
"iris.runtime.dust.object_from.region": "Placed from region: {region}",
"iris.runtime.dust.none": "none",
"iris.runtime.dust.placed_by.object_above": "Placed by: object/stilt '{object}' (above surface)",
"iris.runtime.dust.placed_by.decoration_above": "Placed by: decoration/object/stilt (above surface)",
@@ -1,6 +1,8 @@
package art.arcane.iris.core.modules;
import art.arcane.iris.core.loader.IrisData;
import com.volmit.config.Level;
import com.volmit.placement.PlacementOwner;
import com.volmit.placement.PlacementRecord;
import org.junit.Test;
@@ -35,6 +37,33 @@ public class PlacementMarkersTest {
assertEquals(Optional.of(record), PlacementMarkers.recordOf(marker, resources));
}
@Test
public void theBiomeOrRegionThatPlacedAnObjectReadsBack() {
IrisPackResources resources = resources();
PlacementRecord fromBiome = PlacementRecord.of(resources.idOf("trees/oak"), 7)
.ownedBy(PlacementOwner.biome(resources.idOf("forest/birch")));
PlacementRecord pieceFromRegion = PlacementRecord.ofPiece(resources.idOf("pieces/room"), 918273, resources.idOf("structures/village"))
.ownedBy(PlacementOwner.region(resources.idOf("plains")));
String biomeMarker = PlacementMarkers.encode(fromBiome, resources);
String regionMarker = PlacementMarkers.encode(pieceFromRegion, resources);
assertEquals(Optional.of(fromBiome), PlacementMarkers.recordOf(biomeMarker, resources));
assertEquals(Optional.of(pieceFromRegion), PlacementMarkers.recordOf(regionMarker, resources));
assertEquals(new PlacementMarkers.OwnerKey(Level.BIOME, "forest/birch"), PlacementMarkers.decode(biomeMarker).owner());
assertEquals("trees/oak@7", PlacementMarkers.decode(biomeMarker).placementKey());
}
@Test
public void anEndThatNamesNoOwnerLeavesTheMarkerAsItWas() {
PlacementMarkers.Decoded hashInKey = PlacementMarkers.decode("trees/oak#2@7");
PlacementMarkers.Decoded dimensionOwner = PlacementMarkers.decode("trees/oak@7#dimension:Zm9yZXN0");
assertEquals("trees/oak#2", hashInKey.objectKey());
assertNull(hashInKey.owner());
assertNull(dimensionOwner);
}
@Test
public void textThatNamesNoPlacementIsNoRecord() {
IrisPackResources resources = resources();