Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data fixers for the post-1.20.1 world(s) #1749

Closed
SquidDev opened this issue Mar 16, 2024 · 3 comments
Closed

Data fixers for the post-1.20.1 world(s) #1749

SquidDev opened this issue Mar 16, 2024 · 3 comments
Labels
area-Minecraft This affects CC's Minecraft-specific content. enhancement An extension of a feature or a new feature. help wanted I haven't got the knowledge or time to work on this.

Comments

@SquidDev
Copy link
Member

SquidDev commented Mar 16, 2024

Every version, the way Minecraft stores game data (such as blocks and items) changes slightly. For instance, post 1.20.1 (the current version CC:T targets):

  • Minecraft 1.20.2, changes how potions store their effects.
  • Minecraft 1.20.5, removes item NBT entirely, migrating it to a more structured component-based system.

Minecraft handles this migration by using the DFU library. However, CC: Tweaked (like most mods), does not hook into it - DFU doesn't really have good support for mods (Mojang/DataFixerUpper#80), and (AFAIK) mod loaders have deemed adding support too complex to be worth it.

This is a problem for CC: Tweaked, as it means that worlds cannot be migrated between versions (or at least, not without some data loss).

It's not entirely clear what should be done here. At a bare-minimum, we should mixin to Minecraft's existing data-fixers, and register CC:T's block entities as inventories - this at least ensures items inside turtles (and disk drives and printers) will be migrated.

I'm less sure what to do about 1.20.5's components. I've not actually looked at how data-fixers for that are implemented - it may be quite simple to hook into as well, but failing that we can probably convert NBT on-the-fly, reading out of the custom_nbt component and adding our custom one instead.

Turtle/pocket computer upgrades are a bit tricky here. Upgrade data may store item NBT which we'd want to migrate, but because it's currently unstructured, we can't automatically do so. Ideally we'd be able to expose data fixers for upgrade data too, but I don't think that's really possible :(. Maybe time to revisit #903?

@SquidDev SquidDev added enhancement An extension of a feature or a new feature. help wanted I haven't got the knowledge or time to work on this. area-Minecraft This affects CC's Minecraft-specific content. labels Mar 16, 2024
@SirEdvin
Copy link
Contributor

Minecraft 1.20.5, removes item NBT entirely, migrating it to a more structured component-based system.

No-no-no-no-no-no-no-no-no-no-no-no-no-no-no-no-no

@SquidDev
Copy link
Member Author

It's honestly a really cool system - I'm assuming block entities will be migrating to something similar at some point. But yes, also a nightmare for every mod.

@SquidDev
Copy link
Member Author

Okay, looked at a 1.20.5 workspace, and this actually looks fairly manageable. I think we can do the following:

1.20.4

Mixin to V1460 on 1.20.4 to register all of CC:T's inventories in DFU.

1.20.5

  • Replace turtle/pocket computer upgrade data with a bundle of components (so same as item stacks have). This makes future integration with DFU easier, and saves us having to implement our own data type.
  • Mixin to the 1.20.5 schema to register left/right upgrade components, and the 1.20.5 datafixer to migrate everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Minecraft This affects CC's Minecraft-specific content. enhancement An extension of a feature or a new feature. help wanted I haven't got the knowledge or time to work on this.
Projects
None yet
Development

No branches or pull requests

2 participants