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
5 changes: 5 additions & 0 deletions .github/workflows/build_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'

- name: Build and test
run: |
chmod +x ./gradlew
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'

- name: Read gradle.properties
run: |
# Keeps the CurseForge ID defined in one place.
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
4.0.0.121012 for 1.21.1

Added raw drops and storage blocks for all seventeen ores, with Fortune and Silk Touch support. Raw pieces smelt or blast into ingots, or crush into dust. Crack Hammers still crush a whole ore into two dust without a Fortune bonus.
Restored crafting, furnace and blast-furnace recipe discovery, including dust already held when joining. Earned recipes survive Fantasy Level changes and data reloads.
Restored equipment recycling and plate repairs, preserving saved item data. Rods still yield four, gears four and plates three; recycling cannot return more metal than those recipes use.
Restored standalone coal-dust processing. Base Metals owns the coal recipes when installed together.
Galvanized steel and stainless steel blends accept whole steel blend as well as steel dust. Restored the Chrome alias for chromium dust.
Carried over the audited mining tiers from 1.13, including iron-tier galvanized steel and separate ore and solid-metal requirements.
Added the OreSpawn configuration entry, completed material names across all nine languages and fixed overlay UV bounds.
Retained flattened 1.13 bucket, fluid, legacy alloy ore and projectile identities, converted old wall connections and kept the saved OreSpawn rule IDs. Retrogen stays off.
Checked against published MMDLib 2.0.2, OreSpawn 4.1.1 and optional Base Metals 4.0.1, and checked in Eclipse. Publication is still pending.

Ported to Minecraft 1.21.1 on NeoForge 21.1, built on MMDLib 2.0.2 and OreSpawn 4.
Materials are MMDLib definitions in mmdlib/material/; MMDLib registers their items, blocks, arrows, armor and molten fluids.
Recipes use common (c:) tags instead of the ore dictionary. Low Fantasy now removes restricted recipes when a world loads.
Fantasy Level, villager trades and molten metal burning are set in config/modernmetals-common.toml or the in-game settings screen.
Ores generate between Y -64 and their 1.12 maximum height. Titanium ore stays optional in OreSpawn.
Integrations with mods that have no 1.21.1 release (Tinkers' Construct, Construct's Armory, IC2, Thermal Expansion, Ender IO, Thaumcraft, Dense Ores and Vein Miner) were removed. Mekanism processing forms appear when Mekanism is installed.
1.12.2 worlds cannot be upgraded to this version.
Numeric 1.10–1.12 saves must be upgraded through the released 1.13.2 version first. Always use a backup.

2.5.2.112021 for 1.12.2

Expand Down
51 changes: 45 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,72 @@ osmium and titanium. It adds their ores and molten forms, equipment, building
blocks and Crack Hammer processing.

For Modern Metals 4.0.0.121012, install NeoForge 21.1.265 or later,
[MMDLib 2.0.2][mmdlib] or later and [OreSpawn 4][orespawn]. Modern Metals also
[MMDLib 2.0.2][mmdlib] or later and [OreSpawn 4.1.1][orespawn]. Modern Metals also
works alongside [Base Metals][basemetals], which supplies the copper, nickel,
steel and zinc dusts used in some alloy blends.

The Modern Metals settings are in `config/modernmetals-common.toml` and on the
settings screen in the Mods list. Low Fantasy removes recipes for implausible
settings screen in the Mods list or OreSpawn's mod directory. Low Fantasy removes recipes for implausible
equipment and structures. Existing items remain usable. When Base Metals is
installed, Modern Metals uses Base Metals' Fantasy Level. Restart Minecraft
after changing the setting.

Titanium is made from rutile and magnesium by default. The optional titanium
ore rule can be enabled in OreSpawn.

Mining an ore with a suitable pickaxe drops raw material. Fortune increases the
raw drops; Silk Touch keeps the ore block. A Crack Hammer crushes an ore into
two dust, without a Fortune bonus. Raw material crushes into one dust, or can
be smelted or blasted directly. Nine raw pieces make a storage block.

Equipment and components can be recycled in a furnace. Recycling is limited
to the metal used to make them, including the four rods, four gears and three
plates produced by their recipes. A matching plate repairs armor or a shield
in a crafting grid and preserves its enchantments and other saved data.

The recipe books reveal crafting, furnace and blast-furnace recipes when you
collect their ingredients. Dust already in your inventory is checked when you
join or reload data. Earned recipes return when you switch back to an eligible
Fantasy Level. Galvanized and stainless steel blends also accept whole steel
blend. Chromium dust and the Chrome tag work in the same alloy recipes.

Modern Metals supplies coal-dust processing when used alone. Base Metals owns
those recipes when both mods are installed. Coal dust must be compressed into
a coal block to recover usable coal; the dust itself is not furnace fuel.

Flattened 1.13.2 saves retain their material IDs, old molten buckets and fluids,
legacy alloy ores, wall connections, arrows and bolts. Always test upgrades on
a backup. This port does not directly convert numeric 1.10–1.12 registries;
upgrade those saves through the released 1.13.2 version first. OreSpawn's saved
rule IDs are retained and retrogen remains off.

See [the testing guide](docs/MANUAL_TESTING.md) for the standalone and Base
Metals Eclipse profiles and the remaining manual checks.

[mmdlib]: https://www.curseforge.com/minecraft/mc-mods/mmdlib
[orespawn]: https://www.curseforge.com/minecraft/mc-mods/mmd-orespawn
[basemetals]: https://www.curseforge.com/minecraft/mc-mods/base-metals

## Building

Building needs Java 21. Run `./gradlew build`; the mod, sources and Javadocs
Building needs Java 21 and Node.js 22 or later. Run `./gradlew build`; the mod, sources and Javadocs
are written to `build/libs`. `./gradlew runClient` and `./gradlew runServer`
start a development game in `run/`.
start a development game. `runClient` uses `run/standalone/`, while
`runClientWithBase` uses `run/with-base-metals/` and the checksum-verified
published Base Metals 4.0.1 jar. These profiles have separate settings and saves.

`generateProcessingData` builds the processing supplements, independent mining
tags, translations and recipe advancements. The raw textures are checked in;
the optional Pillow script in `tools/` reproduces them from the documented pixel
masks. Normal builds do not need Python or Pillow.

Each material is defined in `src/main/resources/mmdlib/material/`. MMDLib reads
these at startup and registers the material's items, blocks and molten fluid.
The models, recipes, loot tables and tags for those items and blocks are in
`src/main/resources`.

To publish a release, push a tag such as `4.0.0.121012`. The tag is used as the
mod version.
`test` loads Minecraft's real recipe codecs and tags. `runGameTest` and
`runGameTestLow` exercise world behavior; add `-PwithBaseMetals=true` to test
with published Base Metals, or `-PwithContributors=true` to `test` for optional
third-party ingredient tags. Test helpers are excluded from the product jars
and ordinary client/server profiles.
205 changes: 203 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ neoForge {
}
client {
client()
gameDirectory = file('run/standalone')
}
clientWithBase {
client()
gameDirectory = file('run/with-base-metals')
}
clientSmokeWithBase { client() }
server {
server()
programArgument '--nogui'
Expand All @@ -57,15 +63,206 @@ repositories {
content {
includeGroup 'zone.moddev.mc.lib'
includeGroup 'zone.moddev.mc.orespawn'
includeGroup 'zone.moddev.mc.basemetals'
}
}
}

def publishedBaseJar = layout.projectDirectory.file("libs/development/basemetals-${base_metals_test_version}.jar")
def baseTestSha256 = 'b4bb1cbcd54dfcf2ec8465ace82715edccc5bf1e5c15e14c627ae7cc58e8fed1'
def downloadTestBase = tasks.register('downloadTestBaseMetals') {
outputs.file publishedBaseJar
doLast {
def destination = publishedBaseJar.asFile
destination.parentFile.mkdirs()
def encodedVersion = base_metals_test_version.replace('+', '%2B')
def connection = new URI("https://github.com/MinecraftModDevelopmentMods/BaseMetals/releases/download/${encodedVersion}/basemetals-${encodedVersion}.jar").toURL().openConnection()
connection.setRequestProperty('User-Agent', 'ModernMetals-local-tests')
connection.connectTimeout = 30000
connection.readTimeout = 60000
def bytes = connection.inputStream.withCloseable { it.bytes }
def hash = java.security.MessageDigest.getInstance('SHA-256').digest(bytes).encodeHex().toString()
if (hash != baseTestSha256) throw new GradleException("Published Base Metals checksum mismatch: ${hash}")
destination.bytes = bytes
}
}
def baseTestFiles = files(publishedBaseJar).builtBy(downloadTestBase)

dependencies {
implementation "zone.moddev.mc.lib:mmdlib:${mmdlib_version}"
// Modern Metals only ships OreSpawn data; the mod itself is needed at runtime.
runtimeOnly "zone.moddev.mc.orespawn:OreSpawn:${orespawn_version}"
implementation "zone.moddev.mc.orespawn:OreSpawn:${orespawn_version}"
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.4'
testImplementation "net.neoforged:testframework:${neoforge_version}"
}
if (providers.gradleProperty('withBaseMetals').orElse('false').get().toBoolean()) {
dependencies { runtimeOnly baseTestFiles }
}

neoForge.unitTest {
enable()
testedMod = neoForge.mods.modernmetals
}
tasks.named('test', Test) {
useJUnitPlatform()
maxHeapSize = '3G'
systemProperty 'modernmetals.test.contributors', providers.gradleProperty('withContributors').orElse('false').get()
testLogging { events 'passed', 'skipped', 'failed'; exceptionFormat 'full' }
}
if (providers.gradleProperty('withContributors').orElse('false').get().toBoolean()) {
sourceSets.test.resources.srcDir 'src/contributorTest/resources'
}

sourceSets {
gameTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
configurations.gameTestImplementation.extendsFrom(configurations.implementation)
configurations.gameTestRuntimeOnly.extendsFrom(configurations.runtimeOnly)
neoForge {
addModdingDependenciesTo sourceSets.gameTest
mods {
modernmetals_tests { sourceSet sourceSets.gameTest }
}
runs {
client { loadedMods = [mods.modernmetals] }
clientWithBase { loadedMods = [mods.modernmetals] }
server { loadedMods = [mods.modernmetals] }
gameTest {
type = 'gameTestServer'
sourceSet = sourceSets.gameTest
loadedMods = [mods.modernmetals, mods.modernmetals_tests]
gameDirectory = file('run/game-tests')
systemProperty 'neoforge.enabledGameTestNamespaces', 'modernmetals_tests'
}
gameTestLow {
type = 'gameTestServer'
sourceSet = sourceSets.gameTest
loadedMods = [mods.modernmetals, mods.modernmetals_tests]
gameDirectory = file('run/game-tests-low')
systemProperty 'neoforge.enabledGameTestNamespaces', 'modernmetals_tests'
}
clientSmoke {
client()
sourceSet = sourceSets.gameTest
loadedMods = [mods.modernmetals, mods.modernmetals_tests]
gameDirectory = file('run/client-smoke')
systemProperty 'modernmetals.clientSmoke', 'true'
}
clientSmokeWithBase {
client()
sourceSet = sourceSets.gameTest
loadedMods = [mods.modernmetals, mods.modernmetals_tests]
gameDirectory = file('run/client-smoke-base')
systemProperty 'modernmetals.clientSmoke', 'true'
systemProperty 'modernmetals.expectedBase', 'true'
}
serverSmoke {
server()
sourceSet = sourceSets.gameTest
loadedMods = [mods.modernmetals, mods.modernmetals_tests]
gameDirectory = file(providers.gradleProperty('smokeDirectory').orElse('run/server-smoke').get())
systemProperty 'modernmetals.serverSmoke', 'true'
programArgument '--nogui'
}
}
}
tasks.register('prepareLowFantasyTest') {
doLast {
def config = file('run/game-tests-low/config')
config.mkdirs()
def withBase = providers.gradleProperty('withBaseMetals').orElse('false').get().toBoolean()
new File(config, 'modernmetals-common.toml').text = 'contentMode = "' + (withBase ? 'HIGH_FANTASY' : 'LOW_FANTASY') + '"\n'
new File(config, 'basemetals-common.toml').text = 'contentMode = "low_fantasy"\n'
}
}
tasks.named('runGameTestLow') { dependsOn 'prepareLowFantasyTest' }

def generatedModernization = layout.buildDirectory.dir('generated/modernization')
tasks.register('generateProcessingData', Exec) {
inputs.file 'tools/generate_processing_data.js'
inputs.file 'tools/material-policy.json'
inputs.file 'tools/material-names.json'
inputs.dir 'src/main/resources'
outputs.dir generatedModernization
commandLine 'node', 'tools/generate_processing_data.js'
}
// Merge once so Eclipse cannot overwrite generated loot, tags and languages with older copies.
def mergedMainResources = layout.buildDirectory.dir('generated/merged-resources')
tasks.register('mergeProcessingResources', Sync) {
dependsOn 'generateProcessingData'
from generatedModernization
from 'src/main/resources'
into mergedMainResources
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
sourceSets.main.resources.setSrcDirs([mergedMainResources])
tasks.named('processResources') {
dependsOn 'mergeProcessingResources'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.named('sourcesJar') {
dependsOn 'mergeProcessingResources'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.register('verifyProcessingData', Exec) {
dependsOn 'generateProcessingData'
commandLine 'node', '--test', 'tools/test_processing_data.js'
}
tasks.named('check') { dependsOn 'verifyProcessingData' }

tasks.register('prepareBaseProfiles') {
dependsOn downloadTestBase
doLast {
def bytes = publishedBaseJar.asFile.bytes
def actual = java.security.MessageDigest.getInstance('SHA-256').digest(bytes).encodeHex().toString()
if (actual != baseTestSha256) throw new GradleException("Base Metals test jar changed: ${actual}")
for (String directory : ['run/with-base-metals/mods', 'run/client-smoke-base/mods']) {
def folder = file(directory)
folder.mkdirs()
new File(folder, publishedBaseJar.asFile.name).bytes = bytes
}
}
}
neoForge {
ideSyncTask tasks.named('mergeProcessingResources')
runs {
clientWithBase { taskBefore tasks.named('prepareBaseProfiles') }
clientSmokeWithBase { taskBefore tasks.named('prepareBaseProfiles') }
[gameTest, gameTestLow, clientSmoke, clientSmokeWithBase, serverSmoke].each { it.disableIdeRun() }
}
}
tasks.named('createLaunchScripts') { dependsOn 'prepareBaseProfiles' }

tasks.register('createManualEclipseProfiles') {
dependsOn 'mergeProcessingResources', 'prepareBaseProfiles'
doLast {
def destination = file('.eclipse/configurations')
destination.mkdirs()
for (def entry : ['Standalone':'runClient', 'With Base Metals':'runClientWithBase']) {
def output = new StringWriter()
def xml = new groovy.xml.MarkupBuilder(output)
xml.mkp.xmlDeclaration(version:'1.0', encoding:'UTF-8')
xml.launchConfiguration(type:'org.eclipse.buildship.core.launch.runconfiguration') {
listAttribute(key:'tasks') { listEntry(value:entry.value) }
stringAttribute(key:'working_dir', value:'${workspace_loc:ModernMetals}')
stringAttribute(key:'gradle_distribution', value:'GRADLE_DISTRIBUTION(WRAPPER)')
booleanAttribute(key:'offline_mode', value:'false')
booleanAttribute(key:'show_console_view', value:'true')
booleanAttribute(key:'show_execution_view', value:'true')
booleanAttribute(key:'override_workspace_settings', value:'false')
}
new File(destination, "ModernMetals - ${entry.key}.launch").setText(output.toString(), 'UTF-8')
}
def prefs = file('.settings/org.eclipse.buildship.core.prefs')
prefs.parentFile.mkdirs()
def escape = { String value -> value.replace('\\', '/').replace(':', '\\:') }
prefs.text = "eclipse.preferences.version=1\nconnection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)\nconnection.project.dir=\ngradle.user.home=${escape(gradle.gradleUserHomeDir.path)}\njava.home=${escape(env.JAVA_HOME ?: System.getProperty('java.home'))}\noverride.workspace.settings=true\n"
}
}
tasks.named('eclipse') { dependsOn 'createManualEclipseProfiles' }

tasks.named('processResources', ProcessResources) {
def properties = [
Expand Down Expand Up @@ -96,6 +293,10 @@ tasks.withType(JavaCompile).configureEach {
// Report any use of deprecated Minecraft, NeoForge or MMDLib API.
options.compilerArgs.addAll(['-Xlint:deprecation', '-Xlint:removal'])
}
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

publishing {
publications {
Expand Down
Loading
Loading