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: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ jobs:
if-no-files-found: error
retention-days: 30
path: |
build/libs/OreSpawn-4.1.1.110021.jar
build/libs/OreSpawn-4.1.1.110021-sources.jar
build/libs/OreSpawn-4.1.1.110021-javadoc.jar
build/libs/OreSpawn-4.1.2.110021.jar
build/libs/OreSpawn-4.1.2.110021-sources.jar
build/libs/OreSpawn-4.1.2.110021-javadoc.jar
build/release/SHA256SUMS
CHANGELOG.txt

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version 4.1.2.110021

* Respect Manage Vanilla Ores for imported OS1/OS3 rules. With it off, leave
vanilla ore generation alone and keep those rules saved but inactive.
* With vanilla management on, use the imported placement settings without
adding a second Minecraft or OreSpawn default pass. Keep saved settings,
dimension limits and existing chunks unchanged.

Version 4.1.1.110021

* Keep existing provider settings when importing older OS1 or OS3 files for
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It gives mods and modpacks one place to configure ores, deposit shapes, optional
rock strata and geomes, provider-owned underground fluid deposits, biome
palettes and world materials, flat bedrock, and bounded ore retrogen.

This branch builds target-qualified version `4.1.1.110021`: the OreSpawn 4.1.1
This branch builds target-qualified version `4.1.2.110021`: the OreSpawn 4.1.2
feature set for Minecraft 1.10.2 and Forge. It adds stable generation identity,
non-loading geology sampling, per-resource background control, existing-world
provider merge policy, an Ore Sources arbiter for equivalent provider ores and
Expand Down
22 changes: 22 additions & 0 deletions docs/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,28 @@ replacement, retrogen, forced retrogen, flat bedrock, and bedrock thickness.
Unknown numeric dimensions and obsolete block states are reported instead of
guessed. Review `config/orespawn-migration/migration-report.txt` after import.

**Manage Vanilla Ores** controls imported vanilla-ore rules as well as the
modern defaults. With it off, imported vanilla rules remain saved but inactive:
they neither place ore nor suppress Minecraft's normal ore pass. Importing a
rule does not turn the switch on. Migration copies the old **Replace Vanilla
Oregen** setting when present; an existing saved world keeps its own setting.

With management on, an enabled imported vanilla-ore rule replaces the matching
Minecraft ore pass in the dimensions it covers. Its custom frequency, height,
vein size, hosts, biome limits and retrogen setting are kept. If OreSpawn's newer
vanilla default is also enabled, the imported rule takes precedence rather
than adding a second pass. Saved Ore Sources selections are applied before
removing duplicate defaults. Disabled rules and dimensions do not claim that ore.

This also applies to previously imported `orespawn:legacy/...` rules and the
bridge's provider-owned `<modid>:legacy/...` rules in saved world profiles.
Rules mapped to a modern provider ID keep the importer's `source_mod: legacy`
marker and follow the same switch.
The saved switch, placement settings and retrogen options are kept,
and ore already placed in existing chunks is left alone. Newly generated
chunks follow the saved management switch; existing excess ore is not removed.
Turning management off and back on does not discard the imported settings.

Global schemas 1-7 and world schemas 1-6 are upgraded in memory and persisted
where safe. A schema-1 world held only mode/oil/formation choices and is
overlaid on the effective installed-pack profile. A schema-2 world is already
Expand Down
2 changes: 2 additions & 0 deletions docs/PLAYER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ dormant instead of breaking world creation.
region.
- **Manage Vanilla Ores** lets OreSpawn replace vanilla ore features with the
configured OreSpawn rules. Leave it off to keep normal Minecraft placement.
Imported vanilla-ore rules stay saved but inactive while it is off. Turning
it on uses those settings without adding a second vanilla placement pass.
- **Ore Sources** opens the material-group editor beside **Add Block**. Compact
scrolling lists keep relevant groups on the left and the deduplicated union
of installed ore blocks represented by their aliases on the right. Ordinary
Expand Down
2 changes: 1 addition & 1 deletion docs/VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Examples:

| Minecraft | Loader | Target | Example full version |
| --- | --- | ---: | --- |
| 1.10.2 | Forge | `110021` | `4.1.1.110021` |
| 1.10.2 | Forge | `110021` | `4.1.2.110021` |
| 1.12.2 | Forge | `112021` | `4.0.6.112021` |
| 1.13.2 | Forge | `113021` | `4.0.6.113021` |
| 1.20.6 | Forge | `120061` | `4.0.6.120061` |
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mod_vendor=Minecraft Mod Development
mod_license=LGPL-2.1
mod_license_name=GNU Lesser General Public License, Version 2.1
mod_license_url=https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
mod_version=4.1.1.110021
mod_version=4.1.2.110021
mod_group=zone.moddev.mc.orespawn
mod_authors=SkyBlade1978, dshadowwolf, the MMD Team
mod_description=Configurable, provider-driven terrain, ore, and deposit generation.
Expand Down
6 changes: 3 additions & 3 deletions gradle/release/artifacts.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tasks.register('verifyReleaseConfiguration') {
description = 'Validates the target-qualified release, API, schemas, reports, and publishing identity.'

doLast {
if (project.mod_version != '4.1.1.110021'
if (project.mod_version != '4.1.2.110021'
|| project.mod_group != expectedMavenGroup) {
throw new GradleException("Unexpected OreSpawn release version: ${project.mod_version}")
}
Expand Down Expand Up @@ -106,8 +106,8 @@ tasks.register('verifyReleaseConfiguration') {
'src/main/java/zone/moddev/mc/orespawn/worldgen/LegacyOs3ProfileMigration.java',
'README.md', 'CHANGELOG.txt'
].each { path ->
if (!file(path).getText('UTF-8').contains('4.1.1.110021')) {
throw new GradleException("Authoritative release location does not contain 4.1.1.110021: ${path}")
if (!file(path).getText('UTF-8').contains('4.1.2.110021')) {
throw new GradleException("Authoritative release location does not contain 4.1.2.110021: ${path}")
}
}
if (!file('docs/API.md').getText('UTF-8').contains('orespawn@[4.0.6,5.0.0)')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1071,12 +1071,12 @@ private static void placeRawNaturalSources(World world, Chunk chunk, int minX, i
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
for (int index = 0; index < NATURAL_SOURCES.length; index++) {
int x = naturalX(minX, index), z = naturalZ(minZ, index);
chunk.setBlockState(pos.setPos(x, GROUND_Y - 12, z), NATURAL_SOURCES[index]);
chunk.setBlockState(pos.setPos(x, GROUND_Y - 11, z),
chunk.setBlockState(pos.setPos(x, GROUND_Y - 12, z).toImmutable(), NATURAL_SOURCES[index]);
chunk.setBlockState(pos.setPos(x, GROUND_Y - 11, z).toImmutable(),
index < NATURAL_SOURCES.length / 2
? Blocks.AIR.getDefaultState() : Blocks.WATER.getDefaultState());
}
chunk.setBlockState(pos.setPos(minX + 11, GROUND_Y - 24, minZ + 12),
chunk.setBlockState(pos.setPos(minX + 11, GROUND_Y - 24, minZ + 12).toImmutable(),
Blocks.BEDROCK.getDefaultState());
BlockPos chestPos = new BlockPos(minX + 12, GROUND_Y - 24, minZ + 12);
world.setBlockState(chestPos, Blocks.CHEST.getDefaultState(), 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ private static void writeHumanUpgradeReport(Path destination) throws IOException
}
}
List<String> lines = new ArrayList<>();
lines.add("OreSpawn 4.1.1.110021 Upgrade Report");
lines.add("OreSpawn 4.1.2.110021 Upgrade Report");
lines.add("================================");
lines.add("");
lines.add("RESULT: Legacy OreSpawn configuration was consumed and translated for OS4.");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cyano/orespawn/OreSpawn.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class OreSpawn {
public static OreSpawn INSTANCE;
public static final String MODID = "orespawn";
public static final String NAME = "OreSpawn";
public static final String VERSION = "4.1.1.110021";
public static final String VERSION = "4.1.2.110021";
public static final List<Path> oreSpawnConfigFiles = new ArrayList<>();
public static final List<String> additionalStoneBlocks = new ArrayList<>();
public static boolean disableVanillaOreGen;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/zone/moddev/mc/orespawn/OreSpawn.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class OreSpawn {

public static final String MODID = "orespawn";
public static final String NAME = "OreSpawn";
public static final String VERSION = "4.1.1.110021";
public static final String VERSION = "4.1.2.110021";

private static final Logger LOGGER = LogManager.getLogger();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private static void writeUpgradeReport(Path worldRoot, Path configDirectory,
}

List<String> lines = new ArrayList<>();
lines.add("OreSpawn 4.1.1.110021 Upgrade Report");
lines.add("OreSpawn 4.1.2.110021 Upgrade Report");
lines.add("================================");
lines.add("");
lines.add("RESULT: Existing Mineralogy " + mineralogyVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static void writeInitialUpgradeReport(Path configDirectory,
boolean forceRetrogen, boolean flatBedrock, boolean retrogenBedrock,
int bedrockLayers) throws IOException {
String newline = System.lineSeparator();
String text = "OreSpawn 4.1.1.110021 Upgrade Report" + newline
String text = "OreSpawn 4.1.2.110021 Upgrade Report" + newline
+ "================================" + newline + newline
+ "RESULT: Legacy OreSpawn settings were imported into the OS4 profile." + newline
+ "- Manage vanilla ores: " + manageVanilla + newline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,12 @@ private static Map<String, Group> discover(JsonObject root) {
for (Entry<String, JsonElement> oreEntry : ores.entrySet()) {
if (!oreEntry.getValue().isJsonObject()) continue;
JsonObject ore = oreEntry.getValue().getAsJsonObject();
boolean oreActive = bool(ore, "enabled", true)
&& (!bool(ore, "native_generation", false) || manageVanillaOres);
ResourceLocation blockId = resource(string(ore, "block", oreEntry.getKey()));
Block block = blockId == null ? null : ForgeRegistries.BLOCKS.getValue(blockId);
if (block == null || block == Blocks.AIR) continue;
boolean vanillaRule = bool(ore, "native_generation", false)
|| OreSpawnOreGeneration.isImportedVanillaOre(resource(oreEntry.getKey()), block, ore);
boolean oreActive = bool(ore, "enabled", true) && (!vanillaRule || manageVanillaOres);
int metadata = integer(ore, "metadata", 0);
ItemStack stack = new ItemStack(block, 1, metadata);
Inference inferred = inferMaterial(root, oreNames(stack));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,14 @@ private static BakedOres bakeOres(JsonObject profile, BakedGeomeConfig config) {
if (ruleId == null) ruleId = oreId;
outputBundles.put(ruleId.toString(), new BakedOutputBundle(
outputState, deepOutput, deepOutputMaxY, outputs));
if (!oreEnabled || (nativeGeneration && !manageVanillaOres)) continue;
boolean importedVanilla = !nativeGeneration && isImportedVanillaOre(ruleId, output, oreJson);
// Keep imported settings, but leave their vanilla ores alone while management is off.
if (!oreEnabled || (!manageVanillaOres && (nativeGeneration || importedVanilla))) continue;
ResourceLocation material = OreSourcePolicies.material(profile, oreJson,
new ItemStack(output, 1, integer(oreJson, "metadata", 0)));
boolean materialDeclared = resource(string(oreJson, "material", "")) != null;
BakedOreRule rule = new BakedOreRule(ruleId, output, material, materialDeclared,
manageVanillaOres && suppressVanilla);
manageVanillaOres && (importedVanilla || suppressVanilla), nativeGeneration, importedVanilla);

for (Entry<String, JsonElement> dimensionEntry : dimensions.entrySet()) {
ResourceLocation dimensionId = resource(dimensionEntry.getKey());
Expand Down Expand Up @@ -423,6 +425,7 @@ private static BakedOres bakeOres(JsonObject profile, BakedGeomeConfig config) {
}
}
combined = arbitrate(profile, combined, outputBundles);
combined = preferImportedVanilla(rules, combined);
result.put(dimension, combined.toArray(new BakedOre[combined.size()]));
vanillaOutputs.put(dimension, Collections.unmodifiableSet(suppressed));
generationScales.put(dimension, Collections.unmodifiableMap(scales));
Expand All @@ -444,6 +447,7 @@ private static BakedOres bakeOres(JsonObject profile, BakedGeomeConfig config) {
}
}
selectorList = arbitrate(profile, selectorList, outputBundles);
selectorList = preferImportedVanilla(rules, selectorList);
BakedOre[] selectorResult = selectorList.toArray(new BakedOre[selectorList.size()]);
LOGGER.info("Baked {} OreSpawn-managed ore definitions across {} dimensions",
rules.size(), result.size());
Expand All @@ -460,6 +464,36 @@ private static BakedOres bakeOres(JsonObject profile, BakedGeomeConfig config) {
Collections.unmodifiableMap(selectorMaterialScales));
}

static boolean isImportedVanillaOre(ResourceLocation ruleId, Block output, JsonObject ore) {
// A provider-aware import may keep the provider's modern ID instead of a legacy path.
if (ruleId == null || (!ruleId.getResourcePath().startsWith("legacy/")
&& !"legacy".equals(string(ore, "source_mod", "")))) return false;

return output == Blocks.COAL_ORE || output == Blocks.IRON_ORE || output == Blocks.GOLD_ORE
|| output == Blocks.REDSTONE_ORE || output == Blocks.LAPIS_ORE
|| output == Blocks.DIAMOND_ORE || output == Blocks.EMERALD_ORE || output == Blocks.QUARTZ_ORE;
}

private static List<BakedOre> preferImportedVanilla(List<BakedOreRule> rules, List<BakedOre> ores) {
Map<ResourceLocation, BakedOreRule> definitions = new HashMap<>();
for (BakedOreRule rule : rules) definitions.put(rule.ruleId, rule);

Set<Block> outputs = Collections.newSetFromMap(new IdentityHashMap<Block, Boolean>());
for (BakedOre ore : ores) {
BakedOreRule rule = definitions.get(ore.ruleId);
if (rule != null && rule.importedVanilla) outputs.add(rule.output);
}
if (outputs.isEmpty()) return ores;

// Apply saved Ore Sources choices first, then remove any duplicate modern defaults.
List<BakedOre> result = new ArrayList<>();
for (BakedOre ore : ores) {
BakedOreRule rule = definitions.get(ore.ruleId);
if (rule == null || !rule.nativeGeneration || !outputs.contains(rule.output)) result.add(ore);
}
return result;
}

private static List<BakedOre> arbitrate(JsonObject profile, List<BakedOre> original,
Map<String, BakedOutputBundle> outputBundles) {
if (!profile.has(OreSourcePolicies.SECTION)
Expand Down Expand Up @@ -1051,18 +1085,22 @@ private static final class BakedOreRule {
final ResourceLocation material;
final boolean materialDeclared;
final boolean suppressVanilla;
final boolean nativeGeneration;
final boolean importedVanilla;
final Map<ResourceLocation, BakedOre> explicit = new HashMap<>();
final Set<ResourceLocation> explicitDimensions = new HashSet<>();
BakedOre selector;

BakedOreRule(ResourceLocation ruleId, Block output, ResourceLocation material,
boolean materialDeclared,
boolean suppressVanilla) {
boolean suppressVanilla, boolean nativeGeneration, boolean importedVanilla) {
this.ruleId = ruleId;
this.output = output;
this.material = material;
this.materialDeclared = materialDeclared;
this.suppressVanilla = suppressVanilla;
this.nativeGeneration = nativeGeneration;
this.importedVanilla = importedVanilla;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void discoversLoadedNativeLegacyUiOnlyInactiveAndRejectedIntegrations() {
"directory_ui_only", parent -> new GuiScreen() { });

List<LoadedMod> loaded = Arrays.asList(
new LoadedMod("orespawn", "MMD OreSpawn", "4.1.1.110021"),
new LoadedMod("orespawn", "MMD OreSpawn", "4.1.2.110021"),
new LoadedMod("directory_realistic", "Realistic Deposits", "0.1.0.110021"),
new LoadedMod("directory_base", "Base Metals", "2.5.0-beta5"),
new LoadedMod("directory_mineralogy", "Mineralogy", "6.0.2.110021"),
Expand Down
Loading
Loading