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 00000000..fb070717 Binary files /dev/null and b/src/gameTest/resources/data/modernmetals_tests/structure/empty.nbt differ 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 00000000..f383a43d Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/aluminum_raw_block.png differ 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 00000000..0bf40822 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/beryllium_raw_block.png differ diff --git a/src/main/resources/assets/modernmetals/textures/block/boron_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/boron_raw_block.png new file mode 100644 index 00000000..a6169234 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/boron_raw_block.png differ 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 00000000..bbbed597 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/cadmium_raw_block.png differ diff --git a/src/main/resources/assets/modernmetals/textures/block/chromium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/chromium_raw_block.png new file mode 100644 index 00000000..434471e5 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/chromium_raw_block.png differ 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 00000000..231e4364 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/iridium_raw_block.png differ 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 00000000..faefce86 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/magnesium_raw_block.png differ 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 00000000..be4f5c65 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/manganese_raw_block.png differ diff --git a/src/main/resources/assets/modernmetals/textures/block/osmium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/osmium_raw_block.png new file mode 100644 index 00000000..671e1684 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/osmium_raw_block.png differ 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 00000000..aa009c6f Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/plutonium_raw_block.png differ 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 00000000..b8f55b5c Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/rutile_raw_block.png differ diff --git a/src/main/resources/assets/modernmetals/textures/block/tantalum_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/tantalum_raw_block.png new file mode 100644 index 00000000..71cf99f9 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/tantalum_raw_block.png differ 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 00000000..1eb55c43 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/thorium_raw_block.png differ 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 00000000..94466ef6 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/titanium_raw_block.png differ diff --git a/src/main/resources/assets/modernmetals/textures/block/tungsten_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/tungsten_raw_block.png new file mode 100644 index 00000000..5258bedb Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/tungsten_raw_block.png differ diff --git a/src/main/resources/assets/modernmetals/textures/block/uranium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/uranium_raw_block.png new file mode 100644 index 00000000..09cf512e Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/uranium_raw_block.png differ diff --git a/src/main/resources/assets/modernmetals/textures/block/zirconium_raw_block.png b/src/main/resources/assets/modernmetals/textures/block/zirconium_raw_block.png new file mode 100644 index 00000000..417a96b7 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/block/zirconium_raw_block.png differ 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 00000000..7657580c Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/aluminum_raw.png differ 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 00000000..14dd96ea Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/beryllium_raw.png differ 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 00000000..f3db5fbe Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/boron_raw.png differ 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 00000000..ab158b75 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/cadmium_raw.png differ 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 00000000..df7031d3 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/chromium_raw.png differ diff --git a/src/main/resources/assets/modernmetals/textures/item/coal_powder.png b/src/main/resources/assets/modernmetals/textures/item/coal_powder.png new file mode 100644 index 00000000..f82b991d Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/coal_powder.png differ diff --git a/src/main/resources/assets/modernmetals/textures/item/iridium_raw.png b/src/main/resources/assets/modernmetals/textures/item/iridium_raw.png new file mode 100644 index 00000000..8e8b8e56 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/iridium_raw.png differ 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 00000000..c0418e26 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/magnesium_raw.png differ 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 00000000..2ea2b6b3 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/manganese_raw.png differ diff --git a/src/main/resources/assets/modernmetals/textures/item/osmium_raw.png b/src/main/resources/assets/modernmetals/textures/item/osmium_raw.png new file mode 100644 index 00000000..d67ee0a5 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/osmium_raw.png differ diff --git a/src/main/resources/assets/modernmetals/textures/item/plutonium_raw.png b/src/main/resources/assets/modernmetals/textures/item/plutonium_raw.png new file mode 100644 index 00000000..92c895db Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/plutonium_raw.png differ diff --git a/src/main/resources/assets/modernmetals/textures/item/rutile_raw.png b/src/main/resources/assets/modernmetals/textures/item/rutile_raw.png new file mode 100644 index 00000000..b4468277 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/rutile_raw.png differ 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 00000000..93d0d331 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/tantalum_raw.png differ 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 00000000..8a4586f6 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/thorium_raw.png differ 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 00000000..484205be Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/titanium_raw.png differ 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 00000000..34a38c63 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/tungsten_raw.png differ diff --git a/src/main/resources/assets/modernmetals/textures/item/uranium_raw.png b/src/main/resources/assets/modernmetals/textures/item/uranium_raw.png new file mode 100644 index 00000000..2c64c1e3 Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/uranium_raw.png differ 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 00000000..2ed142fe Binary files /dev/null and b/src/main/resources/assets/modernmetals/textures/item/zirconium_raw.png differ 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 00000000..7736fc26 Binary files /dev/null and b/tools/textures/raw_block_template.png differ diff --git a/tools/textures/raw_item_template.png b/tools/textures/raw_item_template.png new file mode 100644 index 00000000..3990c0d2 Binary files /dev/null and b/tools/textures/raw_item_template.png differ