44import com .gregtechceu .gtceu .api .capability .recipe .IRecipeCapabilityHolder ;
55import com .gregtechceu .gtceu .api .capability .recipe .RecipeCapability ;
66import com .gregtechceu .gtceu .api .machine .trait .RecipeHandlerGroup ;
7- import com .gregtechceu .gtceu .api .machine .trait .RecipeHandlerGroupDistinctness ;
87import com .gregtechceu .gtceu .api .machine .trait .RecipeHandlerList ;
98import com .gregtechceu .gtceu .api .recipe .chance .boost .ChanceBoostFunction ;
109import com .gregtechceu .gtceu .api .recipe .chance .logic .ChanceLogic ;
2019import java .util .List ;
2120import java .util .Map ;
2221
22+ import static com .gregtechceu .gtceu .api .machine .trait .RecipeHandlerGroupDistinctness .BUS_DISTINCT ;
23+ import static com .gregtechceu .gtceu .api .machine .trait .RecipeHandlerGroupDistinctness .BYPASS_DISTINCT ;
2324import static com .gregtechceu .gtceu .api .recipe .RecipeHelper .addToRecipeHandlerMap ;
2425
2526public class RecipeRunner {
@@ -121,21 +122,18 @@ private ActionResult handleContents() {
121122 addToRecipeHandlerMap (handler .getGroup (), handler , handlerGroups );
122123 }
123124 // Specifically check distinct handlers first
124- for (RecipeHandlerList handler : handlerGroups .getOrDefault (RecipeHandlerGroupDistinctness .BUS_DISTINCT ,
125- Collections .emptyList ())) {
125+ for (RecipeHandlerList handler : handlerGroups .getOrDefault (BUS_DISTINCT , Collections .emptyList ())) {
126126 // Handle the contents of this handler and also all the bypassed handlers
127127 var res = handler .handleRecipe (io , recipe , searchRecipeContents , true );
128- for (RecipeHandlerList bypassHandler : handlerGroups .getOrDefault (
129- RecipeHandlerGroupDistinctness .BYPASS_DISTINCT ,
128+ for (RecipeHandlerList bypassHandler : handlerGroups .getOrDefault (BYPASS_DISTINCT ,
130129 Collections .emptyList ())) {
131130 res = bypassHandler .handleRecipe (io , recipe , res , true );
132131 }
133132 if (res .isEmpty ()) {
134133 if (!simulated ) {
135134 // Actually consume the contents of this handler and also all the bypassed handlers
136135 recipeContents = handler .handleRecipe (io , recipe , recipeContents , false );
137- for (RecipeHandlerList bypassHandler : handlerGroups .getOrDefault (
138- RecipeHandlerGroupDistinctness .BYPASS_DISTINCT ,
136+ for (RecipeHandlerList bypassHandler : handlerGroups .getOrDefault (BYPASS_DISTINCT ,
139137 Collections .emptyList ())) {
140138 recipeContents = bypassHandler .handleRecipe (io , recipe , recipeContents , false );
141139 }
@@ -148,7 +146,7 @@ private ActionResult handleContents() {
148146 // Check the other groups. For every group, try consuming the ingredients,
149147 // see if it succeeds.
150148 for (Map .Entry <RecipeHandlerGroup , List <RecipeHandlerList >> handlerListEntry : handlerGroups .entrySet ()) {
151- if (handlerListEntry .getKey () == RecipeHandlerGroupDistinctness . BUS_DISTINCT ) continue ;
149+ if (handlerListEntry .getKey (). equals ( BUS_DISTINCT ) ) continue ;
152150
153151 // List to keep track of the remaining items for this RecipeHandlerGroup
154152 Map <RecipeCapability <?>, List <Object >> copiedRecipeContents = searchRecipeContents ;
@@ -162,9 +160,8 @@ private ActionResult handleContents() {
162160 }
163161 }
164162 // If we're already in the bypass_distinct group, don't check it twice.
165- if (handlerListEntry .getKey () != RecipeHandlerGroupDistinctness .BYPASS_DISTINCT ) {
166- for (RecipeHandlerList bypassHandler : handlerGroups .getOrDefault (
167- RecipeHandlerGroupDistinctness .BYPASS_DISTINCT ,
163+ if (!handlerListEntry .getKey ().equals (BYPASS_DISTINCT )) {
164+ for (RecipeHandlerList bypassHandler : handlerGroups .getOrDefault (BYPASS_DISTINCT ,
168165 Collections .emptyList ())) {
169166 copiedRecipeContents = bypassHandler .handleRecipe (io , recipe , copiedRecipeContents , true );
170167 if (copiedRecipeContents .isEmpty ()) {
@@ -189,9 +186,8 @@ private ActionResult handleContents() {
189186 }
190187 // Then go through the handlers that bypass the distinctness system and empty those
191188 // If we're already in the bypass_distinct group, don't check it twice.
192- if (handlerListEntry .getKey () != RecipeHandlerGroupDistinctness .BYPASS_DISTINCT ) {
193- for (RecipeHandlerList bypassHandler : handlerGroups .getOrDefault (
194- RecipeHandlerGroupDistinctness .BYPASS_DISTINCT ,
189+ if (!handlerListEntry .getKey ().equals (BYPASS_DISTINCT )) {
190+ for (RecipeHandlerList bypassHandler : handlerGroups .getOrDefault (BYPASS_DISTINCT ,
195191 Collections .emptyList ())) {
196192 copiedRecipeContents = bypassHandler .handleRecipe (io , recipe , copiedRecipeContents , false );
197193 if (copiedRecipeContents .isEmpty ()) {
0 commit comments