Skip to content

Support legacy save migration for XML machines - #115

Merged
dshadowwolf merged 2 commits into
master-2.0-1.21.1-neofrom
codex/xml-machine-entity-factory
Nov 18, 2026
Merged

dshadowwolf merged 2 commits into
master-2.0-1.21.1-neofrom
codex/xml-machine-entity-factory

Conversation

@faceofcat

Copy link
Copy Markdown
Collaborator

Steam Advantage and Electric Advantage need a way to keep existing machines readable when they move to XML. MMDLib previously constructed the final DefinedMachineEntity class for every XML machine, including when Minecraft loaded a block entity from disk.

Mods can now extend DefinedMachineEntity and register a constructor for a concrete XML machine ID with MachineContent.registerEntityFactory. Placement and world loading both use the registered constructor. A subclass can override migrateMachineData to translate legacy NBT before MMDLib restores storage and processor state. Client synchronization bypasses this hook.

The XML machine guide includes an example. Each consuming mod supplies its own key mappings and handles any renamed registry IDs.

Verification

All 14 focused porting GameTests passed locally. The new companion test covers placement, loading a synthetic legacy energy field through Minecraft’s block-entity registry, saving and reloading the current format, and client update handling. The machine import boundary and staged whitespace checks passed. Real Steam Advantage and Electric Advantage saves still need downstream validation.

@dshadowwolf dshadowwolf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review findings (read from the diff only; I did not run tests or the game). Only one minor point came up.

@dshadowwolf
dshadowwolf merged commit 3026dfa into master-2.0-1.21.1-neo Nov 18, 2026
5 checks passed
@faceofcat
faceofcat deleted the codex/xml-machine-entity-factory branch November 18, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants