@@ -37,16 +37,6 @@ public void calculateProgress(MaterialNode node, long batches, EmiPlayerInventor
3737 calculateCost (node , batches * node .amount , ChanceState .DEFAULT , true );
3838 }
3939
40- public static boolean isCatalyst (EmiIngredient ing ) {
41- if (ing .getEmiStacks ().size () == 1 ) {
42- EmiStack stack = ing .getEmiStacks ().get (0 );
43- if (stack .equals (stack .getRemainder ())) {
44- return true ;
45- }
46- }
47- return false ;
48- }
49-
5040 private void addCost (EmiIngredient stack , long amount , long minBatch , ChanceState chance ) {
5141 if (chance .chanced ()) {
5242 if (chanceCosts .containsKey (stack )) {
@@ -170,15 +160,18 @@ private void calculateCost(MaterialNode node, long amount, ChanceState chance, b
170160 node .totalNeeded = 0 ;
171161 node .neededBatches = 0 ;
172162 }
163+ boolean catalyst = node .catalyst ;
164+ if (catalyst ) {
165+ amount = node .amount ;
166+ }
173167 EmiRecipe recipe = node .recipe ;
174- if (recipe instanceof EmiResolutionRecipe ) {
168+ if (recipe instanceof EmiResolutionRecipe err ) {
175169 calculateCost (node .children .get (0 ), amount , chance , trackProgress );
170+ if (catalyst ) {
171+ addRemainder (err .stack , amount , chance );
172+ }
176173 return ;
177174 }
178- boolean catalyst = isCatalyst (node .ingredient );
179- if (catalyst ) {
180- amount = node .amount ;
181- }
182175 long original = amount ;
183176 List <EmiStack > ingredientStacks = node .ingredient .getEmiStacks ();
184177 for (int i = 0 ; i < ingredientStacks .size (); i ++) {
@@ -229,7 +222,7 @@ private void calculateCost(MaterialNode node, long amount, ChanceState chance, b
229222
230223 for (MaterialNode n : node .children ) {
231224 if (!n .remainder .isEmpty () && n .remainderAmount > 0 ) {
232- if (isCatalyst ( n . ingredient ) ) {
225+ if (n . catalyst ) {
233226 addRemainder (n .remainder , n .remainderAmount , produced .consume (n .consumeChance ));
234227 } else {
235228 addRemainder (n .remainder , minBatches * n .remainderAmount , produced .consume (n .consumeChance ));
0 commit comments