Skip to content

Use holders for GT content registration on 1.21 - #5358

Open
gustovafing wants to merge 39 commits into
1.21from
gus/use-holders-1.21
Open

Use holders for GT content registration on 1.21#5358
gustovafing wants to merge 39 commits into
1.21from
gus/use-holders-1.21

Conversation

@gustovafing

@gustovafing gustovafing commented Aug 29, 2026

Copy link
Copy Markdown
Member

What

Wraps GT content registration in deferred holders, for everything except machines, material system stuff and recipe stuff (they will be handled in seperate PRs each).
No AI

@gustovafing gustovafing added 1.21.1 ignore changelog PR should not be added to the changelog. type: refactor Suggestion to refactor a section of code Release: API - X.0.0 Major Breaking Refactors that MUST be in a API-Breaking Release Ignore Version Sync Do not append this issue to the version sync issue tracker. labels Aug 29, 2026
@github-actions github-actions Bot added 1.21 Tests: Passed Game Tests have passed on this PR labels Aug 29, 2026
# Conflicts:
#	src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/DimensionFilter.java
#	src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/FrequencyModifier.java
#	src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java
#	src/main/java/com/gregtechceu/gtceu/common/data/GTFeatures.java
#	src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/BiomeDependentPlacement.java
#	src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/RubberTreeChancePlacement.java
#	src/main/java/com/gregtechceu/gtceu/data/loot/ChestGenHooks.java
#	src/test/java/com/gregtechceu/gtceu/gametest/world/RealWorldItemUsage.java
@gustovafing
gustovafing marked this pull request as ready for review August 31, 2026 01:12
@gustovafing
gustovafing requested a review from a team as a code owner August 31, 2026 01:12
gustovafing and others added 2 commits August 31, 2026 17:54
# Conflicts:
#	src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java
#	src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java
#	src/main/java/com/gregtechceu/gtceu/common/data/GTSoundEntries.java
#	src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java
@github-actions github-actions Bot added Tests: Failed Game Tests have failed on this PR and removed Tests: Passed Game Tests have passed on this PR labels Sep 5, 2026
@github-actions github-actions Bot added Tests: Passed Game Tests have passed on this PR and removed Tests: Failed Game Tests have failed on this PR labels Sep 5, 2026

@htmlcsjs htmlcsjs left a comment

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.

I have read though the code and tested some stuff ingame, admitidly alot of it went over my head but i would appreciate someone else looking through this

* @apiNote DO NOT REGISTER ANY OF YOUR OWN CONTENT HERE, AS IF YOU DO, IT'LL REGISTER AS IF GTCEu REGISTERED IT
* AND YOUR DATAGEN AND EVENTS WILL <b><i>NOT</i></b> WORK AS EXPECTED, IF AT ALL.
*/
void gtInitComplete();

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.

Why was this deleted?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

GT is loaded before addons are, so any addon code will always run after GT initialisation.

public class GTIngredientTypes {

public static final DeferredRegister<IngredientType<?>> ITEM_INGREDIENT_TYPES = DeferredRegister
private static final DeferredRegister<IngredientType<?>> ITEM_INGREDIENT_TYPES = DeferredRegister

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.

Why change the visibilities of these

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These should be private since they are only used for registration within this file, other mods shouldn't use these.

private static final DeferredRegister<IngredientType<?>> ITEM_INGREDIENT_TYPES = DeferredRegister
.create(NeoForgeRegistries.INGREDIENT_TYPES, GTCEu.MOD_ID);
public static final DeferredRegister<FluidIngredientType<?>> FLUID_INGREDIENT_TYPES = DeferredRegister
private static final DeferredRegister<FluidIngredientType<?>> FLUID_INGREDIENT_TYPES = DeferredRegister

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.

same here

}

public static void init() {
PlaceholderHandler.addPlaceholder(new Placeholder("ae2itemCount") {

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.

Does the change from camelCase to snake_case here break preexisting monitors?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It will, but that's not really a big concern on 1.21

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

Labels

1.21 1.21.1 ignore changelog PR should not be added to the changelog. Ignore Version Sync Do not append this issue to the version sync issue tracker. 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.

2 participants