Placed converted ores in hosts

- Ores converted by mod ingest use the FULL_HEIGHT deposit placement scope, so they replace their host blocks anywhere in their height band like vanilla ore features instead of being culled above the column surface
This commit is contained in:
Brian Neumann-Fopiano committed 2026-10-14 21:16:48 -04:00
1 parent aedef3c38a
commit 506e545edf
2 files changed
+21

No files matched your search

@@ -33,6 +33,7 @@ final class OreDepositConverter {
static final Set<String> ORE_TYPES = Set.of("minecraft:ore", "minecraft:scattered_ore");
private static final int MAX_PER_CHUNK = 2048;
private static final int MAX_SIZE = 8192;
private static final String FULL_HEIGHT = "FULL_HEIGHT";
private OreDepositConverter() {
}
@@ -57,6 +58,7 @@ final class OreDepositConverter {
deposit.addProperty("maxHeight", placement.band().max() - packMinY);
deposit.addProperty("heightDistribution", placement.band().distribution());
deposit.addProperty("surfaceClearance", 0);
deposit.addProperty("placementScope", FULL_HEIGHT);
deposit.addProperty("minPerChunk", placement.minPerChunk());
deposit.addProperty("maxPerChunk", placement.maxPerChunk());
if (placement.spawnChance() < 1D) {
@@ -76,6 +76,25 @@ public class FeatureConverterFormatTest {
assertEquals(List.of("minecraft:deepslate"), IngestJson.strings(deposits.get(1).get("replaceableBlocks")));
}
@Test
public void convertedOresPlaceInTheirHostsRegardlessOfTheTerrainSurface() throws IngestConversionException {
CatalogPlacedFeature clay = new CatalogPlacedFeature("examplemod:alpha/clay_patch", "examplemod:alpha/clay_patch",
"minecraft:ore", JsonParser.parseString("""
{"discard_chance_on_air_exposure": 0.0, "size": 20,
"targets": [{"state": {"Name": "minecraft:clay"}, "target": {"predicate_type": "minecraft:block_match", "block": "minecraft:sand"}}]}
"""), JsonParser.parseString("""
[{"type": "minecraft:count", "count": 6}, {"type": "minecraft:in_square"},
{"type": "minecraft:height_range", "height": {"type": "minecraft:uniform", "min_inclusive": {"absolute": 57}, "max_inclusive": {"absolute": 62}}},
{"type": "minecraft:biome"}]
"""));
List<JsonObject> deposits = OreDepositConverter.convert(clay, OVERWORLD, -64);
assertEquals(1, deposits.size());
assertEquals("FULL_HEIGHT", deposits.getFirst().get("placementScope").getAsString());
assertEquals(List.of("minecraft:sand"), IngestJson.strings(deposits.getFirst().get("replaceableBlocks")));
}
@Test
public void environmentScanOrePassesThroughWithTheModifierNamed() {
CatalogPlacedFeature buried = feature("minecraft:ore",