From 537b7f4d194028fdd8208bec1c4faf31c042b54e Mon Sep 17 00:00:00 2001 From: JohnBraham Date: Sun, 15 Nov 2026 10:34:13 +0000 Subject: [PATCH] Complete Modern Metals 1.21.1 processing and raw ore support --- .github/workflows/build_status.yml | 5 + .github/workflows/publish.yml | 5 + CHANGELOG.txt | 12 +- README.md | 51 ++++- build.gradle | 205 +++++++++++++++++- docs/MANUAL_TESTING.md | 76 +++++++ gradle.properties | 7 +- .../data/c/tags/item/blends/steel.json | 6 + .../data/c/tags/item/dusts/chrome.json | 6 + .../data/c/tags/item/dusts/copper.json | 6 + .../data/c/tags/item/dusts/nickel.json | 6 + .../data/c/tags/item/dusts/zinc.json | 6 + .../mc/modernmetals/test/ClientSmoke.java | 81 +++++++ .../modernmetals/test/FantasyGameTests.java | 65 ++++++ .../test/ModernMetalsTestMod.java | 15 ++ .../test/ProcessingGameTests.java | 182 ++++++++++++++++ .../mc/modernmetals/test/ServerSmoke.java | 79 +++++++ .../resources/META-INF/neoforge.mods.toml | 13 ++ .../modernmetals_tests/structure/empty.nbt | Bin 0 -> 111 bytes .../moddev/mc/modernmetals/ModernMetals.java | 7 + .../mc/modernmetals/ModernMetalsClient.java | 32 ++- .../config/ModernMetalsConfig.java | 3 + .../content/CompatibilityContent.java | 68 ++++++ .../content/LegacyProjectile.java | 31 +++ .../mc/modernmetals/content/ModContent.java | 2 + .../migration/LegacyChunkStates.java | 24 ++ .../mixin/ChunkSerializerMixin.java | 24 ++ .../mc/modernmetals/recipe/ModRecipes.java | 18 ++ .../recipe/PlateRepairRecipe.java | 102 +++++++++ .../modernmetals/recipe/RecipeDiscovery.java | 92 ++++++++ .../resources/META-INF/neoforge.mods.toml | 3 + .../models/block/aluminum_ore.json | 48 +++- .../models/block/beryllium_ore.json | 48 +++- .../modernmetals/models/block/boron_ore.json | 48 +++- .../models/block/cadmium_ore.json | 48 +++- .../models/block/chromium_ore.json | 48 +++- .../models/block/iridium_ore.json | 48 +++- .../models/block/magnesium_ore.json | 48 +++- .../models/block/manganese_ore.json | 48 +++- .../modernmetals/models/block/osmium_ore.json | 48 +++- .../models/block/plutonium_ore.json | 48 +++- .../modernmetals/models/block/rutile_ore.json | 48 +++- .../models/block/tantalum_ore.json | 48 +++- .../models/block/titanium_ore.json | 48 +++- .../models/block/tungsten_ore.json | 48 +++- .../models/block/uranium_ore.json | 48 +++- .../models/block/zirconium_ore.json | 48 +++- .../textures/block/aluminum_raw_block.png | Bin 0 -> 511 bytes .../textures/block/beryllium_raw_block.png | Bin 0 -> 446 bytes .../textures/block/boron_raw_block.png | Bin 0 -> 459 bytes .../textures/block/cadmium_raw_block.png | Bin 0 -> 495 bytes .../textures/block/chromium_raw_block.png | Bin 0 -> 482 bytes .../textures/block/iridium_raw_block.png | Bin 0 -> 498 bytes .../textures/block/magnesium_raw_block.png | Bin 0 -> 478 bytes .../textures/block/manganese_raw_block.png | Bin 0 -> 496 bytes .../textures/block/osmium_raw_block.png | Bin 0 -> 507 bytes .../textures/block/plutonium_raw_block.png | Bin 0 -> 509 bytes .../textures/block/rutile_raw_block.png | Bin 0 -> 508 bytes .../textures/block/tantalum_raw_block.png | Bin 0 -> 488 bytes .../textures/block/thorium_raw_block.png | Bin 0 -> 455 bytes .../textures/block/titanium_raw_block.png | Bin 0 -> 485 bytes .../textures/block/tungsten_raw_block.png | Bin 0 -> 459 bytes .../textures/block/uranium_raw_block.png | Bin 0 -> 518 bytes .../textures/block/zirconium_raw_block.png | Bin 0 -> 495 bytes .../textures/item/aluminum_raw.png | Bin 0 -> 535 bytes .../textures/item/beryllium_raw.png | Bin 0 -> 519 bytes .../modernmetals/textures/item/boron_raw.png | Bin 0 -> 496 bytes .../textures/item/cadmium_raw.png | Bin 0 -> 537 bytes .../textures/item/chromium_raw.png | Bin 0 -> 512 bytes .../textures/item/coal_powder.png | Bin 0 -> 404 bytes .../textures/item/iridium_raw.png | Bin 0 -> 530 bytes .../textures/item/magnesium_raw.png | Bin 0 -> 518 bytes .../textures/item/manganese_raw.png | Bin 0 -> 536 bytes .../modernmetals/textures/item/osmium_raw.png | Bin 0 -> 544 bytes .../textures/item/plutonium_raw.png | Bin 0 -> 534 bytes .../modernmetals/textures/item/rutile_raw.png | Bin 0 -> 539 bytes .../textures/item/tantalum_raw.png | Bin 0 -> 531 bytes .../textures/item/thorium_raw.png | Bin 0 -> 498 bytes .../textures/item/titanium_raw.png | Bin 0 -> 529 bytes .../textures/item/tungsten_raw.png | Bin 0 -> 492 bytes .../textures/item/uranium_raw.png | Bin 0 -> 539 bytes .../textures/item/zirconium_raw.png | Bin 0 -> 519 bytes .../data/modernmetals/orespawn/provider.json | 36 +-- .../recipe/galvanizedsteel_blend_base.json | 33 ++- .../recipe/nichrome_blend_base.json | 11 +- .../recipe/stainlesssteel_blend_base.json | 44 +++- .../resources/mmdlib/block/raw_block.json | 12 + src/main/resources/mmdlib/item/raw.json | 7 + .../resources/mmdlib/material/aluminum.json | 4 +- .../mmdlib/material/aluminumbrass.json | 2 +- .../resources/mmdlib/material/beryllium.json | 7 +- src/main/resources/mmdlib/material/boron.json | 9 +- .../resources/mmdlib/material/cadmium.json | 4 +- .../resources/mmdlib/material/chromium.json | 9 +- .../mmdlib/material/galvanizedsteel.json | 5 +- .../resources/mmdlib/material/iridium.json | 9 +- .../resources/mmdlib/material/magnesium.json | 4 +- .../resources/mmdlib/material/manganese.json | 7 +- .../resources/mmdlib/material/nichrome.json | 3 +- .../resources/mmdlib/material/osmium.json | 9 +- .../resources/mmdlib/material/plutonium.json | 7 +- .../resources/mmdlib/material/rutile.json | 9 +- .../mmdlib/material/stainlesssteel.json | 3 +- .../resources/mmdlib/material/tantalum.json | 9 +- .../resources/mmdlib/material/thorium.json | 4 +- .../resources/mmdlib/material/titanium.json | 7 +- .../resources/mmdlib/material/tungsten.json | 9 +- .../resources/mmdlib/material/uranium.json | 9 +- .../resources/mmdlib/material/zirconium.json | 7 +- src/main/resources/modernmetals.mixins.json | 8 + .../ProcessingIntegrationTest.java | 151 +++++++++++++ tools/generate_processing_data.js | 200 +++++++++++++++++ tools/generate_raw_textures.py | 38 ++++ tools/material-names.json | 25 +++ tools/material-policy.json | 128 +++++++++++ tools/test_processing_data.js | 54 +++++ tools/textures/README.md | 15 ++ tools/textures/raw_block_template.png | Bin 0 -> 212 bytes tools/textures/raw_item_template.png | Bin 0 -> 532 bytes 119 files changed, 2673 insertions(+), 225 deletions(-) create mode 100644 docs/MANUAL_TESTING.md create mode 100644 src/contributorTest/resources/data/c/tags/item/blends/steel.json create mode 100644 src/contributorTest/resources/data/c/tags/item/dusts/chrome.json create mode 100644 src/contributorTest/resources/data/c/tags/item/dusts/copper.json create mode 100644 src/contributorTest/resources/data/c/tags/item/dusts/nickel.json create mode 100644 src/contributorTest/resources/data/c/tags/item/dusts/zinc.json create mode 100644 src/gameTest/java/zone/moddev/mc/modernmetals/test/ClientSmoke.java create mode 100644 src/gameTest/java/zone/moddev/mc/modernmetals/test/FantasyGameTests.java create mode 100644 src/gameTest/java/zone/moddev/mc/modernmetals/test/ModernMetalsTestMod.java create mode 100644 src/gameTest/java/zone/moddev/mc/modernmetals/test/ProcessingGameTests.java create mode 100644 src/gameTest/java/zone/moddev/mc/modernmetals/test/ServerSmoke.java create mode 100644 src/gameTest/resources/META-INF/neoforge.mods.toml create mode 100644 src/gameTest/resources/data/modernmetals_tests/structure/empty.nbt create mode 100644 src/main/java/zone/moddev/mc/modernmetals/content/CompatibilityContent.java create mode 100644 src/main/java/zone/moddev/mc/modernmetals/content/LegacyProjectile.java create mode 100644 src/main/java/zone/moddev/mc/modernmetals/migration/LegacyChunkStates.java create mode 100644 src/main/java/zone/moddev/mc/modernmetals/mixin/ChunkSerializerMixin.java create mode 100644 src/main/java/zone/moddev/mc/modernmetals/recipe/ModRecipes.java create mode 100644 src/main/java/zone/moddev/mc/modernmetals/recipe/PlateRepairRecipe.java create mode 100644 src/main/java/zone/moddev/mc/modernmetals/recipe/RecipeDiscovery.java create mode 100644 src/main/resources/assets/modernmetals/textures/block/aluminum_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/beryllium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/boron_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/cadmium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/chromium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/iridium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/magnesium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/manganese_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/osmium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/plutonium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/rutile_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/tantalum_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/thorium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/titanium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/tungsten_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/uranium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/block/zirconium_raw_block.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/aluminum_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/beryllium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/boron_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/cadmium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/chromium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/coal_powder.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/iridium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/magnesium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/manganese_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/osmium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/plutonium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/rutile_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/tantalum_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/thorium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/titanium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/tungsten_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/uranium_raw.png create mode 100644 src/main/resources/assets/modernmetals/textures/item/zirconium_raw.png create mode 100644 src/main/resources/mmdlib/block/raw_block.json create mode 100644 src/main/resources/mmdlib/item/raw.json create mode 100644 src/main/resources/modernmetals.mixins.json create mode 100644 src/test/java/zone/moddev/mc/modernmetals/ProcessingIntegrationTest.java create mode 100644 tools/generate_processing_data.js create mode 100644 tools/generate_raw_textures.py create mode 100644 tools/material-names.json create mode 100644 tools/material-policy.json create mode 100644 tools/test_processing_data.js create mode 100644 tools/textures/README.md create mode 100644 tools/textures/raw_block_template.png create mode 100644 tools/textures/raw_item_template.png diff --git a/.github/workflows/build_status.yml b/.github/workflows/build_status.yml index 0803185d..66757366 100644 --- a/.github/workflows/build_status.yml +++ b/.github/workflows/build_status.yml @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0b79ae7d..42bf325e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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. diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 11106b28..ffc0c9fe 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/README.md b/README.md index 7d4beb73..87b7238c 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,12 @@ 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. @@ -18,20 +18,59 @@ 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. diff --git a/build.gradle b/build.gradle index 7fcd309a..7f428c4b 100644 --- a/build.gradle +++ b/build.gradle @@ -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' @@ -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 = [ @@ -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 { diff --git a/docs/MANUAL_TESTING.md b/docs/MANUAL_TESTING.md new file mode 100644 index 00000000..06482a0d --- /dev/null +++ b/docs/MANUAL_TESTING.md @@ -0,0 +1,76 @@ +# Testing the 1.21.1 NeoForge candidate + +This candidate has been checked in Eclipse and is ready for review. It has not +been published. + +Use Java 21, the Gradle wrapper and Node.js 22 or later. In this workspace, +Gradle and Eclipse use `D:/BaseMetals/.gradle-verify-cache`. + +Run `gradlew build eclipse createLaunchScripts` before importing the inner +`ModernMetals` project into Eclipse as an existing Gradle project. Refresh the +Gradle project after changes. The two launch configurations are generated in +`.eclipse/configurations/` and appear under Gradle Project in Eclipse's Run +Configurations. They launch through Gradle so generated resources are current. +The generated command scripts are also available under `build/moddev/`. +The two manual client profiles are: + +| Profile | Gradle task | Settings and saves | +| --- | --- | --- | +| Modern Metals alone | `runClient` | `run/standalone/` | +| Modern Metals with published Base Metals 4.0.1 | `runClientWithBase` | `run/with-base-metals/` | + +Both use published MMDLib 2.0.2 and OreSpawn 4.1.1. The Base Metals test jar is +downloaded from its GitHub release and checked against its SHA-256. Test probes +are excluded from these two profiles and from the distributable jars. + +## Gameplay checks + +1. Start a fresh world in each profile. Check raw item/block textures, ore + overlays, creative tabs and translated names. Thorium retains its existing + full-block ore texture; the other native ores use overlays. +2. Mine ores with an appropriate pickaxe, Fortune and Silk Touch. Check that + raw pieces pack/unpack nine to one, smelt/blast to one ingot and crush to one + dust. A Crack Hammer should crush a whole ore into two dust, without Fortune. +3. Pick up beryllium dust and check the furnace book. Try dust/ingot conversions, + the crafting book and the blast-furnace book. Rejoin with dust already held. + Run `/reload` and check the same recipes remain available. +4. Test titanium from rutile and magnesium with titanium generation off. + With Base Metals, test aluminum brass, galvanized steel, nichrome and + stainless steel. Use steel dust and whole steel blend separately; Chrome-tagged + contributors should also work. +5. Craft rods, gears and plates: outputs should be four, four and three. + Recycle equipment twice into the same furnace output slot and check full + quantities accumulate. Repair named/enchanted armor and a shield with the + matching plate and check their saved data. +6. In standalone, crush coal and a coal block. Compress nine dust into a coal + block, then unpack to nine coal. With Base Metals, check the shared coal + recipes have one deterministic owner. Coal dust itself should not burn. +7. Check the Mods-list config screen and the Modern Metals entry in OreSpawn. + Both must return to the correct parent screen. Test molten-metal contact + with burning enabled and disabled, including Fire Resistance. +8. Restart in Low Fantasy, using Base Metals' setting in the combined profile. + Plutonium tools should be unavailable while existing items remain usable. + Restart in High Fantasy and check previously earned recipes return. +9. Save/reopen a disposable copy of a 1.13.2 world. Check buckets, molten fluids, + placed walls, inventories and equipment. Visit later-generated chunks. + Do not open an original world for an upgrade test. Direct numeric 1.10–1.12 + conversion is outside this port; use the released 1.13.2 migration first. + +## Automated checks + +`build` runs deterministic resource checks and native recipe/registry tests. +`runGameTest` tests loot, hammer yields, mining levels, furnace accumulation, +held-dust discovery, old wall palettes/projectiles and Fantasy discovery. +`runGameTestLow` starts a separate Low Fantasy test world. Run both again with +`-PwithBaseMetals=true` for published Base Metals. Its cached Fantasy Level +requires a restart, so the Low profile deliberately starts with Base Metals +Low and Modern Metals High to verify inheritance. + +`test -PwithContributors=true` supplies optional tag-only alloy contributors. +`runClientSmoke` and `runClientSmokeWithBase` check baked models, names, overlay +UVs and both configuration factories. `runServerSmoke` is a disposable dedicated-world probe and stops the +server after checking generation and saving. These probe profiles are for +automation; use the two ordinary client profiles for manual testing. + +Automated checks cover the stated code paths. Visual appearance, recipe-book +usability and general gameplay still need manual acceptance. diff --git a/gradle.properties b/gradle.properties index d0268faf..426ef1bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ mod_authors = jriwanek, DShadowWolf, the MMD Team mod_credits = Cyanobacterium (aka DrCyano), lclc98 for all the help mod_license = LGPL-2.1-only curseforge_id = 244357 -update_url = https://raw.githubusercontent.com/MinecraftModDevelopmentMods/ModernMetals/refs/heads/master-1.21.1/update.json +update_url = https://raw.githubusercontent.com/MinecraftModDevelopmentMods/ModernMetals/refs/heads/master-1.21.1-neo/update.json issue_url = https://github.com/MinecraftModDevelopmentMods/ModernMetals/issues # Dependencies @@ -25,8 +25,9 @@ loader_version_range = [3,) # MMDLib provides the material system; OreSpawn generates the ores. mmdlib_version = 2.0.2.121012+Neo mmdlib_version_range = [2.0.2,) -orespawn_version = 4.1.0.121012 -orespawn_version_range = [4.0.16.121012,5.0.0) +orespawn_version = 4.1.1.121012 +base_metals_test_version = 4.0.1.121012+Neo +orespawn_version_range = [4.1.1.121012,5.0.0) # Parchment (parameter names + javadocs on top of Mojang mappings) # Versions: https://parchmentmc.org/docs/getting-started diff --git a/src/contributorTest/resources/data/c/tags/item/blends/steel.json b/src/contributorTest/resources/data/c/tags/item/blends/steel.json new file mode 100644 index 00000000..5e89bbc7 --- /dev/null +++ b/src/contributorTest/resources/data/c/tags/item/blends/steel.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "minecraft:iron_ingot" + ] +} diff --git a/src/contributorTest/resources/data/c/tags/item/dusts/chrome.json b/src/contributorTest/resources/data/c/tags/item/dusts/chrome.json new file mode 100644 index 00000000..0b7f5224 --- /dev/null +++ b/src/contributorTest/resources/data/c/tags/item/dusts/chrome.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "minecraft:diamond" + ] +} diff --git a/src/contributorTest/resources/data/c/tags/item/dusts/copper.json b/src/contributorTest/resources/data/c/tags/item/dusts/copper.json new file mode 100644 index 00000000..94466550 --- /dev/null +++ b/src/contributorTest/resources/data/c/tags/item/dusts/copper.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "minecraft:copper_ingot" + ] +} diff --git a/src/contributorTest/resources/data/c/tags/item/dusts/nickel.json b/src/contributorTest/resources/data/c/tags/item/dusts/nickel.json new file mode 100644 index 00000000..2e6bd5ff --- /dev/null +++ b/src/contributorTest/resources/data/c/tags/item/dusts/nickel.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "minecraft:iron_nugget" + ] +} diff --git a/src/contributorTest/resources/data/c/tags/item/dusts/zinc.json b/src/contributorTest/resources/data/c/tags/item/dusts/zinc.json new file mode 100644 index 00000000..3c978eae --- /dev/null +++ b/src/contributorTest/resources/data/c/tags/item/dusts/zinc.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "minecraft:gold_nugget" + ] +} diff --git a/src/gameTest/java/zone/moddev/mc/modernmetals/test/ClientSmoke.java b/src/gameTest/java/zone/moddev/mc/modernmetals/test/ClientSmoke.java new file mode 100644 index 00000000..aff8eca5 --- /dev/null +++ b/src/gameTest/java/zone/moddev/mc/modernmetals/test/ClientSmoke.java @@ -0,0 +1,81 @@ +package zone.moddev.mc.modernmetals.test; + +import java.nio.file.Files; +import java.nio.file.Path; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.TitleScreen; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.ItemStack; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.fml.ModList; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.client.event.ClientTickEvent; +import net.neoforged.neoforge.client.gui.IConfigScreenFactory; +import zone.moddev.mc.orespawn.api.client.WorldSettingsExtensionRegistry; + +/** Only loaded by the explicit clientSmoke run; never packaged with the mod. */ +@Mod(value="modernmetals_tests",dist=Dist.CLIENT) +public final class ClientSmoke { + private int step, ticks, items, overlays; + private Screen parent; + public ClientSmoke() { + if(Boolean.getBoolean("modernmetals.clientSmoke"))NeoForge.EVENT_BUS.addListener(this::tick); + } + private void tick(ClientTickEvent.Post event) { + var mc=Minecraft.getInstance(); + if(mc.getOverlay()!=null || mc.getModelManager()==null)return; + try { + if(step==0) { + if(mc.screen==null)return; + // A disposable first launch can show accessibility onboarding before the title screen. + if(!(mc.screen instanceof TitleScreen))mc.setScreen(new TitleScreen()); + if(Boolean.getBoolean("modernmetals.expectedPackaged")&&!zone.moddev.mc.modernmetals.ModernMetals.class.getResource("ModernMetals.class").toString().contains(".jar"))throw new AssertionError("Client product must load from candidate jar"); + if(Boolean.getBoolean("modernmetals.expectedBase")&&!ModList.get().isLoaded("basemetals"))throw new AssertionError("Base Metals missing from combined launch"); + for(var key:BuiltInRegistries.ITEM.keySet())if(key.getNamespace().equals("modernmetals")) { + var item=BuiltInRegistries.ITEM.get(key); + var model=mc.getItemRenderer().getModel(new ItemStack(item),null,null,0); + if(model==mc.getModelManager().getMissingModel())throw new AssertionError("Missing model "+key); + if(!net.minecraft.locale.Language.getInstance().has(item.getDescriptionId()))throw new AssertionError("Missing name "+key+" "+item.getDescriptionId()); + items++; + } + for(var key:BuiltInRegistries.BLOCK.keySet())if(key.getNamespace().equals("modernmetals")&&key.getPath().endsWith("_ore")) { + var state=BuiltInRegistries.BLOCK.get(key).defaultBlockState(); + var model=mc.getBlockRenderer().getBlockModel(state); + for(var face:Direction.values())for(var quad:model.getQuads(state,face,RandomSource.create(0))) { + var sprite=quad.getSprite(); + if(!sprite.contents().name().getPath().contains("ore_overlays"))continue; + overlays++; + var vertices=quad.getVertices();int stride=vertices.length/4; + for(int v=0;v<4;v++) { + float u=Float.intBitsToFloat(vertices[v*stride+4]),w=Float.intBitsToFloat(vertices[v*stride+5]); + if(usprite.getU1()+0.00001 || wsprite.getV1()+0.00001)throw new AssertionError("Overlay outside atlas sprite "+key); + } + } + } + if(overlays<102)throw new AssertionError("Expected all ore overlay faces, got "+overlays); + parent=mc.screen; + var container=ModList.get().getModContainerById("modernmetals").orElseThrow(); + mc.setScreen(container.getCustomExtension(IConfigScreenFactory.class).orElseThrow().createScreen(container,parent)); + step=1;ticks=0; + } else if(++ticks>=5) { + mc.screen.onClose(); + if(mc.screen!=parent)throw new AssertionError("Configuration screen did not return to its parent"); + if(step==1) { + var extension=WorldSettingsExtensionRegistry.extensions().stream().filter(e->e.id().getNamespace().equals("modernmetals")).findFirst().orElseThrow(); + mc.setScreen(extension.createScreen(parent));step=2;ticks=0; + } else { + finish(mc,"{\"status\":\"passed\",\"items\":"+items+",\"overlayFaces\":"+overlays+",\"configEntries\":2}"); + } + } + } catch(Throwable failure) {finish(mc,"{\"status\":\"failed\",\"error\":\""+failure.toString().replace("\\","/").replace("\"","'")+"\"}");} + } + private void finish(Minecraft mc,String result) { + step=3; + try {Files.writeString(Path.of("client-smoke.json"),result+"\n");}catch(Exception failure){throw new RuntimeException(failure);} + mc.stop(); + } +} diff --git a/src/gameTest/java/zone/moddev/mc/modernmetals/test/FantasyGameTests.java b/src/gameTest/java/zone/moddev/mc/modernmetals/test/FantasyGameTests.java new file mode 100644 index 00000000..6470ddb3 --- /dev/null +++ b/src/gameTest/java/zone/moddev/mc/modernmetals/test/FantasyGameTests.java @@ -0,0 +1,65 @@ +package zone.moddev.mc.modernmetals.test; + +import java.util.List; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.fml.ModList; +import net.neoforged.neoforge.common.ModConfigSpec; +import net.neoforged.neoforge.gametest.GameTestHolder; +import net.neoforged.neoforge.gametest.PrefixGameTestTemplate; +import zone.moddev.mc.modernmetals.config.ContentMode; +import zone.moddev.mc.modernmetals.config.ModernMetalsConfig; +import zone.moddev.mc.modernmetals.recipe.RecipeDiscovery; + +@GameTestHolder("modernmetals_tests") +@PrefixGameTestTemplate(false) +public final class FantasyGameTests { + @SuppressWarnings("unchecked") + @GameTest(template="empty", batch="fantasy-reload", timeoutTicks=1200) + public static void earnedRecipesSurviveFantasyReloads(GameTestHelper helper) throws Exception { + var server=helper.getLevel().getServer(); + var player=ProcessingGameTests.survivalPlayer(helper); + var key=ResourceLocation.parse("modernmetals:plutonium_pickaxe"); + var advKey=ResourceLocation.parse("modernmetals:recipes/plutonium_pickaxe"); + var own=ModernMetalsConfig.CONTENT_MODE.get(); + var base=ModList.get().isLoaded("basemetals") ? (ModConfigSpec.ConfigValue)Class.forName("zone.moddev.mc.basemetals.config.BaseMetalsConfig").getField("CONTENT_MODE").get(null):null; + String savedBase=base==null?null:base.get(); + if(base!=null || ModernMetalsConfig.activeMode()==ContentMode.LOW_FANTASY) { + if(base!=null)helper.assertTrue(ModernMetalsConfig.inheritsBaseMetals(),"Base Metals owns Fantasy Level"); + boolean low=ModernMetalsConfig.activeMode()==ContentMode.LOW_FANTASY; + helper.assertTrue(server.getRecipeManager().byKey(key).isEmpty()==low,"Recipes follow the startup Fantasy Level"); + helper.assertTrue((server.getAdvancements().get(advKey)==null)==low,"Discovery follows the startup Fantasy Level"); + server.getPlayerList().remove(player); + helper.succeed(); + return; + } + var advancement=server.getAdvancements().get(advKey); + player.getAdvancements().award(advancement,"has_recipe"); + var recipe=server.getRecipeManager().byKey(key).orElseThrow(); + player.resetRecipes(List.of(recipe)); + player.getInventory().clearContent(); + ModernMetalsConfig.CONTENT_MODE.set(base==null?ContentMode.LOW_FANTASY:ContentMode.HIGH_FANTASY); + ModernMetalsConfig.CONTENT_MODE.clearCache(); + if(base!=null)base.set("low_fantasy"); + helper.assertTrue(ModernMetalsConfig.activeMode()==ContentMode.LOW_FANTASY,"Base Fantasy inheritance or standalone setting"); + try { + var lowReload=server.reloadResources(server.getPackRepository().getSelectedIds()); + server.managedBlock(lowReload::isDone); lowReload.join(); + helper.assertTrue(server.getRecipeManager().byKey(key).isEmpty(),"Restricted recipe absent in Low Fantasy"); + helper.assertTrue(server.getAdvancements().get(advKey)==null,"Restricted discovery absent in Low Fantasy"); + ModernMetalsConfig.CONTENT_MODE.set(ContentMode.HIGH_FANTASY); + ModernMetalsConfig.CONTENT_MODE.clearCache(); + var highReload=server.reloadResources(server.getPackRepository().getSelectedIds()); + server.managedBlock(highReload::isDone); highReload.join(); + var restored=server.getRecipeManager().byKey(key).orElseThrow(); + RecipeDiscovery.discover(player); + helper.assertTrue(player.getRecipeBook().contains(restored),"Previously earned recipe restored without holding its ingredient"); + helper.succeed(); + } finally { + ModernMetalsConfig.CONTENT_MODE.set(own); + ModernMetalsConfig.CONTENT_MODE.clearCache(); + server.getPlayerList().remove(player); + } + } +} diff --git a/src/gameTest/java/zone/moddev/mc/modernmetals/test/ModernMetalsTestMod.java b/src/gameTest/java/zone/moddev/mc/modernmetals/test/ModernMetalsTestMod.java new file mode 100644 index 00000000..30d94ce6 --- /dev/null +++ b/src/gameTest/java/zone/moddev/mc/modernmetals/test/ModernMetalsTestMod.java @@ -0,0 +1,15 @@ +package zone.moddev.mc.modernmetals.test; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.RegisterGameTestsEvent; + +/** Explicitly loaded test mod, excluded from product jars and ordinary launches. */ +@Mod("modernmetals_tests") +public final class ModernMetalsTestMod { + public ModernMetalsTestMod(IEventBus bus) { + ServerSmoke.register(); + bus.addListener((RegisterGameTestsEvent event) -> event.register(ProcessingGameTests.class)); + bus.addListener((RegisterGameTestsEvent event) -> event.register(FantasyGameTests.class)); + } +} diff --git a/src/gameTest/java/zone/moddev/mc/modernmetals/test/ProcessingGameTests.java b/src/gameTest/java/zone/moddev/mc/modernmetals/test/ProcessingGameTests.java new file mode 100644 index 00000000..7c3d4849 --- /dev/null +++ b/src/gameTest/java/zone/moddev/mc/modernmetals/test/ProcessingGameTests.java @@ -0,0 +1,182 @@ +package zone.moddev.mc.modernmetals.test; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.mojang.authlib.GameProfile; +import io.netty.channel.embedded.EmbeddedChannel; +import net.minecraft.network.Connection; +import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.server.network.CommonListenerCookie; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; +import net.minecraft.world.level.block.entity.FurnaceBlockEntity; +import net.neoforged.neoforge.gametest.GameTestHolder; +import net.neoforged.neoforge.gametest.PrefixGameTestTemplate; +import zone.moddev.mc.lib.api.MaterialEventContexts; +import zone.moddev.mc.lib.common.runtime.CrackhammerEvents; +import zone.moddev.mc.modernmetals.content.ModContent; +import zone.moddev.mc.modernmetals.recipe.RecipeDiscovery; + +@GameTestHolder("modernmetals_tests") +@PrefixGameTestTemplate(false) +public final class ProcessingGameTests { + private static ResourceLocation id(String name) { return ResourceLocation.fromNamespaceAndPath("modernmetals", name); } + private static ItemStack item(String name) { return new ItemStack(BuiltInRegistries.ITEM.get(id(name))); } + + static ServerPlayer survivalPlayer(GameTestHelper helper) { + UUID uuid = UUID.randomUUID(); + var cookie = CommonListenerCookie.createInitial(new GameProfile(uuid, "mmd-" + uuid.toString().substring(0, 8)), false); + var level = helper.getLevel(); + var player = new ServerPlayer(level.getServer(), level, cookie.gameProfile(), cookie.clientInformation()); + var connection = new Connection(PacketFlow.SERVERBOUND); + new EmbeddedChannel(connection); + level.getServer().getPlayerList().placeNewPlayer(connection, player, cookie); + player.gameMode.changeGameModeForPlayer(GameType.SURVIVAL); + return player; + } + + @GameTest(template = "empty", timeoutTicks = 100) + public static void oldWallPaletteAndProjectileSurvive(GameTestHelper helper) { + var level = helper.getLevel(); + var pos = helper.absolutePos(new BlockPos(2,2,2)); + var wall = BuiltInRegistries.BLOCK.get(id("aluminum_wall")); + level.setBlockAndUpdate(pos, wall.defaultBlockState()); + var chunk = level.getChunkAt(pos); + var saved = net.minecraft.world.level.chunk.storage.ChunkSerializer.write(level, chunk); + for (var section : saved.getList("sections", 10)) { + for (var entry : ((net.minecraft.nbt.CompoundTag)section).getCompound("block_states").getList("palette",10)) { + var palette = (net.minecraft.nbt.CompoundTag)entry; + if (palette.getString("Name").equals("modernmetals:aluminum_wall")) { + for (String side : List.of("north","east","south","west")) palette.getCompound("Properties").putString(side, side.equals("north")?"true":"false"); + } + } + } + var restored = net.minecraft.world.level.chunk.storage.ChunkSerializer.read(level,level.getPoiManager(), + new net.minecraft.world.level.chunk.storage.RegionStorageInfo("modernmetals-test",level.dimension(),"chunk"),chunk.getPos(),saved); + helper.assertTrue(restored.getBlockState(pos).is(wall), "Old wall must not erase its section"); + helper.assertTrue(restored.getBlockState(pos).getValue(net.minecraft.world.level.block.WallBlock.NORTH_WALL)==net.minecraft.world.level.block.state.properties.WallSide.LOW,"Old boolean wall connection survives"); + helper.succeed(); + } + + @GameTest(template = "empty", timeoutTicks = 100) + public static void oldProjectileRetainsItsAmmunition(GameTestHelper helper) { + var level = helper.getLevel(); + var entityTag = new net.minecraft.nbt.CompoundTag(); + entityTag.putString("id","modernmetals:custom_bolt"); + var ammo = new net.minecraft.nbt.CompoundTag(); ammo.putString("id","modernmetals:titanium_bolt"); ammo.putByte("Count",(byte)1); + entityTag.put("Ammunition",ammo); + var entity = net.minecraft.world.entity.EntityType.loadEntityRecursive(entityTag,level,e->e); + helper.assertTrue(entity instanceof net.minecraft.world.entity.projectile.AbstractArrow,"Old projectile type must load"); + var after = new net.minecraft.nbt.CompoundTag(); entity.saveWithoutId(after); + helper.assertTrue(after.getCompound("item").getString("id").equals("modernmetals:titanium_bolt"),"Old projectile retains exact ammunition"); + helper.succeed(); + } + + @GameTest(template = "empty", timeoutTicks = 100) + public static void rawLootAndHammerIgnoreFortune(GameTestHelper helper) { + var level = helper.getLevel(); + var player = survivalPlayer(helper); + var enchantments = level.registryAccess().registryOrThrow(Registries.ENCHANTMENT); + int checked = 0; + for (String name : ModContent.materials().keySet()) { + if (!BuiltInRegistries.ITEM.containsKey(id(name + "_raw"))) continue; + var state = BuiltInRegistries.BLOCK.get(id(name + "_ore")).defaultBlockState(); + var pos = helper.absolutePos(new BlockPos(1, 2, 1)); + ItemStack pickaxe = new ItemStack(Items.NETHERITE_PICKAXE); + var normal = Block.getDrops(state, level, pos, null, player, pickaxe); + helper.assertTrue(normal.size() == 1 && normal.getFirst().is(item(name + "_raw").getItem()) && normal.getFirst().getCount() == 1, "Raw pickaxe drop " + name); + pickaxe.enchant(enchantments.getHolderOrThrow(Enchantments.SILK_TOUCH), 1); + var silk = Block.getDrops(state, level, pos, null, player, pickaxe); + helper.assertTrue(silk.size() == 1 && silk.getFirst().is(state.getBlock().asItem()), "Silk Touch " + name); + ItemStack hammer = item("titanium_crackhammer"); + hammer.enchant(enchantments.getHolderOrThrow(Enchantments.FORTUNE), 3); + player.setItemInHand(InteractionHand.MAIN_HAND, hammer); + var drops = new ArrayList(); + drops.add(new ItemEntity(level,pos.getX(),pos.getY(),pos.getZ(),new ItemStack(item(name + "_raw").getItem(),4))); + CrackhammerEvents.harvest(player, new MaterialEventContexts.Harvest(level,pos,state,hammer.copy(),drops)); + helper.assertTrue(drops.size() == 1 && drops.getFirst().getItem().is(item(name + "_powder").getItem()) && drops.getFirst().getItem().getCount() == 2, "Hammer must crush the ore once, without Fortune: " + name); + helper.assertTrue(hammer.getDamageValue() == 1, "One crushing operation durability " + name); + checked++; + } + helper.assertTrue(checked == 17, "All seventeen raw ores"); + level.getServer().getPlayerList().remove(player); + helper.succeed(); + } + + @GameTest(template = "empty", timeoutTicks = 100) + public static void furnaceAccumulatesAllRecyclingOutputs(GameTestHelper helper) { + BlockPos local = new BlockPos(1, 2, 1); + helper.setBlock(local, Blocks.FURNACE); + var pos = helper.absolutePos(local); + var level = helper.getLevel(); + FurnaceBlockEntity furnace = (FurnaceBlockEntity) level.getBlockEntity(pos); + furnace.setItem(1, new ItemStack(Items.COAL, 16)); + for (int operation = 0; operation < 2; operation++) { + furnace.setItem(0, item("aluminum_axe")); + for (int tick = 0; tick < 240; tick++) AbstractFurnaceBlockEntity.serverTick(level,pos,level.getBlockState(pos),furnace); + helper.assertTrue(furnace.getItem(2).is(item("aluminum_ingot").getItem()), "Recycled metal output"); + helper.assertTrue(furnace.getItem(2).getCount() == 3 * (operation + 1), "Furnace must accumulate full output counts"); + } + helper.succeed(); + } + + @GameTest(template = "empty", timeoutTicks = 100) + public static void existingDustInventoryRevealsFurnaceRecipes(GameTestHelper helper) { + var player = survivalPlayer(helper); + var server = helper.getLevel().getServer(); + var recipe = server.getRecipeManager().byKey(id("beryllium_powder_smelting")).orElseThrow(); + var advancement = server.getAdvancements().get(id("recipes/beryllium_powder_smelting")); + player.getInventory().setItem(0, item("beryllium_powder")); + player.resetRecipes(List.of(recipe)); + for (String criterion : advancement.value().criteria().keySet()) player.getAdvancements().revoke(advancement, criterion); + RecipeDiscovery.discover(player); + helper.assertTrue(player.getRecipeBook().contains(recipe), "Dust held before login/reload must reveal its furnace recipe"); + server.getPlayerList().remove(player); + helper.succeed(); + } + + @GameTest(template = "empty", timeoutTicks = 100) + public static void oldFurnaceAdvancementRestoresRenamedRecipe(GameTestHelper helper) { + var player=survivalPlayer(helper); + var server=helper.getLevel().getServer(); + var recipe=server.getRecipeManager().byKey(id("beryllium_powder_smelting")).orElseThrow(); + var old=server.getAdvancements().get(id("recipes/smelting/beryllium_powder")); + helper.assertTrue(old!=null,"Old furnace advancement ID exists"); + player.getAdvancements().award(old,"has_ingredient_1"); + var current=server.getAdvancements().get(id("recipes/beryllium_powder_smelting")); + for(String key:current.value().criteria().keySet())player.getAdvancements().revoke(current,key); + player.getPersistentData().remove(net.minecraft.world.entity.player.Player.PERSISTED_NBT_TAG); + player.getInventory().clearContent(); + player.resetRecipes(List.of(recipe)); + RecipeDiscovery.discover(player); + helper.assertTrue(player.getRecipeBook().contains(recipe),"Earned old furnace advancement restores current recipe without ingredients"); + server.getPlayerList().remove(player); + helper.succeed(); + } + + @GameTest(template = "empty", timeoutTicks = 100) + public static void auditedMiningLevelsApplyToOresAndTools(GameTestHelper helper) { + helper.assertTrue(item("galvanizedsteel_pickaxe").isCorrectToolForDrops(Blocks.DIAMOND_ORE.defaultBlockState()), "Galvanized steel must meet iron tier"); + helper.assertTrue(!item("aluminum_pickaxe").isCorrectToolForDrops(Blocks.DIAMOND_ORE.defaultBlockState()), "Soft aluminum must not meet iron tier"); + var ore = BuiltInRegistries.BLOCK.get(id("chromium_ore")).defaultBlockState(); + var block = BuiltInRegistries.BLOCK.get(id("chromium_block")).defaultBlockState(); + helper.assertTrue(new ItemStack(Items.STONE_PICKAXE).isCorrectToolForDrops(ore), "Chromium ore needs stone, independently of solid metal"); + helper.assertTrue(!new ItemStack(Items.STONE_PICKAXE).isCorrectToolForDrops(block), "Solid chromium needs iron"); + helper.succeed(); + } +} diff --git a/src/gameTest/java/zone/moddev/mc/modernmetals/test/ServerSmoke.java b/src/gameTest/java/zone/moddev/mc/modernmetals/test/ServerSmoke.java new file mode 100644 index 00000000..093a1718 --- /dev/null +++ b/src/gameTest/java/zone/moddev/mc/modernmetals/test/ServerSmoke.java @@ -0,0 +1,79 @@ +package zone.moddev.mc.modernmetals.test; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.server.ServerStartedEvent; +import net.neoforged.fml.common.Mod; + +/** Dedicated fresh/upgrade/reopen probe, gated separately from GameTests. */ +public final class ServerSmoke { + public static void register() { + if(Boolean.getBoolean("modernmetals.serverSmoke"))NeoForge.EVENT_BUS.addListener(ServerSmoke::started); + } + private static void started(ServerStartedEvent event) { + var server=event.getServer(); + var level=server.overworld(); + try { + String source=zone.moddev.mc.modernmetals.ModernMetals.class.getResource("ModernMetals.class").toString(); + if(Boolean.getBoolean("modernmetals.expectedPackaged")&&!source.contains(".jar"))throw new AssertionError("Product loaded from classes, not candidate jar: "+source); + Path marker=Path.of("smoke-first-save.txt"); + int legacyBlocks=0, legacyItems=0; + if(Files.exists(Path.of("fixture-blocks.json"))) { + var fixtures=com.google.gson.JsonParser.parseString(Files.readString(Path.of("fixture-blocks.json"))).getAsJsonArray(); + for(var entry:fixtures) { + var row=entry.getAsJsonObject(); + var at=new BlockPos(row.get("x").getAsInt(),row.get("y").getAsInt(),row.get("z").getAsInt()); + var id=ResourceLocation.parse(row.get("id").getAsString()); + if(!level.getBlockState(at).is(BuiltInRegistries.BLOCK.get(id)))throw new AssertionError("Legacy block lost: "+id+" at "+at+" now "+level.getBlockState(at)); + legacyBlocks++; + if(id.equals(ResourceLocation.withDefaultNamespace("chest"))) { + var chest=(net.minecraft.world.level.block.entity.ChestBlockEntity)level.getBlockEntity(at); + for(int slot=0;slot(net.minecraft.nbt.NbtOps.INSTANCE,old),1631,net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion()).getValue(); + var tool=ItemStack.parse(level.registryAccess(),fixed).orElseThrow(); + if(tool.getDamageValue()!=7 || !tool.getHoverName().getString().equals("Mining audit hammer"))throw new AssertionError("Saved hammer components lost: "+tool); + } + var pos=new BlockPos(8,100,8); + var key=ResourceLocation.parse("modernmetals:beryllium_block"); + if(Files.exists(marker)) { + if(!level.getBlockState(pos).is(BuiltInRegistries.BLOCK.get(key)))throw new AssertionError("Saved metal block lost on reopen"); + } else { + level.setBlockAndUpdate(pos,BuiltInRegistries.BLOCK.get(key).defaultBlockState()); + Files.writeString(marker,"beryllium_block at 8,100,8\n"); + } + int ores=0; + // Generate distant chunks to cover the later-chunk path as well as the spawn region. + for(int x=64;x<67;x++)for(int z=64;z<67;z++) { + var chunk=level.getChunk(x,z); + for(var section:chunk.getSections()) { + if(section.hasOnlyAir())continue; + for(int by=0;by<16;by++)for(int bz=0;bz<16;bz++)for(int bx=0;bx<16;bx++) { + var id=BuiltInRegistries.BLOCK.getKey(section.getBlockState(bx,by,bz).getBlock()); + if(id.getNamespace().equals("modernmetals")&&id.getPath().endsWith("_ore")) { + if(id.getPath().equals("titanium_ore"))throw new AssertionError("Titanium generated while disabled"); + ores++; + } + } + } + } + if(!Files.exists(Path.of("fixture-blocks.json"))&&ores==0)throw new AssertionError("No Modern Metals ores in nine fresh chunks"); + server.saveEverything(false,true,true); + Files.writeString(Path.of("server-smoke.json"),"{\"status\":\"passed\",\"oreBlocks\":"+ores+",\"legacyBlocks\":"+legacyBlocks+",\"legacyItemStacks\":"+legacyItems+",\"savedBlock\":\"modernmetals:beryllium_block\",\"source\":\""+source.replace("\\","/")+"\"}\n"); + }catch(Throwable failure) { + try{Files.writeString(Path.of("server-smoke.json"),"{\"status\":\"failed\",\"error\":\""+failure.toString().replace("\\","/").replace("\"","'")+"\"}\n");}catch(Exception ignored){} + failure.printStackTrace(); + }finally{server.halt(false);} + } +} diff --git a/src/gameTest/resources/META-INF/neoforge.mods.toml b/src/gameTest/resources/META-INF/neoforge.mods.toml new file mode 100644 index 00000000..97594921 --- /dev/null +++ b/src/gameTest/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,13 @@ +modLoader="javafml" +loaderVersion="[3,)" +license="LGPL-2.1-only" +[[mods]] +modId="modernmetals_tests" +version="1.0" +displayName="Modern Metals test fixtures" +[[dependencies.modernmetals_tests]] +modId="modernmetals" +type="required" +versionRange="[4.0.0,)" +ordering="AFTER" +side="BOTH" diff --git a/src/gameTest/resources/data/modernmetals_tests/structure/empty.nbt b/src/gameTest/resources/data/modernmetals_tests/structure/empty.nbt new file mode 100644 index 0000000000000000000000000000000000000000..fb07071789a48a590637edb652409f59845fa354 GIT binary patch literal 111 zcmb2|=3oE;CN9%cySW++1Y9l(K2{d|Sifei?%V4d4lQ!?-1g~p=#iwZ!!hhnGT4G< zS*TeuT~Oto{N$0$drp!6I;$p|g{6KsSe@v0OY*H=W9<^x>PZ~kMfdpjFEg(SDGmsH Pczy?CwVc89BA_(@*{LpZ literal 0 HcmV?d00001 diff --git a/src/main/java/zone/moddev/mc/modernmetals/ModernMetals.java b/src/main/java/zone/moddev/mc/modernmetals/ModernMetals.java index 60d1bb5b..6a546786 100644 --- a/src/main/java/zone/moddev/mc/modernmetals/ModernMetals.java +++ b/src/main/java/zone/moddev/mc/modernmetals/ModernMetals.java @@ -14,6 +14,8 @@ import zone.moddev.mc.modernmetals.content.ModContent; import zone.moddev.mc.modernmetals.content.MoltenMetalHeat; import zone.moddev.mc.modernmetals.recipe.ContentAllowedCondition; +import zone.moddev.mc.modernmetals.recipe.ModRecipes; +import zone.moddev.mc.modernmetals.recipe.RecipeDiscovery; import zone.moddev.mc.modernmetals.trade.ModernMetalsTrades; /** @@ -34,8 +36,13 @@ public ModernMetals(IEventBus modBus, ModContainer container) { container.registerConfig(ModConfig.Type.COMMON, ModernMetalsConfig.SPEC); ModContent.register(modBus); ContentAllowedCondition.register(modBus); + ModRecipes.register(modBus); NeoForge.EVENT_BUS.addListener(MoltenMetalHeat::onEntityTick); NeoForge.EVENT_BUS.addListener(ModernMetalsTrades::onVillagerTrades); + NeoForge.EVENT_BUS.addListener(RecipeDiscovery::login); + NeoForge.EVENT_BUS.addListener(RecipeDiscovery::reload); + NeoForge.EVENT_BUS.addListener(RecipeDiscovery::tick); + NeoForge.EVENT_BUS.addListener(RecipeDiscovery::earned); } } diff --git a/src/main/java/zone/moddev/mc/modernmetals/ModernMetalsClient.java b/src/main/java/zone/moddev/mc/modernmetals/ModernMetalsClient.java index 0ca5bf72..ff9b0e88 100644 --- a/src/main/java/zone/moddev/mc/modernmetals/ModernMetalsClient.java +++ b/src/main/java/zone/moddev/mc/modernmetals/ModernMetalsClient.java @@ -2,9 +2,20 @@ import net.neoforged.api.distmarker.Dist; import net.neoforged.fml.ModContainer; +import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.fml.ModList; import net.neoforged.neoforge.client.gui.ConfigurationScreen; import net.neoforged.neoforge.client.gui.IConfigScreenFactory; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; +import net.neoforged.neoforge.client.event.EntityRenderersEvent; +import net.minecraft.client.renderer.entity.ArrowRenderer; +import zone.moddev.mc.modernmetals.content.LegacyProjectile; +import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; +import zone.moddev.mc.modernmetals.content.CompatibilityContent; +import zone.moddev.mc.modernmetals.content.ModContent; +import zone.moddev.mc.orespawn.api.client.WorldSettingsExtensionRegistry; /** * Client-only entry point. MMDLib's runtime client installs projectile renderers, @@ -12,7 +23,26 @@ */ @Mod(value = ModernMetals.MOD_ID, dist = Dist.CLIENT) public final class ModernMetalsClient { - public ModernMetalsClient(ModContainer container) { + public ModernMetalsClient(IEventBus bus, ModContainer container) { container.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new); + WorldSettingsExtensionRegistry.registerConfigScreen(ModernMetals.MOD_ID, + parent -> new ConfigurationScreen(container, parent)); + bus.addListener((EntityRenderersEvent.RegisterRenderers event) -> { + for (var type : java.util.List.of(CompatibilityContent.OLD_ARROW, CompatibilityContent.OLD_BOLT)) { + event.registerEntityRenderer(type.get(), context -> new ArrowRenderer(context) { + @Override public ResourceLocation getTextureLocation(LegacyProjectile entity) { + return ResourceLocation.withDefaultNamespace("textures/entity/projectiles/arrow.png"); + } + }); + } + }); + bus.addListener((BuildCreativeModeTabContentsEvent event) -> { + if (event.getTabKey().location().equals(ResourceLocation.fromNamespaceAndPath(ModernMetals.MOD_ID, "materials")) + && !ModList.get().isLoaded("basemetals")) event.accept(CompatibilityContent.COAL_POWDER.get()); + }); + bus.addListener((RegisterColorHandlersEvent.Block event) -> CompatibilityContent.legacyOres().forEach((name,block) -> + event.register((state, world, pos, layer) -> ModContent.materials().get(name).properties().color(), block.get()))); + bus.addListener((RegisterColorHandlersEvent.Item event) -> CompatibilityContent.legacyOres().forEach((name,block) -> + event.register((stack, layer) -> ModContent.materials().get(name).properties().color(), block.get().asItem()))); } } diff --git a/src/main/java/zone/moddev/mc/modernmetals/config/ModernMetalsConfig.java b/src/main/java/zone/moddev/mc/modernmetals/config/ModernMetalsConfig.java index 3dc91b52..9f7e7237 100644 --- a/src/main/java/zone/moddev/mc/modernmetals/config/ModernMetalsConfig.java +++ b/src/main/java/zone/moddev/mc/modernmetals/config/ModernMetalsConfig.java @@ -20,15 +20,18 @@ public final class ModernMetalsConfig { static { ModConfigSpec.Builder builder = new ModConfigSpec.Builder(); CONTENT_MODE = builder + .translation("modernmetals.configuration.contentMode") .comment("HIGH_FANTASY keeps every recipe.", "LOW_FANTASY restricts implausible equipment and structures. Existing items remain usable.", "When Base Metals is installed, its Fantasy Level is used instead.") .worldRestart() .defineEnum("contentMode", ContentMode.HIGH_FANTASY); VILLAGER_TRADES = builder + .translation("modernmetals.configuration.villagerTrades") .comment("Let blacksmiths trade Modern Metals ingots and equipment.") .define("villagerTrades", true); MOLTEN_METAL_BURNS = builder + .translation("modernmetals.configuration.moltenMetalBurns") .comment("Molten metal sets creatures alight and burns them, as lava does.") .define("moltenMetalBurns", true); SPEC = builder.build(); diff --git a/src/main/java/zone/moddev/mc/modernmetals/content/CompatibilityContent.java b/src/main/java/zone/moddev/mc/modernmetals/content/CompatibilityContent.java new file mode 100644 index 00000000..a7075095 --- /dev/null +++ b/src/main/java/zone/moddev/mc/modernmetals/content/CompatibilityContent.java @@ -0,0 +1,68 @@ +package zone.moddev.mc.modernmetals.content; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.function.Supplier; + +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredRegister; +import zone.moddev.mc.modernmetals.ModernMetals; + +/** Content retained for older saves, plus the standalone coal-dust fallback. */ +public final class CompatibilityContent { + private static final DeferredRegister ITEMS = DeferredRegister.create(Registries.ITEM, ModernMetals.MOD_ID); + private static final DeferredRegister BLOCKS = DeferredRegister.create(Registries.BLOCK, ModernMetals.MOD_ID); + private static final DeferredRegister FLUIDS = DeferredRegister.create(Registries.FLUID, ModernMetals.MOD_ID); + private static final DeferredRegister> ENTITIES = DeferredRegister.create(Registries.ENTITY_TYPE, ModernMetals.MOD_ID); + public static final Supplier> OLD_ARROW = projectile("custom_arrow"); + public static final Supplier> OLD_BOLT = projectile("custom_bolt"); + public static final Supplier COAL_POWDER = ITEMS.register("coal_powder", () -> new Item(new Item.Properties())); + private static final Map> LEGACY_ORES = new LinkedHashMap<>(); + private CompatibilityContent() {} + + static void register(IEventBus bus) { + // Attach after the material registrar so alias targets register first. + BLOCKS.register(bus); + ITEMS.register(bus); + FLUIDS.register(bus); + ENTITIES.register(bus); + } + + static void queue() { + for (String name : ModContent.materials().keySet()) { + ResourceLocation molten = id(name + "_molten"); + BLOCKS.addAlias(id(name), molten); + FLUIDS.addAlias(id(name), molten); + FLUIDS.addAlias(id("flowing_" + name), id("flowing_" + name + "_molten")); + ITEMS.addAlias(id(name + "_bucket"), id(name + "_molten_bucket")); + // These old fluid block items are hidden, but still preserve saved stacks. + ITEMS.register(name, () -> new BlockItem(ModContent.registrar().blocks().get(molten).get(), new Item.Properties())); + } + for (String name : new String[] {"galvanizedsteel", "nichrome", "stainlesssteel"}) { + var material = ModContent.materials().get(name).properties(); + Supplier block = BLOCKS.register(name + "_ore", () -> new Block(BlockBehaviour.Properties.of() + .strength((float) (material.hardness() * 0.5), (float) (material.strength() * 2.5)) + .sound(SoundType.STONE).requiresCorrectToolForDrops())); + LEGACY_ORES.put(name, block); + ITEMS.register(name + "_ore", () -> new BlockItem(block.get(), new Item.Properties())); + } + } + + public static Map> legacyOres() { return Collections.unmodifiableMap(LEGACY_ORES); } + private static Supplier> projectile(String name) { + return ENTITIES.register(name, () -> EntityType.Builder.of(LegacyProjectile::new, MobCategory.MISC) + .sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20).build(id(name).toString())); + } + private static ResourceLocation id(String name) { return ResourceLocation.fromNamespaceAndPath(ModernMetals.MOD_ID, name); } +} diff --git a/src/main/java/zone/moddev/mc/modernmetals/content/LegacyProjectile.java b/src/main/java/zone/moddev/mc/modernmetals/content/LegacyProjectile.java new file mode 100644 index 00000000..4c37903f --- /dev/null +++ b/src/main/java/zone/moddev/mc/modernmetals/content/LegacyProjectile.java @@ -0,0 +1,31 @@ +package zone.moddev.mc.modernmetals.content; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.util.datafix.DataFixers; +import net.minecraft.util.datafix.fixes.References; +import net.minecraft.nbt.NbtOps; +import net.minecraft.SharedConstants; +import com.mojang.serialization.Dynamic; + +/** Retains the generic arrow/bolt IDs and their saved 1.13 ammunition. */ +public final class LegacyProjectile extends AbstractArrow { + public LegacyProjectile(EntityType type, Level level) { super(type, level); } + + @Override protected ItemStack getDefaultPickupItem() { return ItemStack.EMPTY; } + + @Override public void readAdditionalSaveData(CompoundTag tag) { + super.readAdditionalSaveData(tag); + if (tag.contains("Ammunition", 10) && !tag.contains("item", 10)) { + // Vanilla's entity fixer does not know our custom nested item field. + var converted = (CompoundTag) DataFixers.getDataFixer().update(References.ITEM_STACK, + new Dynamic<>(NbtOps.INSTANCE, tag.getCompound("Ammunition")), 1631, + SharedConstants.getCurrentVersion().getDataVersion().getVersion()).getValue(); + setPickupItemStack(ItemStack.parse(registryAccess(), converted).orElseThrow( + () -> new IllegalStateException("Could not preserve legacy Modern Metals ammunition: " + converted))); + } + } +} diff --git a/src/main/java/zone/moddev/mc/modernmetals/content/ModContent.java b/src/main/java/zone/moddev/mc/modernmetals/content/ModContent.java index c49a60c2..527094b3 100644 --- a/src/main/java/zone/moddev/mc/modernmetals/content/ModContent.java +++ b/src/main/java/zone/moddev/mc/modernmetals/content/ModContent.java @@ -33,6 +33,7 @@ private ModContent() {} public static void register(IEventBus bus) { registrar = new RuntimeContentRegistrar(ModernMetals.MOD_ID, MaterialExtensions.GLOBAL, bus); + CompatibilityContent.register(bus); // MMDLib loads definitions in deferred construction work; registries open after that. bus.addListener(NewRegistryEvent.class, event -> queueMaterials()); } @@ -47,6 +48,7 @@ private static void queueMaterials() { if (MATERIALS.isEmpty()) { throw new IllegalStateException("MMDLib did not load any Modern Metals material definitions"); } + CompatibilityContent.queue(); } public static RuntimeContentRegistrar registrar() { diff --git a/src/main/java/zone/moddev/mc/modernmetals/migration/LegacyChunkStates.java b/src/main/java/zone/moddev/mc/modernmetals/migration/LegacyChunkStates.java new file mode 100644 index 00000000..0c3b4050 --- /dev/null +++ b/src/main/java/zone/moddev/mc/modernmetals/migration/LegacyChunkStates.java @@ -0,0 +1,24 @@ +package zone.moddev.mc.modernmetals.migration; + +import net.minecraft.nbt.CompoundTag; + +/** Converts the mod's pre-1.16 wall properties before palette decoding. */ +public final class LegacyChunkStates { + private LegacyChunkStates() {} + + public static void prepare(CompoundTag chunk) { + for (var section : chunk.getList("sections", 10)) { + for (var entry : ((CompoundTag) section).getCompound("block_states").getList("palette", 10)) { + var state = (CompoundTag) entry; + String name = state.getString("Name"); + if (!name.startsWith("modernmetals:") || !name.endsWith("_wall")) continue; + var properties = state.getCompound("Properties"); + for (String side : new String[] {"north", "east", "south", "west"}) { + String value = properties.getString(side); + if (value.equals("true")) properties.putString(side, "low"); + else if (value.equals("false")) properties.putString(side, "none"); + } + } + } + } +} diff --git a/src/main/java/zone/moddev/mc/modernmetals/mixin/ChunkSerializerMixin.java b/src/main/java/zone/moddev/mc/modernmetals/mixin/ChunkSerializerMixin.java new file mode 100644 index 00000000..2f02e82a --- /dev/null +++ b/src/main/java/zone/moddev/mc/modernmetals/mixin/ChunkSerializerMixin.java @@ -0,0 +1,24 @@ +package zone.moddev.mc.modernmetals.mixin; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.ai.village.poi.PoiManager; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.chunk.ProtoChunk; +import net.minecraft.world.level.chunk.storage.ChunkSerializer; +import net.minecraft.world.level.chunk.storage.RegionStorageInfo; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import zone.moddev.mc.modernmetals.migration.LegacyChunkStates; + +/** ChunkDataEvent.Load runs after palette decoding, when these properties are already lost. */ +@Mixin(ChunkSerializer.class) +abstract class ChunkSerializerMixin { + @Inject(method = "read", at = @At("HEAD")) + private static void modernmetals$oldWallProperties(ServerLevel level, PoiManager poi, RegionStorageInfo storage, + ChunkPos pos, CompoundTag tag, CallbackInfoReturnable callback) { + LegacyChunkStates.prepare(tag); + } +} diff --git a/src/main/java/zone/moddev/mc/modernmetals/recipe/ModRecipes.java b/src/main/java/zone/moddev/mc/modernmetals/recipe/ModRecipes.java new file mode 100644 index 00000000..26c2f1b2 --- /dev/null +++ b/src/main/java/zone/moddev/mc/modernmetals/recipe/ModRecipes.java @@ -0,0 +1,18 @@ +package zone.moddev.mc.modernmetals.recipe; + +import net.minecraft.core.registries.Registries; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; +import zone.moddev.mc.modernmetals.ModernMetals; + +/** Dynamic recipes owned by Modern Metals; crushing remains in MMDLib. */ +public final class ModRecipes { + private static final DeferredRegister> SERIALIZERS = + DeferredRegister.create(Registries.RECIPE_SERIALIZER, ModernMetals.MOD_ID); + public static final DeferredHolder, PlateRepairRecipe.Serializer> PLATE_REPAIR_SERIALIZER = + SERIALIZERS.register("plate_repair", PlateRepairRecipe.Serializer::new); + private ModRecipes() {} + public static void register(IEventBus bus) { SERIALIZERS.register(bus); } +} diff --git a/src/main/java/zone/moddev/mc/modernmetals/recipe/PlateRepairRecipe.java b/src/main/java/zone/moddev/mc/modernmetals/recipe/PlateRepairRecipe.java new file mode 100644 index 00000000..1cbf6787 --- /dev/null +++ b/src/main/java/zone/moddev/mc/modernmetals/recipe/PlateRepairRecipe.java @@ -0,0 +1,102 @@ +package zone.moddev.mc.modernmetals.recipe; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; + +/** + * A matching plate fully repairs one damaged armor piece or shield without changing its item data. + */ +public final class PlateRepairRecipe extends CustomRecipe { + private final Item target; + private final Ingredient plate; + + public PlateRepairRecipe(Item target, Ingredient plate) { + super(net.minecraft.world.item.crafting.CraftingBookCategory.MISC); + this.target = target; + this.plate = plate; + } + + @Override + public boolean matches(CraftingInput container, Level level) { + if (!zone.moddev.mc.modernmetals.config.ContentPolicy.active().allows(BuiltInRegistries.ITEM.getKey(target))) return false; + ItemStack foundTarget = ItemStack.EMPTY; + boolean foundPlate = false; + for (int slot = 0; slot < container.size(); slot++) { + ItemStack stack = container.getItem(slot); + if (stack.isEmpty()) continue; + if (stack.is(target) && stack.isDamaged() && foundTarget.isEmpty()) { + foundTarget = stack; + } else if (plate.test(stack) && !foundPlate) { + foundPlate = true; + } else { + return false; + } + } + return !foundTarget.isEmpty() && foundPlate; + } + + @Override + public ItemStack assemble(CraftingInput container, HolderLookup.Provider registries) { + if (!matches(container, null)) return ItemStack.EMPTY; + for (int slot = 0; slot < container.size(); slot++) { + ItemStack stack = container.getItem(slot); + if (stack.is(target) && stack.isDamaged()) { + ItemStack repaired = stack.copy(); + repaired.setCount(1); + repaired.setDamageValue(0); + return repaired; + } + } + return ItemStack.EMPTY; + } + + @Override + public boolean canCraftInDimensions(int width, int height) { + return width * height >= 2; + } + + @Override + public ItemStack getResultItem(HolderLookup.Provider registries) { + return target.getDefaultInstance(); + } + + @Override + public NonNullList getIngredients() { + return NonNullList.of(Ingredient.EMPTY, Ingredient.of(target), plate); + } + + @Override + public RecipeSerializer getSerializer() { + return ModRecipes.PLATE_REPAIR_SERIALIZER.get(); + } + + public static final class Serializer implements RecipeSerializer { + private static final MapCodec CODEC = RecordCodecBuilder.mapCodec(instance -> + instance.group( + BuiltInRegistries.ITEM.byNameCodec().fieldOf("target").forGetter(recipe -> recipe.target), + Ingredient.CODEC_NONEMPTY.fieldOf("plate").forGetter(recipe -> recipe.plate) + ).apply(instance, PlateRepairRecipe::new)); + private static final StreamCodec STREAM_CODEC = + StreamCodec.composite( + ByteBufCodecs.registry(Registries.ITEM), recipe -> recipe.target, + Ingredient.CONTENTS_STREAM_CODEC, recipe -> recipe.plate, + PlateRepairRecipe::new); + + @Override public MapCodec codec() { return CODEC; } + @Override public StreamCodec streamCodec() { return STREAM_CODEC; } + } +} diff --git a/src/main/java/zone/moddev/mc/modernmetals/recipe/RecipeDiscovery.java b/src/main/java/zone/moddev/mc/modernmetals/recipe/RecipeDiscovery.java new file mode 100644 index 00000000..3b1c2d19 --- /dev/null +++ b/src/main/java/zone/moddev/mc/modernmetals/recipe/RecipeDiscovery.java @@ -0,0 +1,92 @@ +package zone.moddev.mc.modernmetals.recipe; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.event.AddReloadListenerEvent; +import net.neoforged.neoforge.event.entity.player.PlayerEvent; +import net.neoforged.neoforge.event.entity.player.AdvancementEvent; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.player.Player; +import net.neoforged.neoforge.event.tick.ServerTickEvent; +import zone.moddev.mc.modernmetals.ModernMetals; + +/** Rechecks held ingredients and retains earned recipes across data/Fantasy reloads. */ +public final class RecipeDiscovery { + private static volatile boolean reloadPending; + private RecipeDiscovery() {} + + public static void earned(AdvancementEvent.AdvancementProgressEvent event) { + if (!(event.getEntity() instanceof ServerPlayer player)) return; + // NeoForge only fires EarnEvent for advancements with a display; recipe unlocks have none. + if (event.getProgressType() != AdvancementEvent.AdvancementProgressEvent.ProgressType.GRANT + || !event.getAdvancementProgress().isDone()) return; + var history = history(player); + for (var recipe : event.getAdvancement().value().rewards().recipes()) { + if (ModernMetals.MOD_ID.equals(recipe.getNamespace())) history.putBoolean(recipe.toString(), true); + } + } + + private static CompoundTag history(ServerPlayer player) { + var data = player.getPersistentData(); + if (!data.contains(Player.PERSISTED_NBT_TAG, 10)) data.put(Player.PERSISTED_NBT_TAG, new CompoundTag()); + var persisted = data.getCompound(Player.PERSISTED_NBT_TAG); + if (!persisted.contains("ModernMetalsRecipes", 10)) persisted.put("ModernMetalsRecipes", new CompoundTag()); + return persisted.getCompound("ModernMetalsRecipes"); + } + + public static void login(PlayerEvent.PlayerLoggedInEvent event) { + if (event.getEntity() instanceof ServerPlayer player) player.server.execute(() -> discover(player)); + } + + public static void reload(AddReloadListenerEvent event) { + event.addListener((barrier, resources, prepareProfiler, applyProfiler, prepareExecutor, applyExecutor) -> + CompletableFuture.completedFuture(null).thenCompose(barrier::wait) + .thenRunAsync(() -> reloadPending = true, applyExecutor)); + } + + public static void tick(ServerTickEvent.Post event) { + if (!reloadPending) return; + reloadPending = false; + event.getServer().getPlayerList().getPlayers().forEach(RecipeDiscovery::discover); + } + + public static void discover(ServerPlayer player) { + var earned = history(player); + // A single-item predicate checks the changed stack, not the whole inventory. + // Replaying EMPTY therefore misses dust already held on login or reload. + for (int slot = 0; slot < player.getInventory().getContainerSize(); slot++) { + ItemStack stack = player.getInventory().getItem(slot); + if (!stack.isEmpty()) CriteriaTriggers.INVENTORY_CHANGED.trigger(player, player.getInventory(), stack); + } + for (var recipe : player.server.getRecipeManager().getRecipes()) { + if (!ModernMetals.MOD_ID.equals(recipe.id().getNamespace()) || recipe.value().isSpecial()) continue; + if (player.getRecipeBook().contains(recipe)) earned.putBoolean(recipe.id().toString(), true); + if (earned.getBoolean(recipe.id().toString())) { + player.awardRecipes(List.of(recipe)); + continue; + } + for (String path : discoveryPaths(recipe.id().getPath())) { + var advancement = player.server.getAdvancements().get(ResourceLocation.fromNamespaceAndPath(ModernMetals.MOD_ID, path)); + if (advancement != null && player.getAdvancements().getOrStartProgress(advancement).isDone()) { + player.awardRecipes(List.of(recipe)); + earned.putBoolean(recipe.id().toString(), true); + break; + } + } + } + } + + private static List discoveryPaths(String recipe) { + String regular = "recipes/" + recipe; + for (String form : List.of("ore", "powder", "blend", "smallpowder", "smallblend")) { + String suffix = "_" + form + "_smelting"; + if (recipe.endsWith(suffix)) return List.of(regular, + "recipes/smelting/" + recipe.substring(0, recipe.length() - suffix.length()) + "_" + form); + } + return List.of(regular); + } +} diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index daf72132..fff11950 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -3,6 +3,9 @@ loaderVersion="${loader_version_range}" license="${mod_license}" issueTrackerURL="${issue_url}" +[[mixins]] +config="modernmetals.mixins.json" + [[mods]] modId="${mod_id}" version="${mod_version}" diff --git a/src/main/resources/assets/modernmetals/models/block/aluminum_ore.json b/src/main/resources/assets/modernmetals/models/block/aluminum_ore.json index 9883c7c6..e9438cb7 100644 --- a/src/main/resources/assets/modernmetals/models/block/aluminum_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/aluminum_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/beryllium_ore.json b/src/main/resources/assets/modernmetals/models/block/beryllium_ore.json index 95cf7a08..31f2c98d 100644 --- a/src/main/resources/assets/modernmetals/models/block/beryllium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/beryllium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/boron_ore.json b/src/main/resources/assets/modernmetals/models/block/boron_ore.json index 3fb7a6bf..ce16e239 100644 --- a/src/main/resources/assets/modernmetals/models/block/boron_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/boron_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/cadmium_ore.json b/src/main/resources/assets/modernmetals/models/block/cadmium_ore.json index 81725f16..64543b0f 100644 --- a/src/main/resources/assets/modernmetals/models/block/cadmium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/cadmium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/chromium_ore.json b/src/main/resources/assets/modernmetals/models/block/chromium_ore.json index 77bb4005..3958a298 100644 --- a/src/main/resources/assets/modernmetals/models/block/chromium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/chromium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/iridium_ore.json b/src/main/resources/assets/modernmetals/models/block/iridium_ore.json index bdab76ea..2152bf19 100644 --- a/src/main/resources/assets/modernmetals/models/block/iridium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/iridium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/magnesium_ore.json b/src/main/resources/assets/modernmetals/models/block/magnesium_ore.json index 9d150b8c..d53faef3 100644 --- a/src/main/resources/assets/modernmetals/models/block/magnesium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/magnesium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/manganese_ore.json b/src/main/resources/assets/modernmetals/models/block/manganese_ore.json index 905809c0..fe411965 100644 --- a/src/main/resources/assets/modernmetals/models/block/manganese_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/manganese_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/osmium_ore.json b/src/main/resources/assets/modernmetals/models/block/osmium_ore.json index 3b8d2a80..3ddbb5e1 100644 --- a/src/main/resources/assets/modernmetals/models/block/osmium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/osmium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/plutonium_ore.json b/src/main/resources/assets/modernmetals/models/block/plutonium_ore.json index 719c4a23..763e8bec 100644 --- a/src/main/resources/assets/modernmetals/models/block/plutonium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/plutonium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/rutile_ore.json b/src/main/resources/assets/modernmetals/models/block/rutile_ore.json index 98e03c84..e9d374b6 100644 --- a/src/main/resources/assets/modernmetals/models/block/rutile_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/rutile_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/tantalum_ore.json b/src/main/resources/assets/modernmetals/models/block/tantalum_ore.json index fbed3814..30e0d7a6 100644 --- a/src/main/resources/assets/modernmetals/models/block/tantalum_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/tantalum_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/titanium_ore.json b/src/main/resources/assets/modernmetals/models/block/titanium_ore.json index 06c731f4..1998c0c5 100644 --- a/src/main/resources/assets/modernmetals/models/block/titanium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/titanium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/tungsten_ore.json b/src/main/resources/assets/modernmetals/models/block/tungsten_ore.json index 52826c2c..f1f685b2 100644 --- a/src/main/resources/assets/modernmetals/models/block/tungsten_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/tungsten_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/uranium_ore.json b/src/main/resources/assets/modernmetals/models/block/uranium_ore.json index 526f2924..84335ebc 100644 --- a/src/main/resources/assets/modernmetals/models/block/uranium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/uranium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/models/block/zirconium_ore.json b/src/main/resources/assets/modernmetals/models/block/zirconium_ore.json index 4a53e7c3..6375ea57 100644 --- a/src/main/resources/assets/modernmetals/models/block/zirconium_ore.json +++ b/src/main/resources/assets/modernmetals/models/block/zirconium_ore.json @@ -59,27 +59,63 @@ "faces": { "down": { "texture": "#overlay", - "cullface": "down" + "cullface": "down", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "up": { "texture": "#overlay", - "cullface": "up" + "cullface": "up", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "north": { "texture": "#overlay", - "cullface": "north" + "cullface": "north", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "south": { "texture": "#overlay", - "cullface": "south" + "cullface": "south", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "west": { "texture": "#overlay", - "cullface": "west" + "cullface": "west", + "uv": [ + 0, + 0, + 16, + 16 + ] }, "east": { "texture": "#overlay", - "cullface": "east" + "cullface": "east", + "uv": [ + 0, + 0, + 16, + 16 + ] } } } diff --git a/src/main/resources/assets/modernmetals/textures/block/aluminum_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/aluminum_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..f383a43d83da5a37a99f8775c5a760552a3ba58d GIT binary patch literal 511 zcmVez=5QV>3S4P<@Qk;wAd~SRN5(Pq$ud-6vE+PsF;17WKJ4i_U5uiG4TW)TCgx)aAu(hQa7j({%C?h~wPMBTJ zNRLnPhaIY}b1o35+Gf)*%rXWl_dGuXpxw6NakFVyt*#L-oabjOmUHq^4iJD6k$sS- z4O`pbHh{>UvYZ5hIF01u;$_d}r%}cAv}aO7qGl<39G9{ia}v((+WQ`8qNwV)?f`&E z4Ie(fr`@)pUsY39tLp%iXwI=bP3G;pH>Ag>FnXLlc3(*nO+jNasR@w+{QCVfJk<4$ zNd}AMJVYq6?->`fYN>%$HD$4!KYCDA(=fZpzUM>yaF}Jhx_XU2>;gfuUf+gGy27z! zjZ0ICm#lM+fqoeA!t8R^i&RzU9{{km4I_yc{sXnGUNsWOwkrSt002ovPDHLkV1k0O B>|X!? literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/beryllium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/beryllium_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..0bf40822feb02ac760d343891df8f298574f3925 GIT binary patch literal 446 zcmV;v0YUzWP)d296hxl`_114$7&gGpH`o9yjP$xdur~X`F~L0?_w8BI4*GLMg==4bTp^_m;!^-}gmC7{-D6SOajqUR`>7 zZ~6THxtRgP80or>${1~Ud%5{FOkF9(2~2IynGga`Ciil__#yk|oawp_RpoNN&@_$9 zH=t^M%+$x)Rm2!+@2$HHFh6FOzE7ii{`I_Zc^}n!?PnrFWo8-sIxb_ckG1a&wX?CAzM2pvrO%Ik-Ga=JofhgPXbLzL8Xxg2f~vo4nTtt=?;r z!`JY&tR)$URd{cnU9oAJ9}iMWKA0c##s^!*zAswU_q}geh1ZfTu622=3#AmE?7^ri ox0l-{Qd6O-gb@4z*_Bk4Z_Us{TBOpfLI_xE0oeB)t#w1!T9b2bj9P1qF^uC#N(t{h>h*e|wdObux~`*?!Zb}yy7!*X z=hJ$|7`*pbYsopIgb`qxCgyo&7zR>Gh`O9}BM`MQMvO5ik=yq@03n3-mAOkP^nH(W zt{G~rCB}%VwKjPG)>^#x&24~ME7LSxfTgc)w_8KYIsX&Y-$|T%T5FV;CG6+8guUy! z_U|~33#bxQas0dkT5BGU2O)&kch0eGTLV&(^I4uGv#u+{FkH+P_l2aTATepJTciN* z_xrMm#+VDq*Rm`v!dmOaxHGGi80eg1S(ZN@IOp2zwbuXMg0SE3cT!4?K<)e99?1%y zB}-hAl5D8-zvN&_Da`YHiBwd`4FGuW+eoDpego?>VD{YzDoFqU002ovPDHLkV1n#f B*CYS{ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/cadmium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/cadmium_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..bbbed597722806da7c4c525f1ef01a8e705acb37 GIT binary patch literal 495 zcmVK4pQDI3;5*hSd%DIA1ZmnImOA>;)T$a|zrks@u1yoH1jagp9;3maKl zu%?{B#I@4sP9)!Q?%Z?EoO7r1 zqw}|_sw7S^<(XzVYf)NzknDKycV^L?$3e&y2=c-(o=gFF-tSOadvv8WraXH_0UXxD zNu1L8`t5tAwC3e>qN@}DuO44}=}DaOXZyR=0~k-HY|{;aFiP`j5pfS(0a0hlvnLR> z+3`Tw>vJb^A4Vgnhh#WA9@wTEoV7fRMl4rrhJ(;600=J5(N)T;7*D1oaq8U$xH#vf z-=-0~nZ0efd>d7>ZhJ~=0x?V2n{f$yS1Et?ayqp@13?wXWd{J1)_nf*iM%krKa1vU z(~SoTBXfutZYDXm+1?;C@%-c6FuE-$O5Bmt2XzBNyt zxLmFOdoYXUzHxD`<%5*4zgt9H>$AKt1kd}Oza%T%lq_*cO3fuR<(WJAFwR<@7Evow lQQ@p5tW8eh)IZ5t%RkvpNjUa?N%jB$002ovPDHLkV1ko)H^u1eP-Ur4pu=@P`dv2PV zVK_1$?*m$=k;GaX&y?kk>+5e!(+So04r2@eUDu&?8rii@8HQt26v8|&n5Gj=Q?q(} z{C(Cs#W_ckqyTKU+i1OMYF=LcEHD6L3~hTriK2k}{VnUYVwz5fyJ0v+0dZ@sCCfHk ziQS?o0O)%cFI#JA+XLSJ$E&I$&x_~)K#gM{NxobdV`!Q>rVTKTAzHs|L*3kbU!;6l z)qE~7ty7eQCF=9KL_JB;_{}-DAXUODiOUWEXr1!#@Qc285iiRfZF`7BN_w8#lV4 zK}OW??tU;$r&y`#x-K4)6`os`x}>G~k`2R=EBRr(5A651i%P|X_kk?i0MImbe3JKp Ye?LA}fpodky8r+H07*qoM6N<$f=$!mK>z>% literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/iridium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/iridium_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..231e4364b2fcad7864968627ca79fff7ace81782 GIT binary patch literal 498 zcmVBjU6oo$p1-hBXn=}X+DFjh4lx`(c1zv(zgCX=E^q=%Ebn2MBlc_qHZXsYuM2Lii z22T&+sUaTJL3-Dcnz!D2&pr2?^PFElzcf5y~ktpp^`3h7DaS8yH!FF4KXV*`+91$XxkXsrbO@?!cn;4A?k z-=;XXKfX0uE1sTrXf*-gRCRfBzZO0HQb~U2kyhMj4zXz&qdtjys|_q^$O` zAc{jQ0yz|-?i0JWOn=2<}$BZ}KW0Ie0vFJD{m zuAa=VNY@(ya?5JprS3$}I+I-Aw2q7z2EHdtTuam1WT~D+%Lb7*4M#4`CPN>HYc5>?%n-^G)aVel&xK-@SH+cR(sC0R?-;F ol0nie3u9^m-;)nyPco+FAHO9-458OFng9R*07*qoM6N<$f}>#KdH?_b literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/magnesium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/magnesium_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..faefce86077ea8030ad210b3c8e390c52c57a67d GIT binary patch literal 478 zcmV<40U`d0P)B*M6okJETg0!ih_M!{J7Q213seVO9688;xGKLmuvTM8xXxkMIINnLySu`EiouFrh7bbAdylnC01k%_L?p9|2r>3qQADn;EFlD(>oBjc4iVvW`eZh{ zC8b1Ft+I9JI^N%ZXRIjZIM-qAk{El8Dgsp1il%v>EK5QNsJj^ZETC?^KT;HPjM`l+ z?yi8(U!6Op#A0zrU9WSX)-Lh>h#7`+wg+JC66d;{Ho!2PsjAh4SaEZI|2?zC*#A@2 z*Cxi8h+s4a*Ex{&zZkPDqWiYU1M^5D}iAe_m(4;B~!bzkka_MtdIH(`L5Y zN6NDN67D5^70E4VO(K#j1=#I&lT9p&`9$QVZJS)-Fq|jBjaBt%fOWm5ZJSF5I+wcn z-&;`ir>7r;5VC+d96s_TUE#51txH?d4ORR`A52P#rg@lDsxI^m065p>ky1+h1(2^} U^GDw6Jpcdz07*qoM6N<$g2*`C1poj5 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/manganese_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/manganese_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..be4f5c656bc2d2a2c046999a61be7edc2c3e8866 GIT binary patch literal 496 zcmVV zj{WH%KyF!Aed>xp=vimhAKv$l%ov7#AWK|J)7oUIifF&5r-gnnS>kkg-Hj<(5cvl) z@$8Aa&9-Nd6?vcSk!WKb?32&+ZrSH#u++VOe2^xI@QAXtOTse>Sy@+Hc}h!TvRY1( mW?3|*CG-RNK=!1@wEP7|;X-_hXJ)DZ0000~p-?NXOKK~l}4uI8WOI7RvXq%du>){7W=8FYoo=>o$?>G(} z=H~W}EKO*en)_Xb93hoc6?@vI1|W=L;#X^`LxCyt96wkBP&__h*^aVXwnN+0s%Y5` zGuLCjSWq1bvNXYb|M~^XcBr39&aKnW!R3`&&(egSKX!`ET#qbG@Pj37Q)5ICAh^6D zUSH#11XPCtao0Ar3W(dP*fVoIjM(*_&jBd&T%R)c(4X)yiZxI_SW*>x%yH<{9)KS# z$3M8Vnz^~X!@me7;Y#`ZAYw literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/plutonium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/plutonium_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..aa009c6f5f463a932261eb8a28ca481e3c092c0a GIT binary patch literal 509 zcmVO{&}>NLsmU9P$K}|ym)V{$63PP-S1Wn!0!j#ukTQzD8-xc zgsUMecOdRohtvr8{Q!VPIm7LGD6u>4T?2I!oS+G?aqpVYjto%YqV{^jK#hzGpMW?^ z3~hkD-WcoWX{ZmwPc6#lQ8mwb%~B3ZU_pRSJ1$WlsFC@WRgbNqs-AixE;|5VDTi-w zzmje%QxENk`}Lg}q$KA>=^1;H%$HZUTn#Z$oAgD*q#!X_%4y~O=ijMO*1IWk5xG+n z;a+cA;F_v(1Yl@KMDDa^5ZV!}F)Q5U&}?+O9@BRdmb;UHnm;|5OR~aE%MzEYuWYE) zFXV?Qbk5Cq@*HV>SzHu4$L-dT<18^xDs;|&_XkzVXuWos00000NkvXXu0mjfKnCyk literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/rutile_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/rutile_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..b8f55b5c6dc6a711ee6ac0262a6021051b7e8697 GIT binary patch literal 508 zcmVl^^f`HXd00$}TgU^rkLhD4_!#is0G zt#fSMj=k#VkEb-tv2{atwa(!iqa^FH)IEzNW;T6`tt?)#DH(?$0IT92-xy{0jltH9 zDhgqA8e%I;n&o)E{#@f5!`;IphvtCRIVRCat*2Se-~TJcg5iKP%Nd6uwr=o55nvLH zxHz8@oCMg)BJOP6sDQX#mnFe)fG2j(j*kE+Hl=>$-mP<-9UrksVhvPs@wRTK_5jA= zi)~38VC!~FqEU}naPQrlNiXHsRdv^E%r^#4!V>jvU7~(y4)ovM!()%s6IMxFW&pr9 zhA*ElDK@3zizMdv&8-r7(sS3IG;{UgJ;6!P3s=$?5p6+g@{Q3-0j~3ZdQir@E3&_w z&$Pm=+x3F$s>+f87fH-=K6}Yvk;HIwt0Uaap?feG4!HXC5nEXm@K(jWZjur1T9&$` yC7Dpc_vOK~&T(-*?Nur+i}$~2w;0000P)4z^5QRURt+i*|Y!gXW$)yQIXd9zWQW*lqe;_1(Ct&hdl61>84hn>nR&}~_ku9R= zcK?7~h#Bs@&B48$d2imEJ^T9Q{<%vDfX!-6y{`d?G2)z~oR&<+6PmUeU|mY&oH+ac z_uq4<0x?GVr%Q>#T5VGAYrW$ap6mHrj`4tL+J}@0 zVvI^4YU_QCa}FbN$8W{}G;O0_nY&9T+%LQuD!!PUlga}qrzN2Z>NY^mr?L8t1vm3| z^MT8+qw1g6SYa(j%o6r~T*5vYS^d{OwS%Tcx{Bkn0|14!eE#@}rfn4W3(v#P2W?~| z=e|5i=I-{63wJp%SKJp8O+jKRtkp;X{%n71p{#eGSONkfEuwbpRLiRua0000D?K literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/thorium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/thorium_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb55c430599238bbdb7ae9aa3de1f663e83f410 GIT binary patch literal 455 zcmV;&0XY7NP) zL2KhM5QV=MVS!bORfmNJ9|GRcQz5X+wujPN|NpsYeKRQ(D+-}9$d~RRjIgtF@nOt+ zPw$(nm$$d?DJ1|lZObtP0LB<8jiIuZdbPq2!(un3#FP^1akry$jxk2|eUFTY${a&r zj1ho!)9~}*f#5yL4+E98=bsJ-3aztxp*3TS*|E@?(irO1ir_t+b6ov-ef=)9=IeB# z&>Dd1?k-2~oa6K3W3dCMtYzQ#C~=f!yWL{zn&3T>Zj3P-O_K|)tmPQOSzwXES~}-)+ft}Rzoeml+}~%lF~JtaGuALP9AqVY+WzPmG;FXQxHs-y#Kzx zFD|h(W?^!@Y1@oY#AN2KGE(5WY1p*wxdVCET;P&`xc`2BCU~C>)bVi0KgkKtBMSwg xBo`|CYe6)nM7!NCkj~ST#sJVcm!CAH#6Qk@Tfqzw#o_<}002ovPDHLkV1jc^+%y0H literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/block/titanium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/titanium_raw_block.png new file mode 100644 index 0000000000000000000000000000000000000000..94466ef60506db86e2209b6d5a4f81612bab126e GIT binary patch literal 485 zcmVgY;b!A2jLR9pO7L&{&7H3V>pvk$L$IqVvF4}Da>r7 zB-02q%X@F$n|b%;>$hJiMgZEwk z2`K@U8oeWg34mt1quuWry+=9csA>yXb7|A&U;GE<8 z`DanRP|4R<0l)^mEmqBjU6otQr7hy>9L{g){k#KM^WD2OD&_KY8*DUGKp;P}!*Z!w21%XNf4Rj3+GLkh2 z)ke<_2zh9Sa$lvkcM<5oIp>{o@3Z$GqMxR20hrBwvV{SlDjSC0fMBfggA?*>)x%8P zvfb=ZH@D{`aY|J-+~1YR2&qiAFjQp&Kp1&kzIs8iT%+=AMKIO?JU$q->sWT}I#gw2 z6}9Uy^al9B3B__v5~rw7A9J+pP~=Y>9_?f5mdR9G>q(sQ?duPV4ZQ(LoDz&RRoS3K z5nwXaTwR|rIz6UXt`T=t*;oN_n=K4OZ-5fJBmV$^JX_hXyxY_*BmaOf@@$~NSd%Rb zYP;E4djP>$lfz_rdvnRs_8Nm_#h^V&zP5+( z#BN(%7IwtUXy(0FpT2zloni!Fv08F)4uB9kiekjXTI{98?cD%NF_O{=wZ2``Y_^2Z z(LT1w5mGq^=Ln$#pq|xS&9Cs@qukyxu@->c(++J+X4l3LLYEb_F%-oJduj3B(`>e= z?_a;6jp6uwMC)@>j8xMqTW>a7e*XBCv7#8!Y_?3SC4>$oiU8HLVt#W?S(bS35qBYU zSwP$#oTDg4D6u=f7z5z;E`R0SDMrQ@W9nI*1D#mQ!8ue)r)&>kVqa`a+5jn?sHW9` zSa9{`?d!}ILibNqe>c&`v@s|NOVs;yiMrP3`QP#RI3QKRDv9@JKpVry`#ap;WxSr% zw2y5jQqptZo;0(*T~n6jAY4gbL~;vKlQt$-3h>Z83?{KCMgx(v#cG)=OzAWTuCFRb z0<32>i`DWagL+oe(&iEV-!6#yyASX2-e&=|d)nnoGQxe!QkS$O6Ds(bEKG`#`OWp9 lQgIA(O0 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/aluminum_raw.png b/src/main/resources/assets/modernmetals/textures/item/aluminum_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..7657580c93f5b38050280c942bf46d179cae1fac GIT binary patch literal 535 zcmV+y0_gpTP)LTqT1GU0#)3Gjs&`}Y-TvhA1(M^cbT}1ytg|Q-v zZg$R@FT>O|4lFROE4%Ti<=WORWK4pA=bT@6A#5YTi=MmZf#<{X^8HeK#~BSDgwQtB3e+Zwa z372|$aq9F*?3t#xcSi;QoM>%f{eeEKCP0a+M^!}=5P|?30KR0jn*$XhnX#C+M zVy~wtllcTmlCIT!<8)$%GsY~p+l2;S16Ed6sj<@BwjHlxZ!kBTjPLKEgP19JHDC)Npv1K*>C=CA Z;~y|kuO0{2tNs80002ovPDHLkV1iK0`kVj& literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/beryllium_raw.png b/src/main/resources/assets/modernmetals/textures/item/beryllium_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..14dd96ea5cc34b540e2105ce800a85c00ba9479c GIT binary patch literal 519 zcmV+i0{H!jP)i0fje(NY&Io^V*9w!Wb)dI-O?#aQf+#4F%{0 z{hOB4006Z30K!weCPcRD5YfM)dtE|nOuCnfFKCVu_=^~ z%ZySQN|J=}v2j$ZRgy}ju=#ouH{BbEBO=ycuA_KR42Q;O9a(Jt>3rz>J_JFSFfFr5 zDUB8v7P*p9u(!X5laD9If8UVXlxbyoCE}c;WR?bApZxbW{sMA=u?4G0@lOB%002ov JPDHLkV1hxE^Nj!i literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/boron_raw.png b/src/main/resources/assets/modernmetals/textures/item/boron_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..f3db5fbe9889b8b86dab17fc023cea8d9e53f55e GIT binary patch literal 496 zcmViv1{C~53Xv_u(m#zKKpS`0A~s2HEBHD55-F@xScrv8q)Fn(#8cKesWr$5j`f*bv-zr&zMXmh{xkdrBdLW zLs1kA1_PPP$t1-Pv}4Z0000k;F literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/cadmium_raw.png b/src/main/resources/assets/modernmetals/textures/item/cadmium_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..ab158b752107a89f9bbe24281080d17d4e2b848b GIT binary patch literal 537 zcmV+!0_OdRP)DWOfn{}8{w&30GeL6%D>>UXn`re)gp3mX?eZExZYQSD3utyaI z414eF432ose*sjh<&eiGJ6kRg0HjmPG8~*#b`7|3+hcaMHUF8f_4bpZsDbV6tt$Yq z_;g+=3K$&muD5nv1OQ|WK!2aa2R(_S&f`}%Ga2;tbmOt>lyUE_PqXwOom$ziCsX*6 zGr3Fy8tYG>=434l!{EN2ZU8{_F{fy~lB7OK6%jLz`}eKv4oDzonJ>bn+@asQH~{al$Rd>5fysS(s5aKwKY>Lq4TrF z1qdN<_((OD-Yp}YTEY6-D&ntVyp_$;Tqvj%0GJtH8QfS`Lw36zZ(qmR|KL7^5ahWv zfJdPyy?pT;nx?reQ;3FV6hT7nD=meiq7rZ7OH@%=1@G`peEu$BD=ESC{sBw`9?GII z&W3`@>9bApM=l3dRS(V1Ol=4u%%*eax!%=)z?dITqLIkoH?*5FwYxh_W=3Rsvf%aU bzqj!xL_o1;oB$hK00000NkvXXu0mjf=2!JX literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/chromium_raw.png b/src/main/resources/assets/modernmetals/textures/item/chromium_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..df7031d3610e09a7961a15b845fc94ff8b28a6f0 GIT binary patch literal 512 zcmV+b0{{JqP)4xe7{;IXe_n*686t=--Ao1_1O2k;{_&_F_=ffT&E25bBi3 z{s#yJEvr@C&*yUl0NrlaHw;6%GoV~9PuAA*f9GQHHAzzF{pIEOB>=QqEomlTW24f~ zX0rf*tE*pdoNqWe`Ho~V`D!>EqEsqERn?n%y)FlOaC+K%;4wY%V|;+1;@u7v9>>69 zLI^0}|Nn=MiWZ?Lusqg2r-*{0aG{Rk(jJfPu?_rh8xDtD*R{ODsNVwP@mOMvh%w@R zzhk%C^#P;3rZ-1cD`tLFbI!pzhY$j^ y)*vE$Pkwnwo6Y7_N*Ug6H!w2}hlBc?|MCF_a)4$o(a=}`00005vUf!Nmk6$xD~A67MBSArVQ~a!W=O zIQ0-xWWp#$8PQ?$G6G*~FtwD{%lz-xB_rAvk%yk!_krgF&-eR0qNb{X&6H%5l@oBi z_tK|p-5u$F0`&D<(8~|iZ$0R2q{VYW{}aIQd!zUAxwNgi;iqnHYZIDg@UMLM*aYxk z_>qb$V97ZQt;AuRo|jiH)AQppsN-T|feWnb~(j(`0rN z`+6?wJBtbkKOJW+9%f_6WXdDp9Z+lWFolIXkWyrN;AuLp+p15Bl6Y7J$DSaiq|&;V z&xw~rqA_A`XPKCMp%P0gVsL0w%K#{)fTY@HbqIH(nb7lB%6F?DDWy2o+R0Sto)~}p z45QIdpEU)4U`&%z=oX8aJ-e(-hNeXEZY!SCUBD71QyyKNXSmrP&~wH(I5esqIqcAr z$uDd%8jA1S9a)r8rjH$Us#1Fe12=pG?mry)bw>QnGqreJX{8iie=y^6#ee_C@65`g UET))i5C8xG07*qoM6N<$g0EHkWdHyG literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/magnesium_raw.png b/src/main/resources/assets/modernmetals/textures/item/magnesium_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..c0418e260b38b7dcccb564fdc797a6182d5057f0 GIT binary patch literal 518 zcmV+h0{Q)kP)Wn@qewI=ifAitj5P#t*Fus~Gtq+3RX-4+n=Jeny7LclE4X$Mqy$7U zGme7+A)#?sE&Yq{^_?|E))C> zpo9%oH7izDo>RNshU@x5*G>M^nL#rIeCv+XiDCOG_$(AfR$t0|2yIEnu9z5 z;Ublq4W_0Z$XG0fQfUu{al-!y2vaIG8%PQ0x_K-5^xxa~6ByRBMf-kRuK)l507*qo IM6N<$f??w9OaK4? literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/manganese_raw.png b/src/main/resources/assets/modernmetals/textures/item/manganese_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..2ea2b6b3ba154721f35001b7f1d0c327b29f1e8d GIT binary patch literal 536 zcmV+z0_XjSP)?f`X%! zl%tL>#7GE2P{=02MQ_4?3$rpIcr)Oi==r^`MJU0%LBU0LcMhE2;+}h{)ak-*hGCbJ z6!5V5-fC;3-`oyhvoaqv1w>Kxc>)06?6l|#_wgMAT5jJp-JXgq?Ynk^xXt!NkH=~O zU|@8FCk3=N`WMesUHmK70R5AOsm~ftA3J{K>+%m&)_YOrbQ?GC2NcU4Xmc}ZYuYRj zHzgcEM)66wP8Gs13|U$41ppM}pNwCSZ6<-^$6Am|1FU}5PS zamKA%Xln|HoXmrmcr}bzB#O;YirtQ9o$WFfi6U$N0WhM(9n@X&2$!dVawAcxzIhGK z7)o-FV&&sBw7D6~e_6oW$qD&W*QrPC=LrA_3H*lK=RQHT4hP0RyqCfDM_`PR_f7*Q zL&G#WK88JtQe)Y|)0cys5ff>Sy*QMWjj_l(I-H$@tIfB7xIn5s1^(*|c--49lGfOx z_Ve a-}nb$l&2x;i~kb<0000LRUk4-3F(8qxO~Sw~#YUFvf6l_#83D9{ye_ zUjl%Xp5S#y81j#0J%h)QGfm_z1F`T7lCdauJDityw0F?Gsr%#&1S@q3ik7i8v+xb8 ze^%v@eh;DMyau>37Pb~ zeEae#h%vf$`z{_odO+zfpTIdEsky`t@hB%E@#gsxG`FP>u|OF>Z- zoESb2ZDv~3y~1oP!n<5OqEh(_&bU+8!X^>f-G_SR{(~-rr(fY?LVNaa53MImea8lE i2|!mvRj*H*p2jtd&$z}F=JyK#0000E7NHUxFjNF_p$Hm+8*QU|LFiUWbSa34tJDcx zs0d=x0o1y3QwmNPO|taHPw%gOx~Qg{liUZCw05 zU<_CP256{N3>y(^uzRNz7a&y%S+R6f|7XA{-}&m9K0ot$&;^1WVbRf}MQiRjz?0lv zz3vDD#_-JkwmlT{Ff#}7#4O|HLpq&XgWkqYxqRTPgpCX3x_}R*SFShdH1D&h&28Xs zZ)KCSn~Ex{q1}g>&p?N>OAB~{R!zX8baZVjGok>=W}!iYgFP)+sw`6p5P`1?A4LyRVZTVk!7zh|2>UA Y0kBlFxa~yKQLam0pRTc@&;5#+f& zT;fefn21~`oj*MQSY@nQWz4>vM@oN>F0c1;N1KNxA52m_s%|wUD3tAe*?a*%H#g<6 z-XIY2KzpoKz)R-V1RYhg(2WHI-eC+r(IIb1CY9w$?BAkaex59|jK)$btG*DGS` zAO*YqC{@2=#jZdCNb3gjmW|cwH+=Y%RNCWmVJWvPAI&7e zh|#?}H}P=l37Ma=P&glHxWrdRh7&Qd_xUtDZZ{TlU#P9sjr-$cC}gv6wJ5k64&hn) zjc9s>q;B$Hw_p7Fy#(hTv;~ziXwb5Hj^TYrE002ovPDHLkV1hTw0I2`~ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/tantalum_raw.png b/src/main/resources/assets/modernmetals/textures/item/tantalum_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..93d0d331cab12cf0a924e15f32fa9cf564f91112 GIT binary patch literal 531 zcmV+u0_^>XP)k9KHE8Pew>fzP+xB!4kCdAswrSP z9NE*S!nJ<^9F39@O;=+RK>~ohl~++CCie}{Zr!d0L*swq$%zn2DWC4{?pz0e*XdQ+ zbOe1$vqy(V003X@FUTZUk$9EBiSF*Pjt)OPc=V7WnqFxNunL7kxm*s#g3UhvQ49nE z=sDSgN~Ox-X&nI2b-YUq4_;Lb0Wadw!%-u~%uM*nfFxYFG=QqAlKt@$0H9PVkr1+R z2N6wItw&msOeJBO8Q9kEBDc$hxo7iirqb|wy&$6cB@SH~RKd_VnW;3V%?yN)=sebm zw{J}3Eeo5)O{~9P=k4tu6kjo99e|nfed`-vyc{5p$Aj#LEYCi93?T&FnYoMk**RK! zw+5%vd9C3Yjl_y1AykW}1?_EZ*vM{ByU&MvGxt%nKEv&H;pXHGEG{jorap+jG~}66 zr&YOJhQs0X$Bg)vAW=Ji_8j;3_G97s0urg@^4~SIpJy5!8mTceqDHLF`t;ww@fRN; Vu=#YP!XE$t002ovPDHLkV1f}9^?3jQ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/thorium_raw.png b/src/main/resources/assets/modernmetals/textures/item/thorium_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..8a4586f619c8ddb2cea1235e2b0e8cb35ecd7910 GIT binary patch literal 498 zcmVc$3tad1FcO~cnP#ArAK08}jt;b4IAXoOz3D_f3(`>p(B zq2KSzm&eDnRw#gTF3sy}*>+vLIX{P%&r^7JN7L!_U2KhRqrr%XSFWy*NG9QX9xW!5 zcy)RTx7mck7`AqIVOOjCK7fARLQd28Vk(7c6g}y-+wJvYQ9RD)Wm;A7*)-uc8tjjN oIIS0pLP`mzUjOa&>A$b>2Y;lw*@d{#NdN!<07*qoM6N<$f|6R{iU0rr literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/titanium_raw.png b/src/main/resources/assets/modernmetals/textures/item/titanium_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..484205be4b34faa405ae6b231a1cf0db292eb913 GIT binary patch literal 529 zcmV+s0`C2ZP)<45`1A#y=(caNPPoF&}EvEly3OIK8;97narBYFb!x0Qb&!RKf z1=khw;o~P*FRUSOq?3gQ28AbJndx@RG$f>?VsRac!VsUBgb;#^R1yGTduxk`nD-2{ zm@am9wqa#6IP4D~80-RL3RG3a^t&k;I(do?w6uVT8e2FM85FT`oqCS1{1^Lw#`RQX0*-T1l0Hl<#ZCmPBuhHpn6!m&tzMXn47Z>Jn|G^{lh5E@U zbE?&TAQT#9b_ZUV^HsxHzmKH9I4I1?cx*=sD3R zd~JuY`~6$@%JNbv5*>1TL;ce4_haV$G;&r(`6J+!NOZ`RkeD-#hSR72{*6BYSx&mJ T+a-E800000NkvXXu0mjfD~$C- literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/tungsten_raw.png b/src/main/resources/assets/modernmetals/textures/item/tungsten_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..34a38c63c4586044fe7b49a9cf3d1292243089fc GIT binary patch literal 492 zcmVzjg96{5G_R^ASf6A zsGyx9E-~9I%LSFaaEqOCU=H8RnL~+00$(W!U#yn`)oS%zsZ{R&5(qqN8iwK3YBf5a z&)9Cao@tuw(*l~N-Rt!_gb;jz-%^SFIUiY{k>2qKnMXL1V*C~ zEXzVX9!Y`*Xz~KWHJhuss;XkY-@|oX0Dxs#5JKQ^IAFP4`qSwY6fcEr=wrw*a^19tF-rnBeI1YuwVKf>I zEEWsMvW!xxgyC@Ly>!8{ET*cece~xd7>jex1rgm-sg$2gCNUTcFquq#ew?AtgejlT i-~YJu@cQ)M)A$>7p|%&wIo${V0000DT|EI_$U|X-^Zq@gFuGeb%Yy(g zGquEOMi?4(Cw-?nz|A~T$s8ijKOh>`;o8;U-`=vB?%W=rKu{~!6eJhSE%P52p?}Iq zPuFf7>FYpyryXl+Qr;Xt4PHp2ZD)gW{G=+X3c}BLV>v=-L^k~$(-9r5t}NPI&0y^cY&M3+590FRp=GjfwSkB#BOLR!h{2&A z+SlC#gRg=oiU5F@kvI~%i7$K=vDuuQnOel;(-f8Mvl>4%UH@4c6= zUoGLrEgyP34oZA3P+_HfuId@1lLjLN;(mP$&5n(DH(hU4<4=)oxd!R$SkM3f002ovPDHLkV1is@_j~{V literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/modernmetals/textures/item/zirconium_raw.png b/src/main/resources/assets/modernmetals/textures/item/zirconium_raw.png new file mode 100644 index 0000000000000000000000000000000000000000..2ed142fe22ab5bca76c3cf074da339fcc2d45997 GIT binary patch literal 519 zcmV+i0{H!jP)lp^rb17VLc(^&e6xP}|{;@gi!!?%ZV6){{WvN8oZLbJbaH%xSUkoi(^Ja#1n(g5@?J!^LThL`J^cm7IZVrhQi_Bp0050fgBYXk1a{U@ z&1Mq?zks3G5aNkAIAbsj0~?<<^w{_qg~MSGQRfcsPfe<6bDC0jQmEHzs8%X~27KW| zN{M>Cj)VOJy|=RqH|O#$1RAw!O2=!;)VAxDH}OFJHgH%DeYe{9Xj--0Hf- zZL!UXm|9z1Lw}?nr5}eBxfQ{};&bd5i!k~OWS(ZQ^<_)-yn^ouo*GH1R;vZhc|y2C z5>b2f?x;>Cli2*ciJijN5C8ViWx|wxkZx-Y2-oX)eY*BEUI23excykyfN%f+002ov JPDHLkV1m%a?>qni literal 0 HcmV?d00001 diff --git a/src/main/resources/data/modernmetals/orespawn/provider.json b/src/main/resources/data/modernmetals/orespawn/provider.json index 0d751a20..8f79d12e 100644 --- a/src/main/resources/data/modernmetals/orespawn/provider.json +++ b/src/main/resources/data/modernmetals/orespawn/provider.json @@ -1,9 +1,9 @@ { "schema_version": 3, "provider_modid": "modernmetals", - "provider_revision": 1, + "provider_revision": 2, "ores": { - "modernmetals:ore/boron": { + "modernmetals:legacy/boron_ore": { "block": "modernmetals:boron_ore", "enabled": true, "source_mod": "modernmetals", @@ -36,7 +36,7 @@ } } }, - "modernmetals:ore/thorium": { + "modernmetals:legacy/thorium_ore": { "block": "modernmetals:thorium_ore", "enabled": true, "source_mod": "modernmetals", @@ -69,7 +69,7 @@ } } }, - "modernmetals:ore/beryllium": { + "modernmetals:legacy/beryllium_ore": { "block": "modernmetals:beryllium_ore", "enabled": true, "source_mod": "modernmetals", @@ -102,7 +102,7 @@ } } }, - "modernmetals:ore/aluminum": { + "modernmetals:legacy/aluminum_ore": { "block": "modernmetals:aluminum_ore", "enabled": true, "source_mod": "modernmetals", @@ -135,7 +135,7 @@ } } }, - "modernmetals:ore/cadmium": { + "modernmetals:legacy/cadmium_ore": { "block": "modernmetals:cadmium_ore", "enabled": true, "source_mod": "modernmetals", @@ -168,7 +168,7 @@ } } }, - "modernmetals:ore/chromium": { + "modernmetals:legacy/chromium_ore": { "block": "modernmetals:chromium_ore", "enabled": true, "source_mod": "modernmetals", @@ -201,7 +201,7 @@ } } }, - "modernmetals:ore/iridium": { + "modernmetals:legacy/iridium_ore": { "block": "modernmetals:iridium_ore", "enabled": true, "source_mod": "modernmetals", @@ -234,7 +234,7 @@ } } }, - "modernmetals:ore/magnesium": { + "modernmetals:legacy/magnesium_ore": { "block": "modernmetals:magnesium_ore", "enabled": true, "source_mod": "modernmetals", @@ -267,7 +267,7 @@ } } }, - "modernmetals:ore/manganese": { + "modernmetals:legacy/manganese_ore": { "block": "modernmetals:manganese_ore", "enabled": true, "source_mod": "modernmetals", @@ -300,7 +300,7 @@ } } }, - "modernmetals:ore/osmium": { + "modernmetals:legacy/osmium_ore": { "block": "modernmetals:osmium_ore", "enabled": true, "source_mod": "modernmetals", @@ -333,7 +333,7 @@ } } }, - "modernmetals:ore/plutonium": { + "modernmetals:legacy/plutonium_ore": { "block": "modernmetals:plutonium_ore", "enabled": true, "source_mod": "modernmetals", @@ -366,7 +366,7 @@ } } }, - "modernmetals:ore/rutile": { + "modernmetals:legacy/rutile_ore": { "block": "modernmetals:rutile_ore", "enabled": true, "source_mod": "modernmetals", @@ -399,7 +399,7 @@ } } }, - "modernmetals:ore/tantalum": { + "modernmetals:legacy/tantalum_ore": { "block": "modernmetals:tantalum_ore", "enabled": true, "source_mod": "modernmetals", @@ -432,7 +432,7 @@ } } }, - "modernmetals:ore/tungsten": { + "modernmetals:legacy/tungsten_ore": { "block": "modernmetals:tungsten_ore", "enabled": true, "source_mod": "modernmetals", @@ -465,7 +465,7 @@ } } }, - "modernmetals:ore/uranium": { + "modernmetals:legacy/uranium_ore": { "block": "modernmetals:uranium_ore", "enabled": true, "source_mod": "modernmetals", @@ -498,7 +498,7 @@ } } }, - "modernmetals:ore/zirconium": { + "modernmetals:legacy/zirconium_ore": { "block": "modernmetals:zirconium_ore", "enabled": true, "source_mod": "modernmetals", @@ -531,7 +531,7 @@ } } }, - "modernmetals:ore/titanium": { + "modernmetals:legacy/titanium_ore": { "block": "modernmetals:titanium_ore", "enabled": false, "source_mod": "modernmetals", diff --git a/src/main/resources/data/modernmetals/recipe/galvanizedsteel_blend_base.json b/src/main/resources/data/modernmetals/recipe/galvanizedsteel_blend_base.json index fdf0f324..df61e9e8 100644 --- a/src/main/resources/data/modernmetals/recipe/galvanizedsteel_blend_base.json +++ b/src/main/resources/data/modernmetals/recipe/galvanizedsteel_blend_base.json @@ -5,11 +5,23 @@ "item": "modernmetals:galvanizedsteel_blend" }, { - "type": "neoforge:not", - "value": { - "type": "neoforge:tag_empty", - "tag": "c:dusts/steel" - } + "type": "neoforge:or", + "values": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:dusts/steel" + } + }, + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:blends/steel" + } + } + ] }, { "type": "neoforge:not", @@ -22,9 +34,14 @@ "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "tag": "c:dusts/steel" - }, + [ + { + "tag": "c:dusts/steel" + }, + { + "tag": "c:blends/steel" + } + ], { "tag": "c:dusts/zinc" } diff --git a/src/main/resources/data/modernmetals/recipe/nichrome_blend_base.json b/src/main/resources/data/modernmetals/recipe/nichrome_blend_base.json index 3c82d5aa..8d65bb0e 100644 --- a/src/main/resources/data/modernmetals/recipe/nichrome_blend_base.json +++ b/src/main/resources/data/modernmetals/recipe/nichrome_blend_base.json @@ -18,9 +18,14 @@ { "tag": "c:dusts/nickel" }, - { - "tag": "c:dusts/chromium" - } + [ + { + "tag": "c:dusts/chromium" + }, + { + "tag": "c:dusts/chrome" + } + ] ], "result": { "id": "modernmetals:nichrome_blend", diff --git a/src/main/resources/data/modernmetals/recipe/stainlesssteel_blend_base.json b/src/main/resources/data/modernmetals/recipe/stainlesssteel_blend_base.json index dca1ad0b..b39ebb38 100644 --- a/src/main/resources/data/modernmetals/recipe/stainlesssteel_blend_base.json +++ b/src/main/resources/data/modernmetals/recipe/stainlesssteel_blend_base.json @@ -5,22 +5,44 @@ "item": "modernmetals:stainlesssteel_blend" }, { - "type": "neoforge:not", - "value": { - "type": "neoforge:tag_empty", - "tag": "c:dusts/steel" - } + "type": "neoforge:or", + "values": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:dusts/steel" + } + }, + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:blends/steel" + } + } + ] } ], "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ - { - "tag": "c:dusts/steel" - }, - { - "tag": "c:dusts/chromium" - } + [ + { + "tag": "c:dusts/steel" + }, + { + "tag": "c:blends/steel" + } + ], + [ + { + "tag": "c:dusts/chromium" + }, + { + "tag": "c:dusts/chrome" + } + ] ], "result": { "id": "modernmetals:stainlesssteel_blend", diff --git a/src/main/resources/mmdlib/block/raw_block.json b/src/main/resources/mmdlib/block/raw_block.json new file mode 100644 index 00000000..1eab885d --- /dev/null +++ b/src/main/resources/mmdlib/block/raw_block.json @@ -0,0 +1,12 @@ +{ + "factory": "mmdlib:block", + "material_defaults": true, + "template": { + "properties": { + "sound": "stone", + "map_color": "metal", + "requires_correct_tool": true + }, + "has_item": true + } +} diff --git a/src/main/resources/mmdlib/item/raw.json b/src/main/resources/mmdlib/item/raw.json new file mode 100644 index 00000000..d03d9e89 --- /dev/null +++ b/src/main/resources/mmdlib/item/raw.json @@ -0,0 +1,7 @@ +{ + "factory": "mmdlib:basic_item", + "template": { + "max_stack_size": 64, + "fire_resistant": false + } +} diff --git a/src/main/resources/mmdlib/material/aluminum.json b/src/main/resources/mmdlib/material/aluminum.json index 83cb57c0..f0c05751 100644 --- a/src/main/resources/mmdlib/material/aluminum.json +++ b/src/main/resources/mmdlib/material/aluminum.json @@ -5,8 +5,8 @@ "strength": 3.75, "magic": 4.5, "damage": 0.6, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { diff --git a/src/main/resources/mmdlib/material/aluminumbrass.json b/src/main/resources/mmdlib/material/aluminumbrass.json index a840309c..43026f5b 100644 --- a/src/main/resources/mmdlib/material/aluminumbrass.json +++ b/src/main/resources/mmdlib/material/aluminumbrass.json @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:aluminumbrass_ingot", "base_block": "modernmetals:aluminumbrass_block", - "incorrect_blocks": "minecraft:incorrect_for_wooden_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:aluminumbrass", "block_set_type": "minecraft:iron", "block_sound": "metal", diff --git a/src/main/resources/mmdlib/material/beryllium.json b/src/main/resources/mmdlib/material/beryllium.json index edffc6d7..1f9c0414 100644 --- a/src/main/resources/mmdlib/material/beryllium.json +++ b/src/main/resources/mmdlib/material/beryllium.json @@ -5,8 +5,8 @@ "strength": 2.5, "magic": 1.0, "damage": 1.4, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/boron.json b/src/main/resources/mmdlib/material/boron.json index c265c5e8..058f4216 100644 --- a/src/main/resources/mmdlib/material/boron.json +++ b/src/main/resources/mmdlib/material/boron.json @@ -5,8 +5,8 @@ "strength": 8.0, "magic": 1.0, "damage": 2.4, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:boron_ingot", "base_block": "modernmetals:boron_block", - "incorrect_blocks": "minecraft:incorrect_for_diamond_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:boron", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_iron_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/cadmium.json b/src/main/resources/mmdlib/material/cadmium.json index fd1121ad..e8bb6f2a 100644 --- a/src/main/resources/mmdlib/material/cadmium.json +++ b/src/main/resources/mmdlib/material/cadmium.json @@ -5,8 +5,8 @@ "strength": 1.0, "magic": 4.5, "damage": 0.5, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { diff --git a/src/main/resources/mmdlib/material/chromium.json b/src/main/resources/mmdlib/material/chromium.json index f9b47746..83b5d130 100644 --- a/src/main/resources/mmdlib/material/chromium.json +++ b/src/main/resources/mmdlib/material/chromium.json @@ -5,8 +5,8 @@ "strength": 3.0, "magic": 4.5, "damage": 2.2, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:chromium_ingot", "base_block": "modernmetals:chromium_block", - "incorrect_blocks": "minecraft:incorrect_for_diamond_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:chromium", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_iron_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/galvanizedsteel.json b/src/main/resources/mmdlib/material/galvanizedsteel.json index 8e4bece2..f0d5656f 100644 --- a/src/main/resources/mmdlib/material/galvanizedsteel.json +++ b/src/main/resources/mmdlib/material/galvanizedsteel.json @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:galvanizedsteel_ingot", "base_block": "modernmetals:galvanizedsteel_block", - "incorrect_blocks": "minecraft:incorrect_for_stone_tool", + "incorrect_blocks": "minecraft:incorrect_for_iron_tool", "armor_texture": "modernmetals:galvanizedsteel", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/iridium.json b/src/main/resources/mmdlib/material/iridium.json index c257921e..cd19cca2 100644 --- a/src/main/resources/mmdlib/material/iridium.json +++ b/src/main/resources/mmdlib/material/iridium.json @@ -5,8 +5,8 @@ "strength": 3.0, "magic": 4.5, "damage": 1.6, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:iridium_ingot", "base_block": "modernmetals:iridium_block", - "incorrect_blocks": "minecraft:incorrect_for_iron_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:iridium", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/magnesium.json b/src/main/resources/mmdlib/material/magnesium.json index 8c0b669d..e6ae8a80 100644 --- a/src/main/resources/mmdlib/material/magnesium.json +++ b/src/main/resources/mmdlib/material/magnesium.json @@ -5,8 +5,8 @@ "strength": 3.5, "magic": 4.5, "damage": 0.6, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { diff --git a/src/main/resources/mmdlib/material/manganese.json b/src/main/resources/mmdlib/material/manganese.json index 23d0d681..3b1bd99f 100644 --- a/src/main/resources/mmdlib/material/manganese.json +++ b/src/main/resources/mmdlib/material/manganese.json @@ -5,8 +5,8 @@ "strength": 2.75, "magic": 4.5, "damage": 1.2, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/nichrome.json b/src/main/resources/mmdlib/material/nichrome.json index 3aa7a13f..1b877191 100644 --- a/src/main/resources/mmdlib/material/nichrome.json +++ b/src/main/resources/mmdlib/material/nichrome.json @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/osmium.json b/src/main/resources/mmdlib/material/osmium.json index fd75583f..253d9ee8 100644 --- a/src/main/resources/mmdlib/material/osmium.json +++ b/src/main/resources/mmdlib/material/osmium.json @@ -5,8 +5,8 @@ "strength": 2.75, "magic": 4.5, "damage": 1.8, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:osmium_ingot", "base_block": "modernmetals:osmium_block", - "incorrect_blocks": "minecraft:incorrect_for_iron_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:osmium", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_iron_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/plutonium.json b/src/main/resources/mmdlib/material/plutonium.json index f99ea0a1..41edf797 100644 --- a/src/main/resources/mmdlib/material/plutonium.json +++ b/src/main/resources/mmdlib/material/plutonium.json @@ -5,8 +5,8 @@ "strength": 7.5, "magic": 4.5, "damage": 1.0, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/rutile.json b/src/main/resources/mmdlib/material/rutile.json index ea89fe4e..d867c6cf 100644 --- a/src/main/resources/mmdlib/material/rutile.json +++ b/src/main/resources/mmdlib/material/rutile.json @@ -5,8 +5,8 @@ "strength": 0.25, "magic": 4.5, "damage": 1.5, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:rutile_ingot", "base_block": "modernmetals:rutile_block", - "incorrect_blocks": "minecraft:incorrect_for_iron_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:rutile", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/stainlesssteel.json b/src/main/resources/mmdlib/material/stainlesssteel.json index 867e9e82..c4fd2f04 100644 --- a/src/main/resources/mmdlib/material/stainlesssteel.json +++ b/src/main/resources/mmdlib/material/stainlesssteel.json @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/tantalum.json b/src/main/resources/mmdlib/material/tantalum.json index 96e59642..d2e936ae 100644 --- a/src/main/resources/mmdlib/material/tantalum.json +++ b/src/main/resources/mmdlib/material/tantalum.json @@ -5,8 +5,8 @@ "strength": 17.5, "magic": 4.5, "damage": 1.6, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:tantalum_ingot", "base_block": "modernmetals:tantalum_block", - "incorrect_blocks": "minecraft:incorrect_for_iron_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:tantalum", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/thorium.json b/src/main/resources/mmdlib/material/thorium.json index 0bd67fcc..72d9ac55 100644 --- a/src/main/resources/mmdlib/material/thorium.json +++ b/src/main/resources/mmdlib/material/thorium.json @@ -5,8 +5,8 @@ "strength": 1.0, "magic": 1.0, "damage": 0.8, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { diff --git a/src/main/resources/mmdlib/material/titanium.json b/src/main/resources/mmdlib/material/titanium.json index 26a926fb..0d14645b 100644 --- a/src/main/resources/mmdlib/material/titanium.json +++ b/src/main/resources/mmdlib/material/titanium.json @@ -5,8 +5,8 @@ "strength": 16.25, "magic": 4.5, "damage": 1.6, - "items": "ingot nugget modernmetals:powder smallpowder blend smallblend pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder blend smallblend pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/tungsten.json b/src/main/resources/mmdlib/material/tungsten.json index e1e35c7d..f454ae6c 100644 --- a/src/main/resources/mmdlib/material/tungsten.json +++ b/src/main/resources/mmdlib/material/tungsten.json @@ -5,8 +5,8 @@ "strength": 12.5, "magic": 4.5, "damage": 1.9, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:tungsten_ingot", "base_block": "modernmetals:tungsten_block", - "incorrect_blocks": "minecraft:incorrect_for_iron_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:tungsten", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_iron_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/uranium.json b/src/main/resources/mmdlib/material/uranium.json index 3f297975..13662832 100644 --- a/src/main/resources/mmdlib/material/uranium.json +++ b/src/main/resources/mmdlib/material/uranium.json @@ -5,8 +5,8 @@ "strength": 16.25, "magic": 4.5, "damage": 1.5, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -19,7 +19,7 @@ "runtime": { "repair_item": "modernmetals:uranium_ingot", "base_block": "modernmetals:uranium_block", - "incorrect_blocks": "minecraft:incorrect_for_iron_tool", + "incorrect_blocks": "minecraft:incorrect_for_stone_tool", "armor_texture": "modernmetals:uranium", "block_set_type": "minecraft:iron", "block_sound": "metal", @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/mmdlib/material/zirconium.json b/src/main/resources/mmdlib/material/zirconium.json index c57979d7..b0795b7a 100644 --- a/src/main/resources/mmdlib/material/zirconium.json +++ b/src/main/resources/mmdlib/material/zirconium.json @@ -5,8 +5,8 @@ "strength": 3.5, "magic": 4.5, "damage": 1.2, - "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty", - "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore", + "items": "ingot nugget modernmetals:powder smallpowder pickaxe axe shovel hoe sword crackhammer scythe shears fishing_rod bow crossbow shield arrow bolt rod gear horse_armor helmet chestplate leggings boots modernmetals:casing modernmetals:dense_plate modernmetals:crushed modernmetals:crushed_purified crystal shard clump powder_dirty modernmetals:raw", + "blocks": "block plate bars door trapdoor button slab lever pressure_plate stairs wall ore modernmetals:raw_block", "entities": "arrow bolt", "has_fluid": true, "special": { @@ -27,7 +27,6 @@ "tinted": false }, "harvest_tags": [ - "minecraft:mineable/pickaxe", - "minecraft:needs_stone_tool" + "minecraft:mineable/pickaxe" ] } diff --git a/src/main/resources/modernmetals.mixins.json b/src/main/resources/modernmetals.mixins.json new file mode 100644 index 00000000..d6faac4c --- /dev/null +++ b/src/main/resources/modernmetals.mixins.json @@ -0,0 +1,8 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "zone.moddev.mc.modernmetals.mixin", + "compatibilityLevel": "JAVA_21", + "mixins": ["ChunkSerializerMixin"], + "injectors": {"defaultRequire": 1} +} diff --git a/src/test/java/zone/moddev/mc/modernmetals/ProcessingIntegrationTest.java b/src/test/java/zone/moddev/mc/modernmetals/ProcessingIntegrationTest.java new file mode 100644 index 00000000..8f704be8 --- /dev/null +++ b/src/test/java/zone/moddev/mc/modernmetals/ProcessingIntegrationTest.java @@ -0,0 +1,151 @@ +package zone.moddev.mc.modernmetals; + +import static org.junit.jupiter.api.Assertions.*; +import java.util.List; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.SingleRecipeInput; +import net.neoforged.testframework.junit.EphemeralTestServerProvider; +import net.neoforged.fml.ModList; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import zone.moddev.mc.lib.common.recipes.CrushingRecipe; +import zone.moddev.mc.modernmetals.content.ModContent; + +/** Tests native recipe codecs and tags loaded by Minecraft, rather than just JSON shapes. */ +@ExtendWith(EphemeralTestServerProvider.class) +class ProcessingIntegrationTest { + private static ResourceLocation id(String name) { return ResourceLocation.fromNamespaceAndPath("modernmetals", name); } + private static Item item(String name) { return BuiltInRegistries.ITEM.get(id(name)); } + private static ItemStack stack(String name) { return new ItemStack(item(name)); } + + @Test void materialAndLegacyRegistrationsResolve(MinecraftServer server) { + assertEquals(21, ModContent.materials().size()); + for (String name : ModContent.materials().keySet()) { + assertNotSame(Items.AIR, item(name + "_ingot")); + assertSame(item(name + "_molten_bucket"), item(name + "_bucket")); + assertSame(BuiltInRegistries.BLOCK.get(id(name + "_molten")), BuiltInRegistries.BLOCK.get(id(name))); + assertSame(BuiltInRegistries.FLUID.get(id(name + "_molten")), BuiltInRegistries.FLUID.get(id(name))); + } + for (String name : List.of("galvanizedsteel", "nichrome", "stainlesssteel")) { + assertNotSame(Items.AIR, item(name + "_ore")); + } + assertNotSame(Items.AIR, item("coal_powder")); + } + + @Test void everyNativeBookRecipeHasAnAdvancement(MinecraftServer server) { + int count = 0; + for (var holder : server.getRecipeManager().getRecipes()) { + if (!holder.id().getNamespace().equals("modernmetals")) continue; + var recipe = holder.value(); + if (recipe.isSpecial() || !(recipe.getType() == RecipeType.CRAFTING || recipe.getType() == RecipeType.SMELTING || recipe.getType() == RecipeType.BLASTING)) continue; + var advancement = server.getAdvancements().get(id("recipes/" + holder.id().getPath())); + assertNotNull(advancement, holder.id().toString()); + assertTrue(advancement.value().rewards().recipes().contains(holder.id()), holder.id().toString()); + count++; + } + assertTrue(count > 1600, "Loaded book recipe count " + count); + } + + @Test void rawProcessingAndStorageHaveCorrectAmounts(MinecraftServer server) { + int count = 0; + for (String name : ModContent.materials().keySet()) { + if (!BuiltInRegistries.ITEM.containsKey(id(name + "_raw"))) continue; + var raw = stack(name + "_raw"); + var crushed = server.getRecipeManager().getAllRecipesFor(CrushingRecipe.TYPE.get()).stream() + .filter(r -> r.value().matches(new SingleRecipeInput(raw), null)).toList(); + assertEquals(1, crushed.size(), name); + assertEquals(1, crushed.getFirst().value().getResultItem(server.registryAccess()).getCount()); + assertSame(item(name + "_powder"), crushed.getFirst().value().getResultItem(server.registryAccess()).getItem()); + for (String method : List.of("smelting", "blasting")) { + var recipe = server.getRecipeManager().byKey(id(name + "_raw_" + method)).orElseThrow().value(); + assertSame(item(name + "_ingot"), recipe.getResultItem(server.registryAccess()).getItem()); + assertEquals(1, recipe.getResultItem(server.registryAccess()).getCount()); + } + var packed = server.getRecipeManager().byKey(id(name + "_raw_block_unpack")).orElseThrow().value(); + assertEquals(9, packed.getResultItem(server.registryAccess()).getCount()); + count++; + } + assertEquals(17, count); + } + + @Test void rodsYieldFourAndRecycleWithoutGain(MinecraftServer server) { + var rod = server.getRecipeManager().byKey(id("aluminum_rod")).orElseThrow().value(); + assertEquals(4, rod.getResultItem(server.registryAccess()).getCount()); + var recycled = server.getRecipeManager().byKey(id("smelting/aluminum_rod_recycling")).orElseThrow().value().getResultItem(server.registryAccess()); + assertSame(item("aluminum_nugget"), recycled.getItem()); + assertEquals(4, recycled.getCount()); + } + + @Test void plateRepairPreservesComponents(MinecraftServer server) { + var recipe = server.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING).stream() + .filter(r -> r.id().equals(id("titanium_helmet_plate_repair"))).findFirst().orElseThrow().value(); + ItemStack helmet = stack("titanium_helmet"); + helmet.setDamageValue(31); + helmet.set(DataComponents.CUSTOM_NAME, Component.literal("Saved test helmet")); + var input = CraftingInput.of(2, 1, List.of(helmet, stack("titanium_plate"))); + assertTrue(recipe.matches(input, null)); + var result = recipe.assemble(input, server.registryAccess()); + assertEquals(0, result.getDamageValue()); + assertEquals(helmet.get(DataComponents.CUSTOM_NAME), result.get(DataComponents.CUSTOM_NAME)); + assertEquals(31, helmet.getDamageValue(), "Input must not be mutated"); + assertFalse(recipe.matches(CraftingInput.of(2, 1, List.of(helmet, stack("aluminum_plate"))), null)); + } + + @Test void coalFallbackUsesTheSharedRecipeType(MinecraftServer server) { + var recipes = server.getRecipeManager().getAllRecipesFor(CrushingRecipe.TYPE.get()).stream() + .filter(r -> r.value().matches(new SingleRecipeInput(new ItemStack(Items.COAL)), null)).toList(); + assertEquals(1, recipes.size()); + boolean base = ModList.get().isLoaded("basemetals"); + assertEquals(base ? "basemetals" : "modernmetals", recipes.getFirst().id().getNamespace()); + assertEquals(base ? "basemetals" : "modernmetals", BuiltInRegistries.ITEM.getKey(recipes.getFirst().value().getResultItem(server.registryAccess()).getItem()).getNamespace()); + assertEquals(!base, server.getRecipeManager().byKey(id("coal_block_dust")).isPresent()); + } + + @Test void optionalAlloysFollowResolvedContributorTags(MinecraftServer server) { + boolean contributors = Boolean.getBoolean("modernmetals.test.contributors"); + boolean base = ModList.get().isLoaded("basemetals"); + for (String alloy : List.of("aluminumbrass", "galvanizedsteel", "nichrome", "stainlesssteel")) { + assertEquals(contributors || base, server.getRecipeManager().byKey(id(alloy + "_blend_base")).isPresent(), alloy); + } + if (!contributors) return; + var galvanized = server.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING).stream() + .filter(r -> r.id().equals(id("galvanizedsteel_blend_base"))).findFirst().orElseThrow().value(); + assertTrue(galvanized.matches(CraftingInput.of(2,1,List.of(new ItemStack(Items.IRON_INGOT),new ItemStack(Items.GOLD_NUGGET))), null)); + assertEquals(2, galvanized.getResultItem(server.registryAccess()).getCount()); + var stainless = server.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING).stream() + .filter(r -> r.id().equals(id("stainlesssteel_blend_base"))).findFirst().orElseThrow().value(); + assertTrue(stainless.matches(CraftingInput.of(2,1,List.of(new ItemStack(Items.IRON_INGOT),new ItemStack(Items.DIAMOND))), null)); + } + + @Test void nativeAlloyIngredientsAndYieldsMatchPublishedBaseMetals(MinecraftServer server) { + assertBlend(server,"titanium",1,List.of(stack("rutile_powder"),stack("magnesium_powder"))); + if(!ModList.get().isLoaded("basemetals"))return; + var steel=new ItemStack(BuiltInRegistries.ITEM.get(ResourceLocation.parse("basemetals:steel_blend"))); + var zinc=new ItemStack(BuiltInRegistries.ITEM.get(ResourceLocation.parse("basemetals:zinc_powder"))); + var nickel=new ItemStack(BuiltInRegistries.ITEM.get(ResourceLocation.parse("basemetals:nickel_powder"))); + var copper=new ItemStack(BuiltInRegistries.ITEM.get(ResourceLocation.parse("basemetals:copper_powder"))); + for(var ingredient:List.of(steel,zinc,nickel,copper))assertFalse(ingredient.isEmpty(),"Published Base Metals ingredient exists"); + assertBlend(server,"galvanizedsteel",2,List.of(steel,zinc)); + assertBlend(server,"stainlesssteel",2,List.of(steel,stack("chromium_powder"))); + assertBlend(server,"nichrome",2,List.of(nickel,stack("chromium_powder"))); + assertBlend(server,"aluminumbrass",4,List.of(stack("aluminum_powder"),stack("aluminum_powder"),stack("aluminum_powder"),copper)); + } + + private static void assertBlend(MinecraftServer server,String alloy,int count,List ingredients) { + var recipe=server.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING).stream() + .filter(r->r.id().equals(id(alloy+"_blend_base"))).findFirst().orElseThrow().value(); + assertTrue(recipe.matches(CraftingInput.of(2,ingredients.size()/2,ingredients),null),alloy+" ingredient match"); + assertEquals(count,recipe.getResultItem(server.registryAccess()).getCount(),alloy+" yield"); + assertSame(item(alloy+"_blend"),recipe.getResultItem(server.registryAccess()).getItem()); + } + +} diff --git a/tools/generate_processing_data.js b/tools/generate_processing_data.js new file mode 100644 index 00000000..34e63af9 --- /dev/null +++ b/tools/generate_processing_data.js @@ -0,0 +1,200 @@ +// Deterministic supplements to the hand-authored 1.21.1 resources. +const fs = require('fs'); +const path = require('path'); +const root = path.resolve(__dirname, '..'); +const source = path.join(root, 'src/main/resources'); +const output = path.join(root, 'build/generated/modernization'); +if (!output.startsWith(path.join(root, 'build') + path.sep)) throw Error('Unsafe output'); +fs.rmSync(output, { recursive: true, force: true }); +const read = p => JSON.parse(fs.readFileSync(path.join(source, p), 'utf8')); +const write = (p, data) => { + const file = path.join(output, p); + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n'); +}; +function files(dir) { + if (!fs.existsSync(dir)) return []; + return fs.readdirSync(dir, { withFileTypes: true }).sort((a,b)=>a.name.localeCompare(b.name)) + .flatMap(e => e.isDirectory() ? files(path.join(dir,e.name)) : e.name.endsWith('.json') ? [path.join(dir,e.name)] : []); +} +const materials = fs.readdirSync(path.join(source,'mmdlib/material')).filter(n=>n.endsWith('.json')).sort() + .map(file=>({ name:file.slice(0,-5), ...read('mmdlib/material/'+file) })); +if (materials.length !== 21) throw Error('Incomplete material catalogue'); +const policy = JSON.parse(fs.readFileSync(path.join(__dirname,'material-policy.json'))); +const recipes = new Map(files(path.join(source,'data/modernmetals/recipe')).map(file=>[ + path.relative(path.join(source,'data/modernmetals/recipe'),file).replaceAll('\\','/').slice(0,-5), JSON.parse(fs.readFileSync(file))])); +const condition = item => ({ type:'modernmetals:content_allowed', item }); +const standalone = { type:'neoforge:not', value:{ type:'neoforge:mod_loaded', modid:'basemetals' } }; +function add(id, recipe) { + if (recipes.has(id)) throw Error('Duplicate recipe '+id); + if (!recipe['neoforge:conditions'] && recipe.type !== 'mmdlib:crushing' && recipe.type !== 'modernmetals:plate_repair') { + recipe['neoforge:conditions'] = [condition(recipe.result.id)]; + } + recipes.set(id, recipe); + write('data/modernmetals/recipe/'+id+'.json',recipe); +} +function tag(registry, id, values) { const [ns,...parts]=id.split(':'); write('data/'+ns+'/tags/'+registry+'/'+parts.join(':')+'.json',{replace:false,values}); } +const id = (name,form) => 'modernmetals:'+name+'_'+form; +const ingredient = item => item.startsWith('#') ? {tag:item.slice(1)} : {item}; +function cooking(name,input,result,count=1,method='smelting',extra=[]) { + add(name,{type:'minecraft:'+method,category:'misc',ingredient:ingredient(input),result:{id:result,count}, + experience:0.05,cookingtime:method==='blasting'?100:200,'neoforge:conditions':[condition(result),...extra]}); +} +const byOutput = new Map(); +for(const r of recipes.values()) if(r.type.startsWith('minecraft:crafting_')) { + if(!byOutput.has(r.result.id)) byOutput.set(r.result.id,[]); + byOutput.get(r.result.id).push(r); +} +function units(material, form, seen=[]) { + const simple={ingot:9,nugget:1,powder:9,smallpowder:1,block:81}; + if(simple[form]) return simple[form]; + if(seen.includes(form)) return 0; + const values=(byOutput.get(id(material,form))||[]).map(r=> { + const ingredients=r.pattern ? r.pattern.flatMap(row=>[...row].filter(k=>k!==' ').map(k=>r.key[k])) : r.ingredients; + return ingredients.reduce((sum,i)=>sum+ingredientUnits(material,i,[...seen,form]),0)/(r.result.count||1); + }).filter(x=>x>0); + return values.length ? Math.min(...values) : 0; +} +function ingredientUnits(material,value,seen) { + if(Array.isArray(value)) return Math.min(...value.map(v=>ingredientUnits(material,v,seen))); + if(value.type==='neoforge:compound') return Math.min(...value.children.map(v=>ingredientUnits(material,v,seen))); + const t=(value.tag||'').match(/^c:([^/]+)\/([a-z]+)$/); + const forms={ingots:'ingot',nuggets:'nugget',storage_blocks:'block',rods:'rod',gears:'gear',plates:'plate'}; + if(t && t[2]===material && forms[t[1]]) return units(material,forms[t[1]],seen); + const v=(value.item||'').match(/^modernmetals:([a-z]+)_(.+)$/); + return v && v[1]===material ? units(material,v[2],seen) : 0; +} +const recycling=['axe','boots','helmet','sword','shovel','pickaxe','hoe','leggings','chestplate','crackhammer','shears', + 'rod','gear','slab','button','lever','wall','pressure_plate','door','trapdoor','horse_armor','fishing_rod','bars','plate','bow','crossbow','arrow','bolt','scythe','shield']; +const mining={mineable:[],stone:[],iron:[],diamond:[]}; +const costs={}; +for(const m of materials) { + const name=m.name; + costs[name]={}; + for(const form of recycling) { + const actual=units(name,form); + if(!actual) throw Error('No material cost: '+name+' '+form); + let value=Math.floor(actual+1e-8); + if(['bow','fishing_rod','lever'].includes(form)) value=Math.min(value,9); + if(form==='arrow') value=Math.min(value,1); + if(form==='bolt') value=Math.min(value,2); + let result=value>=9?'ingot':'nugget'; + let count=value>=9?Math.floor(value/9):value; + if(['wall','crackhammer'].includes(form) && value>=81) {result='block';count=Math.floor(value/81);} + if(count<1 || count>64) throw Error('Invalid recycling count '+name+' '+form); + const returned=count*({nugget:1,ingot:9,block:81}[result]); + if(returned>actual+1e-8) throw Error('Material gain in '+name+' '+form); + costs[name][form]={cost_nuggets:actual,returned_nuggets:returned}; + cooking('smelting/'+name+'_'+form+'_recycling',id(name,form),id(name,result),count); + } + for(const form of ['helmet','chestplate','leggings','boots','shield']) + add(name+'_'+form+'_plate_repair',{type:'modernmetals:plate_repair',target:id(name,form),plate:{tag:'c:plates/'+name}}); + const nativeOre=m.blocks.split(' ').includes('ore'); + for(const form of m.blocks.split(' ').map(x=>x.split(':').at(-1))) { + const block=id(name,form); + mining.mineable.push(block); + const level=policy[name][form==='ore'?'ore':form==='raw_block'?'ore':'solid']; + if(level>0) mining[['','stone','iron','diamond'][level]].push(block); + } + if(nativeOre) { + const raw=id(name,'raw'), block=id(name,'raw_block'); + tag('item','c:raw_materials/'+name,[raw]); + tag('item','c:storage_blocks/raw_'+name,[block]); + tag('block','c:storage_blocks/raw_'+name,[block]); + add(name+'_raw_block',{type:'minecraft:crafting_shaped',category:'building',pattern:['xxx','xxx','xxx'],key:{x:{tag:'c:raw_materials/'+name}},result:{id:block}}); + add(name+'_raw_block_unpack',{type:'minecraft:crafting_shapeless',category:'misc',ingredients:[{item:block}],result:{id:raw,count:9}}); + add(name+'_raw_crushing',{type:'mmdlib:crushing',ingredient:{tag:'c:raw_materials/'+name},result:{id:id(name,'powder'),count:1}}); + add(name+'_raw_block_crushing',{type:'mmdlib:crushing',ingredient:{item:block},result:{id:id(name,'powder'),count:9}}); + for(const method of ['smelting','blasting']) cooking(name+'_raw_'+method,'#c:raw_materials/'+name,id(name,'ingot'),1,method); + const silk={type:'minecraft:item',name:id(name,'ore'),conditions:[{condition:'minecraft:match_tool',predicate:{predicates:{'minecraft:enchantments':[{enchantments:'minecraft:silk_touch',levels:{min:1}}]}}}]}; + const drop={type:'minecraft:item',name:raw,functions:[{function:'minecraft:apply_bonus',enchantment:'minecraft:fortune',formula:'minecraft:ore_drops'},{function:'minecraft:explosion_decay'}]}; + write('data/modernmetals/loot_table/blocks/'+name+'_ore.json',{type:'minecraft:block',pools:[{rolls:1,entries:[{type:'minecraft:alternatives',children:[silk,drop]}]}]}); + write('data/modernmetals/loot_table/blocks/'+name+'_raw_block.json',{type:'minecraft:block',pools:[{rolls:1,entries:[{type:'minecraft:item',name:block}],conditions:[{condition:'minecraft:survives_explosion'}]}]}); + write('assets/modernmetals/models/item/'+name+'_raw.json',{parent:'minecraft:item/generated',textures:{layer0:'modernmetals:item/'+name+'_raw'}}); + write('assets/modernmetals/models/block/'+name+'_raw_block.json',{parent:'minecraft:block/cube_all',textures:{all:'modernmetals:block/'+name+'_raw_block'}}); + write('assets/modernmetals/models/item/'+name+'_raw_block.json',{parent:'modernmetals:block/'+name+'_raw_block'}); + write('assets/modernmetals/blockstates/'+name+'_raw_block.json',{variants:{'':{model:'modernmetals:block/'+name+'_raw_block'}}}); + } +} +for(const [key,name] of [['stone','needs_stone_tool'],['iron','needs_iron_tool'],['diamond','needs_diamond_tool']]) tag('block','minecraft:'+name,mining[key]); +tag('block','minecraft:mineable/pickaxe',mining.mineable); +tag('item','c:raw_materials',materials.filter(m=>m.blocks.split(' ').includes('ore')).map(m=>'#c:raw_materials/'+m.name)); +for(const registry of ['item','block']) { + const previous=read('data/c/tags/'+registry+'/storage_blocks.json').values; + tag(registry,'c:storage_blocks',[...previous,...materials.filter(m=>m.items.split(' ').includes('modernmetals:raw')).map(m=>'#c:storage_blocks/raw_'+m.name)]); +} +const extras=['galvanizedsteel','nichrome','stainlesssteel']; +for(const name of extras) { + const ore=id(name,'ore'); mining.mineable.push(ore); mining.stone.push(ore); + const model=read('assets/modernmetals/models/block/aluminum_ore.json'); + for(const element of model.elements) for(const face of Object.values(element.faces)) if(face.texture==='#overlay') face.tintindex=0; + write('assets/modernmetals/models/block/'+name+'_ore.json',model); + write('assets/modernmetals/models/item/'+name+'_ore.json',{parent:'modernmetals:block/'+name+'_ore'}); + write('assets/modernmetals/blockstates/'+name+'_ore.json',{variants:{'':{model:'modernmetals:block/'+name+'_ore'}}}); + write('data/modernmetals/loot_table/blocks/'+name+'_ore.json',{type:'minecraft:block',pools:[{rolls:1,entries:[{type:'minecraft:item',name:ore}]}]}); +} +tag('block','minecraft:mineable/pickaxe',mining.mineable); +tag('block','minecraft:needs_stone_tool',mining.stone); +for(const m of materials) write('assets/modernmetals/models/item/'+m.name+'.json',read('assets/modernmetals/models/item/'+m.name+'_molten_bucket.json')); +tag('item','c:dusts/coal',['modernmetals:coal_powder']); +write('assets/modernmetals/models/item/coal_powder.json',{parent:'minecraft:item/generated',textures:{layer0:'modernmetals:item/coal_powder'}}); +for(const [name,input,count] of [['coal','minecraft:coal',1],['coal_block','minecraft:coal_block',9],['coal_ore','#c:ores/coal',2]]) + add('crushing/'+name,{type:'mmdlib:crushing','neoforge:conditions':[standalone],ingredient:ingredient(input),result:{id:'modernmetals:coal_powder',count}}); +add('coal_block_dust',{type:'minecraft:crafting_shaped',category:'misc','neoforge:conditions':[standalone],pattern:['xxx','xxx','xxx'],key:{x:{tag:'c:dusts/coal'}},result:{id:'minecraft:coal_block'}}); +for(const name of ['copper','steel','zinc','nickel']) tag('item','c:dusts/'+name,[]); +tag('item','c:blends/steel',[]); +const optional=(tagName)=>({id:'#'+tagName,required:false}); +for(const m of materials) { + if(m.items.split(' ').includes('blend')) tag('item','c:blends/'+m.name,[id(m.name,'blend')]); +} +for(const [name,aliases] of Object.entries({aluminum:['aluminium','bauxite'],aluminumbrass:['aluminiumbrass','alubrass'],galvanizedsteel:['galvinizedsteel'],tungsten:['wolfram']})) + for(const category of ['dusts','ingots','nuggets','raw_materials']) for(const alias of aliases) tag('item','c:'+category+'/'+alias,[optional('c:'+category+'/'+name)]); +tag('item','c:dusts/chrome',['modernmetals:chromium_powder']); +let unlocks=0; +for(const [name,r] of recipes) { + if(!r.type.startsWith('minecraft:crafting_') && !['minecraft:smelting','minecraft:blasting'].includes(r.type)) continue; + const criteria={has_recipe:{trigger:'minecraft:recipe_unlocked',conditions:{recipe:'modernmetals:'+name}}}; + const mat=name.startsWith('smelting/')?name.split('/')[1].split('_')[0]:name.split('_')[0]; + if(r.type.startsWith('minecraft:crafting_') && policy[mat]) criteria.has_material={trigger:'minecraft:inventory_changed',conditions:{items:[{items:'#c:ingots/'+mat}]}}; + function flatten(v) {return Array.isArray(v)?v.flatMap(flatten):v?.type==='neoforge:compound'?v.children.flatMap(flatten):v?[v]:[];} + const inputs=flatten(r.key?Object.values(r.key):r.ingredients||r.ingredient); + const relevant=inputs.filter(v=>!['minecraft:stick','minecraft:string','minecraft:feather'].includes(v.item) && v.tag!=='c:rods/wooden'); + const unique=new Map((relevant.length?relevant:inputs).map(v=>[JSON.stringify(v),v])); + let index=0; + for(const v of unique.values()) if(v.item||v.tag) { + const key=name.endsWith('_blend_base') && v.tag?.startsWith('c:blends/')?'has_blend_'+v.tag.split('/')[1]:'has_ingredient_'+(++index); + criteria[key]={trigger:'minecraft:inventory_changed',conditions:{items:[{items:v.item||'#'+v.tag}]}}; + } + const adv={parent:'minecraft:recipes/root',criteria,requirements:[Object.keys(criteria)],rewards:{recipes:['modernmetals:'+name]},'neoforge:conditions':r['neoforge:conditions']||[]}; + write('data/modernmetals/advancement/recipes/'+name+'.json',adv);unlocks++; + // Keep earned 1.13 furnace advancement IDs readable after the renamed recipe. + const match=name.match(/^([a-z]+)_(ore|powder|blend|smallpowder|smallblend)_smelting$/); + if(match) write('data/modernmetals/advancement/recipes/smelting/'+match[1]+'_'+match[2]+'.json',adv); +} +write('modernmetals-processing-costs.json',costs); +const localized=JSON.parse(fs.readFileSync(path.join(__dirname,'material-names.json'))); +const genitive={aluminum:'алюминия',beryllium:'бериллия',boron:'бора',cadmium:'кадмия',chromium:'хрома',iridium:'иридия',magnesium:'магния',manganese:'марганца',osmium:'осмия',plutonium:'плутония',rutile:'рутила',tantalum:'тантала',thorium:'тория',titanium:'титана',tungsten:'вольфрама',uranium:'урана',zirconium:'циркония'}; +for(const file of fs.readdirSync(path.join(source,'assets/modernmetals/lang')).filter(n=>n.endsWith('.json')).sort()) { + const locale=file.slice(0,-5), language=read('assets/modernmetals/lang/'+file); + const kind=locale.startsWith('en_')?'en':locale; + for(const m of materials) { + const n=localized[locale]?.[m.name] || language['item.modernmetals.'+m.name+'_ingot'].replace(/ Ingot$/,''); + const item=(suffix,text)=>language['item.modernmetals.'+m.name+suffix]=text; + const block=(suffix,text)=>language['block.modernmetals.'+m.name+suffix]=text; + let bucket, casing, sickle, raw, rawBlock; + if(kind==='de_de') {bucket='Schmelze: '+n+' (Eimer)';casing='Gehäuse ('+n+')';sickle='Sichel ('+n+')';raw=n+'-Erzbrocken';rawBlock='Block aus '+n+'-Erzbrocken';} + else if(kind==='ru_ru') {bucket='Ведро расплава: '+n;casing='Корпус ('+n+')';sickle='Серп ('+n+')';raw='Необработанный '+n;rawBlock='Блок необработанного '+(genitive[m.name]||n);} + else if(kind==='zh_cn') {bucket='熔融'+n+'桶';casing=n+'外壳';sickle=n+'镰刀';raw='粗'+n;rawBlock='粗'+n+'块';} + else {bucket='Molten '+n+' Bucket';casing=n+' Item Casing';sickle=n+' Sickle';raw='Raw '+n;rawBlock='Block of Raw '+n;} + item('_molten_bucket',bucket); item('',bucket); + block('_molten',bucket.replace(/ Bucket$| \(Eimer\)$|桶$/,'')); + if(!language['item.modernmetals.'+m.name+'_casing']) item('_casing',casing); + if(!language['item.modernmetals.'+m.name+'_scythe']) item('_scythe',sickle); + if(m.items.split(' ').includes('modernmetals:raw')) {item('_raw',raw);block('_raw_block',rawBlock);} + if(extras.includes(m.name) && !language['block.modernmetals.'+m.name+'_ore']) block('_ore',n+' Ore'); + } + language['item.modernmetals.coal_powder']=kind==='de_de'?'Kohlestaub':kind==='ru_ru'?'Угольная пыль':kind==='zh_cn'?'煤粉':'Coal Dust'; + language['modernmetals.configuration.moltenMetalBurns']=kind==='de_de'?'Verbrennungen durch Metallschmelze':kind==='ru_ru'?'Ожоги от расплавленного металла':kind==='zh_cn'?'熔融金属造成灼伤':'Molten Metal Burns'; + write('assets/modernmetals/lang/'+file,Object.fromEntries(Object.entries(language).sort(([a],[b])=>a.localeCompare(b)))); +} +console.log('Generated '+unlocks+' recipe advancements and '+(recipes.size-1099)+' supplemental recipes; four-rod accounting checked.'); diff --git a/tools/generate_raw_textures.py b/tools/generate_raw_textures.py new file mode 100644 index 00000000..262d46ef --- /dev/null +++ b/tools/generate_raw_textures.py @@ -0,0 +1,38 @@ +"""Recolour the checked-in Base Metals/vanilla pixel masks; requires Pillow. + +Run explicitly after a palette change. Normal builds consume the saved PNGs. +The user selected deterministic recolouring rather than new generated artwork. +""" +from pathlib import Path +import json +from PIL import Image + +ROOT = Path(__file__).resolve().parents[1] +ASSETS = ROOT / 'src/main/resources/assets/modernmetals/textures' + + +def recolour(template, colour): + image = Image.open(template).convert('RGBA') + assert image.size == (16, 16) + rgb = ((colour >> 16) & 255, (colour >> 8) & 255, colour & 255) + pixels = [] + for red, green, blue, alpha in image.getdata(): + light = (0.2126 * red + 0.7152 * green + 0.0722 * blue) / 255 + shade = 0.24 + 1.12 * light + highlight = max(0, light - 0.68) * 0.45 + pixels.append(tuple(min(255, round(channel * shade + 255 * highlight)) for channel in rgb) + (alpha,)) + image.putdata(pixels) + return image + + +if __name__ == '__main__': + for material in sorted((ROOT / 'src/main/resources/mmdlib/material').glob('*.json')): + data = json.loads(material.read_text()) + if 'modernmetals:raw' not in data['items'].split(): + continue + for kind, folder, suffix in [('item', 'item', '_raw'), ('block', 'block', '_raw_block')]: + image = recolour(ROOT / ('tools/textures/raw_' + kind + '_template.png'), data['color']) + target = ASSETS / folder / (material.stem + suffix + '.png') + target.parent.mkdir(parents=True, exist_ok=True) + image.save(target, optimize=False, compress_level=9) + print(material.stem) diff --git a/tools/material-names.json b/tools/material-names.json new file mode 100644 index 00000000..a831c88a --- /dev/null +++ b/tools/material-names.json @@ -0,0 +1,25 @@ +{ + "de_de": { + "aluminum": "Aluminium", "aluminumbrass": "Aluminiummessing", "beryllium": "Beryllium", + "boron": "Bor", "cadmium": "Cadmium", "chromium": "Chrom", "galvanizedsteel": "Verzinkter Stahl", + "iridium": "Iridium", "magnesium": "Magnesium", "manganese": "Mangan", "nichrome": "Nichrom", + "osmium": "Osmium", "plutonium": "Plutonium", "rutile": "Rutil", "stainlesssteel": "Edelstahl", + "tantalum": "Tantal", "thorium": "Thorium", "titanium": "Titan", "tungsten": "Wolfram", + "uranium": "Uran", "zirconium": "Zirkonium" + }, + "ru_ru": { + "aluminum": "алюминий", "aluminumbrass": "алюминиевая латунь", "beryllium": "бериллий", + "boron": "бор", "cadmium": "кадмий", "chromium": "хром", "galvanizedsteel": "оцинкованная сталь", + "iridium": "иридий", "magnesium": "магний", "manganese": "марганец", "nichrome": "нихром", + "osmium": "осмий", "plutonium": "плутоний", "rutile": "рутил", "stainlesssteel": "нержавеющая сталь", + "tantalum": "тантал", "thorium": "торий", "titanium": "титан", "tungsten": "вольфрам", + "uranium": "уран", "zirconium": "цирконий" + }, + "zh_cn": { + "aluminum": "铝", "aluminumbrass": "铝黄铜", "beryllium": "铍", "boron": "硼", "cadmium": "镉", + "chromium": "铬", "galvanizedsteel": "镀锌钢", "iridium": "铱", "magnesium": "镁", + "manganese": "锰", "nichrome": "镍铬合金", "osmium": "锇", "plutonium": "钚", + "rutile": "金红石", "stainlesssteel": "不锈钢", "tantalum": "钽", "thorium": "钍", + "titanium": "钛", "tungsten": "钨", "uranium": "铀", "zirconium": "锆" + } +} diff --git a/tools/material-policy.json b/tools/material-policy.json new file mode 100644 index 00000000..0c81e1c9 --- /dev/null +++ b/tools/material-policy.json @@ -0,0 +1,128 @@ +{ + "aluminum": { + "kind": "ORE", + "tool": 0, + "solid": 0, + "ore": 1 + }, + "aluminumbrass": { + "kind": "ALLOY", + "tool": 1, + "solid": 1, + "ore": 1 + }, + "beryllium": { + "kind": "ORE", + "tool": 1, + "solid": 1, + "ore": 1 + }, + "boron": { + "kind": "ORE", + "tool": 1, + "solid": 2, + "ore": 1 + }, + "cadmium": { + "kind": "RARE_ORE", + "tool": 0, + "solid": 0, + "ore": 1 + }, + "chromium": { + "kind": "ORE", + "tool": 1, + "solid": 2, + "ore": 1 + }, + "galvanizedsteel": { + "kind": "ALLOY", + "tool": 2, + "solid": 2, + "ore": 1 + }, + "iridium": { + "kind": "RARE_ORE", + "tool": 1, + "solid": 2, + "ore": 1 + }, + "magnesium": { + "kind": "ORE", + "tool": 0, + "solid": 0, + "ore": 1 + }, + "manganese": { + "kind": "ORE", + "tool": 1, + "solid": 1, + "ore": 1 + }, + "nichrome": { + "kind": "ALLOY", + "tool": 2, + "solid": 2, + "ore": 1 + }, + "osmium": { + "kind": "ORE", + "tool": 1, + "solid": 2, + "ore": 1 + }, + "plutonium": { + "kind": "RARE_ORE", + "tool": 1, + "solid": 1, + "ore": 1 + }, + "rutile": { + "kind": "ORE", + "tool": 1, + "solid": 2, + "ore": 1 + }, + "stainlesssteel": { + "kind": "ALLOY", + "tool": 2, + "solid": 2, + "ore": 1 + }, + "tantalum": { + "kind": "ORE", + "tool": 1, + "solid": 1, + "ore": 1 + }, + "thorium": { + "kind": "ORE", + "tool": 1, + "solid": 1, + "ore": 1 + }, + "titanium": { + "kind": "SPECIAL", + "tool": 2, + "solid": 2, + "ore": 1 + }, + "tungsten": { + "kind": "ORE", + "tool": 1, + "solid": 2, + "ore": 1 + }, + "uranium": { + "kind": "RARE_ORE", + "tool": 1, + "solid": 1, + "ore": 1 + }, + "zirconium": { + "kind": "ORE", + "tool": 1, + "solid": 1, + "ore": 1 + } +} diff --git a/tools/test_processing_data.js b/tools/test_processing_data.js new file mode 100644 index 00000000..8915478e --- /dev/null +++ b/tools/test_processing_data.js @@ -0,0 +1,54 @@ +// Deterministic resource checks. Gameplay and codecs are covered by the native tests. +const {test}=require('node:test'); +const assert=require('node:assert/strict'); +const fs=require('node:fs'); +const path=require('node:path'); +const root=path.resolve(__dirname,'..'), main=path.join(root,'src/main/resources'), gen=path.join(root,'build/generated/modernization'); +function files(dir){return fs.readdirSync(dir,{withFileTypes:true}).flatMap(e=>e.isDirectory()?files(path.join(dir,e.name)):[path.join(dir,e.name)]);} +function read(name){return JSON.parse(fs.readFileSync(fs.existsSync(path.join(gen,name))?path.join(gen,name):path.join(main,name),'utf8').replace(/^\uFEFF/,''));} +const materials=files(path.join(main,'mmdlib/material')).map(f=>({...JSON.parse(fs.readFileSync(f,'utf8')),name:path.basename(f,'.json')})); +test('all source and generated JSON parse',()=>{for(const dir of [main,gen])for(const f of files(dir).filter(f=>f.endsWith('.json')))JSON.parse(fs.readFileSync(f,'utf8').replace(/^\uFEFF/,''));}); +test('seventeen raw chains, loot and pixel assets',()=>{ + const ores=materials.filter(m=>m.blocks.split(' ').includes('ore')); assert.equal(ores.length,17); + for(const m of ores){ + assert(m.items.split(' ').includes('modernmetals:raw')); + const loot=JSON.stringify(read(`data/modernmetals/loot_table/blocks/${m.name}_ore.json`)); + for(const token of [`modernmetals:${m.name}_raw`,'minecraft:silk_touch','minecraft:fortune'])assert(loot.includes(token),m.name+token); + for(const [suffix,count] of [['_raw_crushing',1],['_raw_block_crushing',9],['_raw_block_unpack',9]])assert.equal(read(`data/modernmetals/recipe/${m.name}${suffix}.json`).result.count,count); + for(const asset of [`item/${m.name}_raw`,`block/${m.name}_raw_block`]){const png=fs.readFileSync(path.join(main,'assets/modernmetals/textures',asset+'.png'));assert.equal(png.readUInt32BE(16),16);assert.equal(png.readUInt32BE(20),16);assert.equal(png[25],6);} + } +}); +test('whole steel blend and chrome alternatives remain guarded',()=>{ + for(const m of ['galvanizedsteel','stainlesssteel'])assert(JSON.stringify(read(`data/modernmetals/recipe/${m}_blend_base.json`)).includes('c:blends/steel')); + for(const m of ['nichrome','stainlesssteel'])assert(JSON.stringify(read(`data/modernmetals/recipe/${m}_blend_base.json`)).includes('c:dusts/chrome')); +}); +test('component yields and recycling stay bounded',()=>{ + for(const m of materials){for(const [form,count] of [['rod',4],['gear',4],['plate',3]])assert.equal(read(`data/modernmetals/recipe/${m.name}_${form}.json`).result.count,count);} + const r=read('data/modernmetals/recipe/smelting/aluminum_rod_recycling.json');assert.equal(r.result.id,'modernmetals:aluminum_nugget');assert.equal(r.result.count,4); +}); +test('all book recipes have guarded stable advancements',()=>{ + const recipes=new Map();for(const dir of [main,gen])for(const f of files(path.join(dir,'data/modernmetals/recipe')))recipes.set(path.relative(path.join(dir,'data/modernmetals/recipe'),f).replaceAll('\\','/'),JSON.parse(fs.readFileSync(f,'utf8'))); + let count=0;for(const [name,r] of recipes){if(!r.type.startsWith('minecraft:crafting_')&&!['minecraft:smelting','minecraft:blasting'].includes(r.type))continue;count++;const a=read('data/modernmetals/advancement/recipes/'+name);assert.deepEqual(a.rewards.recipes,['modernmetals:'+name.slice(0,-5)]);assert.deepEqual(a['neoforge:conditions']||[],r['neoforge:conditions']||[]);}assert(count>1600); +}); +test('standalone coal recipes have exclusive ownership',()=>{for(const p of ['coal_block_dust','crushing/coal','crushing/coal_block','crushing/coal_ore'])assert(read('data/modernmetals/recipe/'+p+'.json')['neoforge:conditions'].some(c=>c.type==='neoforge:not'&&c.value.type==='neoforge:mod_loaded'&&c.value.modid==='basemetals'));}); +test('independent mining levels and dynamic repair',()=>{assert.equal(read('mmdlib/material/galvanizedsteel.json').runtime.incorrect_blocks,'minecraft:incorrect_for_iron_tool');assert.equal(read('data/modernmetals/recipe/aluminum_helmet_plate_repair.json').type,'modernmetals:plate_repair');}); +test('all locales name raw materials and molten buckets',()=>{ + const langs=files(path.join(gen,'assets/modernmetals/lang'));assert.equal(langs.length,9); + for(const f of langs){const l=JSON.parse(fs.readFileSync(f,'utf8'));for(const m of materials){assert(l[`item.modernmetals.${m.name}_molten_bucket`],f+m.name);assert(l[`block.modernmetals.${m.name}_molten`]);if(m.items.includes('modernmetals:raw')){assert(l[`item.modernmetals.${m.name}_raw`]);assert(l[`block.modernmetals.${m.name}_raw_block`]);}}} +}); +test('ore overlay faces cover the complete sprite',()=>{for(const f of files(path.join(main,'assets/modernmetals/models/block')).filter(f=>f.endsWith('_ore.json')))for(const e of JSON.parse(fs.readFileSync(f,'utf8')).elements||[])for(const face of Object.values(e.faces))if(face.texture==='#overlay')assert.deepEqual(face.uv,[0,0,16,16],f);}); +test('OreSpawn rule IDs retain saved 1.13 settings',()=>{ + const provider=read('data/modernmetals/orespawn/provider.json'); + assert.equal(Object.keys(provider.ores).length,17); + for(const [key,ore] of Object.entries(provider.ores))assert.equal(key,'modernmetals:legacy/'+ore.block.split(':')[1]); + assert.equal(provider.ores['modernmetals:legacy/titanium_ore'].enabled,false); +}); +test('all old furnace advancement paths remain readable',()=>{ + for(const m of materials)for(const form of ['ore','powder','blend','smallpowder','smallblend']) { + if(fs.existsSync(path.join(main,`data/modernmetals/recipe/${m.name}_${form}_smelting.json`)))assert(read(`data/modernmetals/advancement/recipes/smelting/${m.name}_${form}.json`)); + } +}); +test('generated replacements are limited to the audited resource families',()=>{ + const allowed=/^(assets\/modernmetals\/lang\/[^/]+\.json|data\/c\/tags\/(item|block)\/storage_blocks\.json|data\/minecraft\/tags\/block\/(needs_(stone|iron)_tool|mineable\/pickaxe)\.json|data\/modernmetals\/loot_table\/blocks\/[a-z]+_ore\.json)$/; + for(const f of files(gen)){const name=path.relative(gen,f).replaceAll('\\','/');if(fs.existsSync(path.join(main,name)))assert(allowed.test(name),name);} +}); diff --git a/tools/textures/README.md b/tools/textures/README.md new file mode 100644 index 00000000..75f3a9f8 --- /dev/null +++ b/tools/textures/README.md @@ -0,0 +1,15 @@ +# Raw texture masks + +The raw items reuse Base Metals' existing pixel shapes. Both masks are recoloured +deterministically in code. + +`raw_item_template.png` is the tin raw-item shape from the Base Metals 1.21.1 +NeoForge checkout. `raw_block_template.png` is Minecraft 1.21.1's raw iron block +texture, extracted from the vanilla client assets. They retain their original +16 by 16 pixel layouts and alpha. The material colours come from this mod's +MMDLib definitions. + +Run `python tools/generate_raw_textures.py` with Pillow installed to regenerate +the 17 item and 17 block PNGs. These are saved product resources; the ordinary +build does not regenerate textures or require Pillow. Existing ore overlays +are unchanged by this script. diff --git a/tools/textures/raw_block_template.png b/tools/textures/raw_block_template.png new file mode 100644 index 0000000000000000000000000000000000000000..7736fc2619fe0a1f75e219f203261f059b3b962a GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ{de!g%M%-Kte?ETue`4$ zq$bHeEy%pj-b@{+pvu$5F{I)a@9B%8hZJ~NFI?xfF>qvL*YK2Gpz<%Ai92K0e~xee z<6gAinpLUP74bCL@zz)MZLTxEe>GjPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0jWtuK~y+T&63Sa zDq$4H`#bI*)AS+1-AFY!evD%_QP3ArcXKC=DbvD~f)*`WWE9x9RQChY0?C5PLa1yL zlon`F=qj@8JjA#Nnk?GY56Mi_KwN^_?sQX{xaY&a(`r-&#lVG=|HwL*#QA49MNsiv$akjgNX@<+