Skip to content

Rename GTRegistry.remap() to .alias(), create a proper Remap, and make Aliases not break 1:1 key-value pairing#4934

Open
DilithiumThoride wants to merge 1 commit into
1.20.1from
dt/registry-remap
Open

Rename GTRegistry.remap() to .alias(), create a proper Remap, and make Aliases not break 1:1 key-value pairing#4934
DilithiumThoride wants to merge 1 commit into
1.20.1from
dt/registry-remap

Conversation

@DilithiumThoride

Copy link
Copy Markdown
Contributor

What

GTRegistry.remap() does not actually change key-value mappings. It creates a second key that maps to a single value, one-directionally. This breaks the 1:1 Key-Value pairing assumption present in the other registry functions, and (among other things) causes .remove() to break again.

Implementation Details

I do not like this but it feels necessary.
Created an additional Map<K, K>, where the first key is an Alias and the second key is a real key within the main KeyToValue map. Aliases are added to this map and can then be used as if they were normal keys. This created a lot more boilerplate than I'd like, and potentially several O(n) actions if we ever wind up with a ton of aliases registered.

I am also uncertain if I also need to create an additional static class and CODEC for this third map.

AI Usage

  • [ X ] No AI driven tools were used for this pull request.

Outcome

.remap() actually remaps and doesn't break .remove(). .alias() does what .remap() used to do. Every .get() and .remove() call now also checks for Aliases existing. 1:1 Key-Value is restored.

How Was This Tested

standard game tests passed, Client 1 loaded into SSP + connected to Server SMP, nothing crashed or broke, and I don't see any registry warns or errors

Potential Compatibility Issues

.alias() exists effectively entirely for migration compatibility; the only case of it in the main code base exists to register Rock Breaker conditions as also being Fluid Recipe conditions. If anything this fixes a potential future compatibility issue by fixing the way .remove() broke on .remap()

(Should this change go into migration docs somewhere? If so, where?)

@DilithiumThoride DilithiumThoride added the type: refactor Suggestion to refactor a section of code label Jun 16, 2026
@DilithiumThoride DilithiumThoride requested a review from a team as a code owner June 16, 2026 05:30
@DilithiumThoride DilithiumThoride added type: bugfix General bug fixes 1.20.1 Release: Patch - 0.0.X Smaller changes that either are bug fixes or very minor tweaks. labels Jun 16, 2026
@github-actions github-actions Bot added the Tests: Passed Game Tests have passed on this PR label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.20.1 Release: Patch - 0.0.X Smaller changes that either are bug fixes or very minor tweaks. Tests: Passed Game Tests have passed on this PR type: bugfix General bug fixes type: refactor Suggestion to refactor a section of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant