Skip to content

Implement legacy data fixing via DataFixerUpper - #4875

Open
screret wants to merge 89 commits into
GregTechCEu:1.20.1from
screret:sc/datafixerupper-1.20
Open

screret wants to merge 89 commits into
GregTechCEu:1.20.1from
screret:sc/datafixerupper-1.20

Conversation

@screret

@screret screret commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

What

Add DFU-based data fixers as a replacement to manual legacy data conversion

Implementation Details

The implementation primarily lives in GTDataFixers and the gtceu.common.datafixer package, though some utilities are also in gtceu.api.datafixer.
CommonEventListener.remapIds was removed in favor of handling the same logic with data fixers, as was TagCompatibilityFixer.fixMachineAutoOutputTag.

AI Usage

  • No, AI driven tools were not used for this pull request.
  • Yes, AI driven tools were used for this pull request.

Outcome

Though initial setup may be more annoying, this PR provides considerably more stable legacy data conversion for the future.

How Was This Tested

I manually created a player inventory (carefully_crafted_inventory-dev-380df991-f603-344c-a090-369bad2a924a.zip) with since-renamed items in it and loaded it in a world to see how well upgrading works.
I also did /test runall a bunch to test upgrading blocks and block entities, as most of the structures have out-of-date data.

Additional Information

The GT data version field should be bumped with EVERY save data change, no matter how minor. Same goes for adding fixers. All machines should be registered into new schemas. Do NOT put all of them into V0.

Register new datafixers in GTDataFixers#addFixers. Remember to bump GTCEu.GT_DATA_VERSION in every PR that changes existing save data and add a schema & fixer for it here.

For changes that do not change named types or add new (block) entities, use SAME_NAMESPACED for the schema. Register machines (and other block entities) in a schema overriding Schema#registerBlockEntities.

Reference vanilla schemas for more information on that, examples named below. Also check how they're used in vanilla's DataFixers class.
net.minecraft.util.datafix.schemas.V1460, net.minecraft.util.datafix.schemas.V1906
Note how only fields that use other registered types (such as item/fluid stacks) are defined. The same should be done for all types.

Potential Compatibility Issues

The auto output trait fix might? be wrong, not sure. I couldn't really test it because I managed to corrupt my freshest testing world before I figured out how to fix the forge registry ID map.

@screret
screret requested a review from a team as a code owner May 27, 2026 13:52
Comment thread src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java Outdated
@gustovafing

Copy link
Copy Markdown
Member

Also, could you figure out the remainder of the datafixers that you didn't port yet.

@gustovafing

Copy link
Copy Markdown
Member

Also, will loading from a save without a defined data version run all the datafixers from the start?

@screret

screret commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Also, could you figure out the remainder of the datafixers that you didn't port yet.

Sure

@screret

screret commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Also, will loading from a save without a defined data version run all the datafixers from the start?

Yes, but it shouldn't matter as long as they're made to not interfere with already correct data.

Comment thread src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java Outdated
Comment thread src/main/java/com/gregtechceu/gtceu/common/data/datafixer/GTDataFixers.java Outdated
Comment thread src/main/java/com/gregtechceu/gtceu/GTCEu.java
@YoungOnionMC

Copy link
Copy Markdown
Member

can you move the turbine rotor item changes to a separate pr?

@screret

screret commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

can you move the turbine rotor item changes to a separate pr?

sure, but I'll need this PR to be merged ASAP in that case.

# Conflicts:
#	src/generated/resources/assets/gtceu/lang/en_ud.json
#	src/generated/resources/assets/gtceu/lang/en_us.json
#	src/main/java/com/gregtechceu/gtceu/common/CommonEventListener.java
#	src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/GTEMIPlugin.java

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants