Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
4.0.1.121012 for Minecraft 1.21.1

- Reduce widespread salt, potash and nitrate ores and favour more appropriate dry-basin settings.
- Tune lithium, sulfur and phosphorus depths and host preferences without adding a Mineralogy dependency.
- Keep all mineral identities, drops, custom-dimension fallbacks and saved profile choices unchanged. No retrogen is enabled.

4.0.0.121012 for Minecraft 1.21.1

All eight minerals come across to NeoForge 1.21.1. Use Java 21, NeoForge
Expand Down
28 changes: 15 additions & 13 deletions docs/ORE_GENERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ rocks, terrain, biomes, strata or fluid deposits, and needs no Mineralogy.

Ranges are inclusive. Frequency is expected attempts per chunk. Quantity is a
requested block budget, so veins can yield less when hosts are unavailable.
The ranges are unchanged from 1.13.2, so no mineral generates below Y 4.
The tuned ranges below apply to fresh Overworld defaults. Other ordinary
dimensions retain the previous fallback ranges and budgets.

| Mineral | Y | Attempts/chunk | Quantity | Shape |
| --- | --- | ---: | --- | --- |
| Lithium | 8..47 | 4 | 12..18 | Vein |
| Niter | 16..63 | 5 | 8..16 | Clusters |
| Salt | 24..79 | 2.5 | 16..32 | Flat clusters |
| Sulfur | 4..31 | 3 | 12..18 | Clusters |
| Phosphorus | 16..63 | 3 | 12..18 | Clusters |
| Potash | 8..47 | 2.5 | 12..24 | Flat clusters |
| Saltpeter | 24..79 | 3.75 | 8..16 | Clusters |
| Lithium | -32..56 | 3 | 15 | Vein |
| Niter | 32..88 | 1.5 | 12 | Clusters |
| Salt | 16..80 | 0.55 | 20 | Flat clusters |
| Sulfur | -32..64 | 1.5 | 15 | Clusters |
| Phosphorus | -16..64 | 1.5 | 15 | Clusters |
| Potash | 8..64 | 0.8 | 18 | Flat clusters |
| Saltpeter | 40..96 | 1.25 | 12 | Clusters |

Lithium and phosphorus use a triangular height curve. Sulfur favors the bottom
of its range, and the others use uniform heights. Each mineral retains its previous
expected requested budget while changing depth and shape. These are gameplay
of its range, and the others use uniform heights. The new Overworld defaults reduce excessive soluble-mineral supply while
retaining the previous shapes and the fallback budgets in other ordinary dimensions. These are gameplay
approximations rather than geological simulations.

Lithium uses vein length 8 and node size 3. Cluster horizontal spread, vertical
Expand All @@ -32,10 +33,11 @@ The balance draws on [lithium pegmatites](https://www.usgs.gov/data/lithium-depo
[evaporite potash](https://www.usgs.gov/publications/potash-a-global-overview-evaporate-related-potash-resources-including-spatial)
and [sedimentary phosphate](https://pubs.usgs.gov/bul/b1693/html/bull74kl.htm).

New profiles allow stone and the six named granite, diorite and andesite variants, including polished forms. Additional hosts are
Fresh Overworld rules accept exact natural stone/deepslate fallbacks, not polished
blocks. Other ordinary dimensions keep their historical fallback hosts. Geological hosts are
intrusive igneous rocks for lithium, sedimentary rocks for nitrates, salt, potash
and phosphorus, and sedimentary or volcanic rocks for sulfur. There are no hard biome
restrictions. Rules cover ordinary dimensions except vanilla Nether/End.
and phosphorus, and sedimentary or volcanic rocks for sulfur. There are no hard biome restrictions. Salt, potash and nitrates favour dry basins;
phosphorus favours sedimentary provinces and lithium favours intrusive settings. Rules cover ordinary dimensions except vanilla Nether/End.
Silicon and charcoal do not generate.

## Saved settings and shared ores
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Example: 1.0.0. 1 21 01 2 notice the minecraft version hidden there at the end?
# and the 2 means it's for NeoForge while 1 is Forge and I suspect if we did Fabric mods 3 would be for that.
# (This also helps for bug reports as the version number gives us a clue as to what version of Minecraft the bug happened on)
mod_version = 4.0.0.121012
mod_version = 4.0.1.121012
mod_name = Base Minerals
mod_id = baseminerals
mod_archive_name = BaseMinerals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Predicate;
Expand Down Expand Up @@ -40,6 +41,17 @@ public final class BaseMineralsWorldgenProvider {
new Ore("saltpeter", 24, 79, 3.75, 8, 16, OrePattern.CLUSTERS, OreHeightDistribution.UNIFORM,
4, 1, 3, 8, GeologyFamily.SEDIMENTARY));

private static final String[] GEOMES = {"stable_craton", "mountain_belt", "volcanic_arc",
"sedimentary_basin", "coastal_shelf", "arid_basin", "wetland_basin", "glacial_highland"};
private static final Map<String, Tuning> OVERWORLD = Map.of(
"lithium", new Tuning(-32, 56, 3, 15, new double[]{1.4, 1.2, .45, .2, .1, .45, .1, .7}),
"niter", new Tuning(32, 88, 1.5, 12, new double[]{.2, .1, .15, .7, .15, 2, .02, .05}),
"salt", new Tuning(16, 80, .55, 20, new double[]{.03, .03, .02, .5, .08, 2, .01, .03}),
"sulfur", new Tuning(-32, 64, 1.5, 15, new double[]{.15, .3, 2.5, .7, .65, 1.5, .15, .2}),
"phosphorus", new Tuning(-16, 64, 1.5, 15, new double[]{.35, .2, .2, 1.5, 1.5, .7, .7, .35}),
"potash", new Tuning(8, 64, .8, 18, new double[]{.05, .05, .03, .7, .12, 1.8, .02, .05}),
"saltpeter", new Tuning(40, 96, 1.25, 12, new double[]{.2, .1, .15, .65, .15, 2, .02, .05}));

private BaseMineralsWorldgenProvider() {}

/** Hands the registered ores to OreSpawn; runs during {@code InterModEnqueueEvent}. */
Expand Down Expand Up @@ -67,12 +79,12 @@ public static Optional<WorldgenProvider> build(Predicate<ResourceLocation> avail
.output(block, 100D);
// The explicit Overworld rule overrides the ordinary-dimension fallback,
// so each chunk receives a single placement budget.
ore.dimension(id("minecraft", "overworld"), rule::configure);
ore.dimension(id("minecraft", "overworld"), rule::configureOverworld);
ore.dimensionSelector(OreDimensionSelector.ALL_EXCEPT_NETHER_AND_END, rule::configure);
ores.add(ore.build());
}
if (ores.isEmpty()) return Optional.empty();
WorldgenProvider.Builder provider = WorldgenProvider.builder(BaseMinerals.MOD_ID, 1);
WorldgenProvider.Builder provider = WorldgenProvider.builder(BaseMinerals.MOD_ID, 2);
ores.forEach(provider::ore);
return Optional.of(provider.build());
}
Expand All @@ -81,6 +93,8 @@ private static ResourceLocation id(String namespace, String path) {
return ResourceLocation.fromNamespaceAndPath(namespace, path);
}

private record Tuning(int minY, int maxY, double frequency, int quantity, double[] geomes) {}

/**
* One mineral's placement. Ranges are inclusive; frequency is expected attempts
* per chunk; quantity is a requested block budget.
Expand All @@ -104,5 +118,23 @@ void configure(WorldgenProvider.OreDimensionDefinition.Builder placement) {
}
for (GeologyFamily family : families) placement.hostFamily(family);
}

void configureOverworld(WorldgenProvider.OreDimensionDefinition.Builder placement) {
Tuning tuning = OVERWORLD.get(name);
placement.yRange(tuning.minY, tuning.maxY).attempts(tuning.frequency).quantity(tuning.quantity)
.pattern(pattern).heightDistribution(height).placementChannel(id("orespawn", "standard"))
.spread(horizontal, vertical).nodeSize(node)
.hostBlock(id("minecraft", "stone")).hostBlock(id("minecraft", "deepslate"));
if (pattern == OrePattern.VEIN) {
JsonObject settings = new JsonObject();
settings.addProperty("length", length);
settings.addProperty("node_size", node);
settings.addProperty("spread", horizontal);
settings.addProperty("vertical_spread", vertical);
placement.pattern(id("orespawn", "vein"), settings);
}
for (GeologyFamily family : families) placement.hostFamily(family);
for (int i = 0; i < GEOMES.length; i++) placement.geomeWeight(id("orespawn", GEOMES[i]), tuning.geomes[i]);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,45 @@ void keepsTheFreshWorldPlacementTable() {
JsonObject ores = provider().getAsJsonObject("ores");
// Mineral, min Y, max Y, attempts per chunk, min and max quantity (docs/ORE_GENERATION.md).
Object[][] table = {
{"lithium", 8, 47, 4.0, 12, 18},
{"niter", 16, 63, 5.0, 8, 16},
{"salt", 24, 79, 2.5, 16, 32},
{"sulfur", 4, 31, 3.0, 12, 18},
{"phosphorus", 16, 63, 3.0, 12, 18},
{"potash", 8, 47, 2.5, 12, 24},
{"saltpeter", 24, 79, 3.75, 8, 16},
{"lithium", -32, 56, 3.0, 15, 15},
{"niter", 32, 88, 1.5, 12, 12},
{"salt", 16, 80, .55, 20, 20},
{"sulfur", -32, 64, 1.5, 15, 15},
{"phosphorus", -16, 64, 1.5, 15, 15},
{"potash", 8, 64, .8, 18, 18},
{"saltpeter", 40, 96, 1.25, 12, 12},
};
for (Object[] row : table) {
JsonObject placement = ores.getAsJsonObject("baseminerals:legacy/" + row[0] + "_ore")
.getAsJsonObject("dimensions").getAsJsonObject("minecraft:overworld");
assertEquals(row[1], placement.get("min_y").getAsInt(), row[0] + " min_y");
assertEquals(row[2], placement.get("max_y").getAsInt(), row[0] + " max_y");
assertEquals((double) row[3], placement.get("frequency").getAsDouble(), 1e-9, row[0] + " frequency");
assertEquals(row[4], placement.get("min_quantity").getAsInt(), row[0] + " min_quantity");
assertEquals(row[5], placement.get("max_quantity").getAsInt(), row[0] + " max_quantity");
assertEquals(row[4], placement.get("quantity").getAsInt(), row[0] + " fixed quantity");
assertEquals(row[4], row[5]);
assertEquals("orespawn:standard", placement.get("placement_channel").getAsString());
Set<String> hosts = new HashSet<>();
for (JsonElement host : placement.getAsJsonArray("host_blocks")) {
hosts.add(host.isJsonObject() ? host.getAsJsonObject().get("block").getAsString() : host.getAsString());
}
for (String host : BaseMineralsWorldgenProvider.STONE_HOSTS) {
assertTrue(hosts.contains("minecraft:" + host), row[0] + " accepts " + host);
}
assertEquals(Set.of("minecraft:stone", "minecraft:deepslate"), hosts);
assertEquals(8, placement.getAsJsonObject("geomes").size());
}
}

@Test
void customDimensionFallbackKeepsItsPreviousBudgetAndRouting() {
JsonObject ores = provider().getAsJsonObject("ores");
for (BaseMineralsWorldgenProvider.Ore rule : BaseMineralsWorldgenProvider.ORES) {
JsonObject ore = ores.getAsJsonObject("baseminerals:legacy/" + rule.name() + "_ore");
JsonObject fallback = ore.getAsJsonObject("dimension_selectors").getAsJsonObject("orespawn:all_except_nether_end");
assertEquals(rule.frequency(), fallback.get("frequency").getAsDouble(), 1e-9);
assertEquals(rule.minY(), fallback.get("min_y").getAsInt());
assertEquals(rule.maxY(), fallback.get("max_y").getAsInt());
assertEquals(rule.minQuantity(), fallback.get("min_quantity").getAsInt());
assertEquals(rule.maxQuantity(), fallback.get("max_quantity").getAsInt());
assertFalse(ore.getAsJsonObject("dimensions").has("minecraft:the_nether"));
assertFalse(ore.getAsJsonObject("dimensions").has("minecraft:the_end"));
}
}

Expand Down
Loading