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

Item Material Information Refactor #2591

Open
wants to merge 37 commits into
base: 1.20.1
Choose a base branch
from

Conversation

YoungOnionMC
Copy link
Member

@YoungOnionMC YoungOnionMC commented Dec 19, 2024

What

Overhauls and breaks apart the various methods of ChemicalHelper into material related functions and the new ItemMaterialInfo methods, also renames UnificationEntry to the more suitable MaterialEntry.
Removes most of MaterialInfoLoader in favor of the more procedural method of generating item material stacks as mentioned in GTRecipeBuilder

Additional Information

GTRecipeBuilders now temporarily store all MaterialStack information for use in item decomposition information for recycling recipes if desired
Item decomposition material information also no longer depends on recipe order for material computation (ex needing to register iron plate decomp before iron furnace decomp)
GTRecipeBuilder allows for fluid inputs using a Material and amount instead of just the FluidStack if desired

Potential Incompatibilities

KubeJS recipes should be fine out of the box, just need to use the addMaterialInfo helper method if they want added decomp

YoungOnionMC and others added 14 commits December 18, 2024 16:38
# Conflicts:
#	src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java
#	src/main/java/com/gregtechceu/gtceu/api/recipe/ToolHeadReplaceRecipe.java
#	src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java
#	src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java
#	src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeAddition.java
#	src/main/java/com/gregtechceu/gtceu/data/recipe/misc/GCYMRecipes.java
#	src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java
#	src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java
#	src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java
…o yo/material-decomp-refactor

# Conflicts:
#	src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java
#	src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComputerRecipes.java
#	src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java
@YoungOnionMC YoungOnionMC marked this pull request as ready for review December 22, 2024 10:41
@YoungOnionMC YoungOnionMC requested a review from a team as a code owner December 22, 2024 10:41
@YoungOnionMC YoungOnionMC added Do Not Merge DO NOT MERGE THIS PR YET! type: refactor Suggestion to refactor a section of code labels Jan 4, 2025
Copy link
Member

@stanieldev stanieldev left a comment

Choose a reason for hiding this comment

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

I see no true issues for final commit, but I would definitely like some if statement blocks to be unwrapped and inverted for clarity for statement guarding.

I'll eventually get around to writing more JavaDocs when I don't think I'm gonna fail getting my degree because of capstone 😭

… into yo/material-decomp-refactor

# Conflicts:
#	src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeAddition.java
#	src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CraftingRecipeLoader.java
#	src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java
Copy link
Member

@screret screret left a comment

Choose a reason for hiding this comment

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

its fine ig
wait for someone to do a thorough review though, I just read changes from last review

Copy link
Contributor

@omergunr100 omergunr100 left a comment

Choose a reason for hiding this comment

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

logic looks good but run spotlessApply

@omergunr100
Copy link
Contributor

wrong pr

Copy link
Contributor

@omergunr100 omergunr100 left a comment

Choose a reason for hiding this comment

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

you missed a unification entry so the build is failing.

we also need to try and replace those concurrent collections in ItemMaterialData with fast ones and see if it breaks.

Copy link
Contributor

@krossgg krossgg left a comment

Choose a reason for hiding this comment

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

I want to look over all the streams too - there's a lot of long/nested ones that could probably be simplified. Will do it whenever I get on my pc.

Can you do more extensive testing with and without kube and make sure we didn't need those concurrent maps?

@krossgg krossgg added Merge on Major Release Breaking changes, must be bundled into an 1.X.0 Update and removed Do Not Merge DO NOT MERGE THIS PR YET! labels Mar 5, 2025
Copy link
Contributor

@omergunr100 omergunr100 left a comment

Choose a reason for hiding this comment

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

I can't mark the line in this review since the file hasn't been changed, but look at MaterialStack.isEmpty() it checks if the material is air, air is a valid material it should be GTMaterials.NULL imo.

Also consider adding an empty material stack to MaterialStack:

public static final MaterialStack EMPTY = new MaterialStack(GTMaterials.NULL, 0);

that way we could make all the material stack helper methods @NotNull and replace all the materialStack.material() == GTMaterial.Null checks with materialStack.isEmpty() which makes more sense and is easier to work with imo.

…aterial-decomp-refactor

# Conflicts:
#	src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge on Major Release Breaking changes, must be bundled into an 1.X.0 Update type: refactor Suggestion to refactor a section of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants