Skip to content

Remove material manager and merge addon material registries into single unified material registry#4816

Open
gustovafing wants to merge 10 commits into1.20.1from
gus/material-registry
Open

Remove material manager and merge addon material registries into single unified material registry#4816
gustovafing wants to merge 10 commits into1.20.1from
gus/material-registry

Conversation

@gustovafing
Copy link
Copy Markdown
Member

What

Removes the material manager and associated classes.
Instead of having a Registry<String, Material> for each addon, there is a single global Registry<ResourceLocation, Material>.

Implementation Details

Any addon devs should remove their own material registry creation and just use the static GTRegistries.MATERIALS.
Addon/Modpack devs should rename any references to GTCEuAPI.materialManager with GTRegistries.MATERIALS.

@gustovafing gustovafing requested a review from a team as a code owner May 1, 2026 10:15
@gustovafing gustovafing added type: refactor Suggestion to refactor a section of code 1.20.1 Release: API - X.0.0 Major Breaking Refactors that MUST be in a API-Breaking Release labels May 1, 2026
@github-actions github-actions Bot added the Tests: Passed Game Tests have passed on this PR label May 1, 2026
Comment on lines +30 to +36
if (name.contains(":")) {
ResourceLocation resLoc = ResourceLocation.tryParse(name);
if (resLoc == null) return GTMaterials.NULL;
return get(resLoc);
} else {
return get(GTCEu.id(name));
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about:

ResourceLocation resLoc = ResourceLocation.tryParse(name);
if (resLoc == null) {
    return get(GTCEu.id(name));
}
return get(resLoc);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that'll give minecraft:<name> for valid resource locations, which is. not ideal.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, doesn't GTCEu.java have a method named appendId that does exactly this?

Comment thread src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java Outdated
Comment thread src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java
Comment thread src/main/java/com/gregtechceu/gtceu/common/CommonEventListener.java
Comment thread src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java Outdated
Comment thread src/main/java/com/gregtechceu/gtceu/data/lang/MaterialLangGenerator.java Outdated
Comment thread src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.20.1 Release: API - X.0.0 Major Breaking Refactors that MUST be in a API-Breaking Release Tests: Passed Game Tests have passed on this PR type: refactor Suggestion to refactor a section of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants