Skip to content

Commit 6f4c44e

Browse files
authored
Keep old expansion machine data when upgrading worlds on 1.21.11
Keep old expansion machine data when upgrading worlds on 1.21.11
2 parents 327beb7 + ab3dcef commit 6f4c44e

17 files changed

Lines changed: 725 additions & 60 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,19 @@ jobs:
7171
--no-daemon --stacktrace
7272
first="$RUNNER_TEMP/basemetals-first"
7373
mkdir -p "$first"
74-
cp build/libs/BaseMetals-3.1.1.121111.jar "$first/"
75-
cp build/libs/BaseMetals-3.1.1.121111-sources.jar "$first/"
76-
cp build/libs/BaseMetals-3.1.1.121111-javadoc.jar "$first/"
74+
cp build/libs/BaseMetals-3.1.2.121111.jar "$first/"
75+
cp build/libs/BaseMetals-3.1.2.121111-sources.jar "$first/"
76+
cp build/libs/BaseMetals-3.1.2.121111-javadoc.jar "$first/"
7777
cp build/release/SHA256SUMS "$first/"
7878
7979
- name: Rebuild and prove byte-identical archives
8080
run: |
8181
./gradlew clean assemble verifyReleaseArtifacts writeReleaseChecksums \
8282
-PorespawnVerificationRepository="${{ steps.orespawn.outputs.repository }}" \
8383
--no-daemon --stacktrace
84-
cmp "$RUNNER_TEMP/basemetals-first/BaseMetals-3.1.1.121111.jar" build/libs/BaseMetals-3.1.1.121111.jar
85-
cmp "$RUNNER_TEMP/basemetals-first/BaseMetals-3.1.1.121111-sources.jar" build/libs/BaseMetals-3.1.1.121111-sources.jar
86-
cmp "$RUNNER_TEMP/basemetals-first/BaseMetals-3.1.1.121111-javadoc.jar" build/libs/BaseMetals-3.1.1.121111-javadoc.jar
84+
cmp "$RUNNER_TEMP/basemetals-first/BaseMetals-3.1.2.121111.jar" build/libs/BaseMetals-3.1.2.121111.jar
85+
cmp "$RUNNER_TEMP/basemetals-first/BaseMetals-3.1.2.121111-sources.jar" build/libs/BaseMetals-3.1.2.121111-sources.jar
86+
cmp "$RUNNER_TEMP/basemetals-first/BaseMetals-3.1.2.121111-javadoc.jar" build/libs/BaseMetals-3.1.2.121111-javadoc.jar
8787
cmp "$RUNNER_TEMP/basemetals-first/SHA256SUMS" build/release/SHA256SUMS
8888
8989
- name: Run all required GameTests
@@ -151,9 +151,9 @@ jobs:
151151
if-no-files-found: error
152152
retention-days: 30
153153
path: |
154-
build/libs/BaseMetals-3.1.1.121111.jar
155-
build/libs/BaseMetals-3.1.1.121111-sources.jar
156-
build/libs/BaseMetals-3.1.1.121111-javadoc.jar
154+
build/libs/BaseMetals-3.1.2.121111.jar
155+
build/libs/BaseMetals-3.1.2.121111-sources.jar
156+
build/libs/BaseMetals-3.1.2.121111-javadoc.jar
157157
build/release/SHA256SUMS
158158
CHANGELOG.txt
159159

‎CHANGELOG.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Base Metals 3.1.2.121111
2+
3+
- Keep expansion machine directions, inventories and item wear before Minecraft converts old worlds.
4+
- Carry the shared migration extension hook forward to Minecraft 1.21.11.
5+
- Let companion chunk-migration callbacks finish before returning, so staged entities are not lost.
6+
- Keep existing block and item identities, recipes and material balance unchanged.
7+
18
Base Metals 3.1.1.121111
29

310
- Port the released 1.21.1 version to Minecraft 1.21.11 and Forge 61, keeping Java 21.

‎README.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55

66
# Base Metals
77

8+
The 3.1.2.121111 patch preserves expansion machine data before Minecraft
9+
converts an older world. It also lets companion migration callbacks finish,
10+
so restored entities are not lost. Machine, upgrade, restart and endurance
11+
checks have passed with the matching basePower, baseSteam and baseElectric
12+
builds. Keep a backup and test an upgrade on a copy of your world first.
13+
814
Base Metals adds historically common metals, useful alloys, and fantasy metals
915
to Minecraft. Depending on the material, these are available as ores, storage
1016
and decorative blocks, molten fluids, crafting components, tools, armour,
1117
shields, bows, crossbows, arrows, and bolts. The mod also includes Crack
1218
Hammers, scythes, metal anvils, the human detector, villager trades,
1319
advancements, and structure loot.
1420

15-
This is the Minecraft 1.21.11 Forge version, `3.1.1.121111`. It keeps the
21+
This is the Minecraft 1.21.11 Forge version, `3.1.2.121111`. It keeps the
1622
fixes and features from the released 1.21.1 version, including raw metals, ore
1723
texture overlays and High/Low Fantasy modes. Existing Base Metals items and
1824
blocks keep their registry IDs. OreSpawn handles ore generation; MMDLib and
@@ -28,7 +34,7 @@ Additional Loot Tables are no longer needed.
2834
The port has also been checked against Forge `61.2.4`.
2935

3036
This version uses OreSpawn `4.1.0.121111`. Put
31-
`BaseMetals-3.1.1.121111.jar` and a compatible OreSpawn JAR in the `mods`
37+
`BaseMetals-3.1.2.121111.jar` and a compatible OreSpawn JAR in the `mods`
3238
directory. MMDLib and Additional Loot Tables must not be carried forward from
3339
an older installation. Mineralogy is optional.
3440

@@ -203,7 +209,7 @@ early splash window. Minecraft still opens its game window and runs the full
203209
world check. Ordinary client launches keep the normal splash screen.
204210

205211
Release artifacts use Maven coordinate
206-
`zone.moddev.mc.basemetals:BaseMetals:3.1.1.121111`.
212+
`zone.moddev.mc.basemetals:BaseMetals:3.1.2.121111`.
207213

208214
Report defects and compatibility problems through the
209215
[Base Metals issue tracker](https://github.com/MinecraftModDevelopmentMods/BaseMetals/issues).

‎docs/MIGRATION.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,12 @@ over an older backup.
135135
Chunk reading uses Minecraft's supported region formats. Empty region files
136136
are left alone, and backups include external chunk files when their region
137137
needs conversion.
138+
# Companion Migration Hooks
139+
140+
The local 3.1.2.121111 patch exposes `Legacy112MigrationExtension` for mods
141+
whose machine state must be preserved before Base Metals runs Minecraft's
142+
legacy chunk and player conversion. Register during common setup. The source
143+
payload is prepared before flattening, and extensions can restore their
144+
owned metadata states without replacing vanilla data fixes. The original
145+
world backup and migration markers remain in force.
146+

‎docs/VERSIONS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Supported versions
22

3-
Base Metals `3.1.1.121111` targets Minecraft 1.21.11, Forge 61.1.0 and Java 21.
3+
Base Metals `3.1.2.121111` targets Minecraft 1.21.11, Forge 61.1.0 and Java 21.
44
Packaged client, server and save-upgrade checks also pass on Forge 61.2.4.
55
OreSpawn `4.1.0.121111` is the exact build and test dependency. Clients and
66
servers need OreSpawn `[4.1.0.121111,5.0.0)`.
@@ -11,7 +11,7 @@ Its SHA-256 is
1111
`DE39929057288CEA110196C9E9D708E129B80BC360A2E53976337FFA6A84A67B`.
1212

1313
Release artifacts use Maven coordinate
14-
`zone.moddev.mc.basemetals:BaseMetals:3.1.1.121111`.
14+
`zone.moddev.mc.basemetals:BaseMetals:3.1.2.121111`.
1515

1616
The provider remains schema 3, revision 1. OreSpawn 4.1 is needed for the
1717
configuration-screen API; the provider's eleven rule IDs and 1.18 distributions

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ mod_name=Base Metals
6767
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
6868
mod_license=LGPL-2.1
6969
# The mod version. See https://semver.org/
70-
mod_version=3.1.1.121111
70+
mod_version=3.1.2.121111
7171
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
7272
# This should match the base package used for the mod sources.
7373
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

‎gradle/ide/eclipse.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def verifyEclipseProductionClasspath = tasks.register('verifyEclipseProductionCl
317317
}
318318
}
319319
String metadata = new File(projectDir, 'bin/main/META-INF/mods.toml').getText('UTF-8')
320-
if (metadata.contains('${') || !metadata.contains('version="3.1.1.121111"')) {
320+
if (metadata.contains('${') || !metadata.contains('version="3.1.2.121111"')) {
321321
throw new GradleException('Eclipse output contains unresolved or invalid Base Metals version metadata')
322322
}
323323
}

‎gradle/release/artifacts.gradle‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ tasks.register('verifyReleaseConfiguration') {
202202
dependsOn tasks.named('verifyMavenizerCompatibilityFixture')
203203
dependsOn tasks.named('verifyJava21Toolchain')
204204
doLast {
205-
if (configuredReleaseIdentity.modVersion != '3.1.1.121111'
205+
if (configuredReleaseIdentity.modVersion != '3.1.2.121111'
206206
|| configuredReleaseIdentity.modGroup != expectedMavenGroup
207207
|| configuredReleaseIdentity.minecraftVersion != '1.21.11'
208208
|| configuredReleaseIdentity.forgeVersion != '61.1.0'
@@ -326,7 +326,7 @@ tasks.register('verifyReleaseArtifacts') {
326326
}
327327
String modsToml = zip.getInputStream(zip.getEntry('META-INF/mods.toml')).getText('UTF-8')
328328
if (modsToml.contains('${')
329-
|| !modsToml.contains('version="3.1.1.121111"')
329+
|| !modsToml.contains('version="3.1.2.121111"')
330330
|| !modsToml.contains('versionRange="[4.1.0.121111,5.0.0)"')) {
331331
throw new GradleException('Release mods.toml contains unresolved or incompatible metadata')
332332
}

‎gradle/verification/packaged-runtime.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def packagedServerStartupSmoke = tasks.register('packagedServerStartupSmoke', Ex
174174
if (!marker.isFile()) throw new GradleException('Packaged dedicated-server completion marker is missing')
175175
Properties values = new Properties()
176176
marker.withInputStream { values.load(it) }
177-
if (values.getProperty('basemetals') != '3.1.1.121111'
177+
if (values.getProperty('basemetals') != '3.1.2.121111'
178178
|| values.getProperty('orespawn') != '4.1.0.121111'
179179
|| values.getProperty('forge') != '61.1.0') {
180180
throw new GradleException("Packaged dedicated-server versions are wrong: ${values}")
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package zone.moddev.mc.basemetals.api.migration;
2+
3+
import net.minecraft.nbt.CompoundTag;
4+
import net.minecraft.resources.Identifier;
5+
import net.minecraft.world.level.block.state.BlockState;
6+
import zone.moddev.mc.basemetals.migration.Legacy112WorldMigrator;
7+
8+
/** Preserves companion data before Base Metals converts a pre-flattening world. */
9+
public interface Legacy112MigrationExtension {
10+
enum Payload { CHUNK, PLAYER }
11+
12+
/** Mutates owned legacy data before vanilla fixes and the block-entity snapshot. */
13+
default boolean prepareData(CompoundTag tag, int dataVersion, Payload payload) { return false; }
14+
15+
/** Runs immediately before the intermediate chunk data fix. */
16+
default void beforeChunkFlattening(CompoundTag chunk) { }
17+
18+
/**
19+
* Restores owned data after vanilla reaches the 1.20.1 item schema, before
20+
* native item componentization. The prepared source is read-only; the
21+
* mutable result still stores historical Count/tag item payloads.
22+
*/
23+
default void afterPlayerFlattening(CompoundTag preparedSource, CompoundTag result) { }
24+
25+
/** Returns a native owned state, or null for an unowned registry ID. */
26+
default BlockState decodeBlockState(Identifier legacyId, int metadata) { return null; }
27+
28+
/** Register during common setup, before any world is opened. */
29+
static void register(Identifier id, Legacy112MigrationExtension extension) {
30+
Legacy112WorldMigrator.registerExtension(id, extension);
31+
}
32+
}

0 commit comments

Comments
 (0)