@@ -170,7 +170,7 @@ public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IR
170
170
public void addShapeless (IItemStack output , IIngredient [] ingredients , IRecipeFunction function , IRecipeAction action ) {
171
171
if (checkShapelessNulls (output , ingredients ))
172
172
return ;
173
-
173
+
174
174
recipesToAdd .add (new ActionAddShapelessRecipe (output , ingredients , function , action ));
175
175
}
176
176
@@ -267,7 +267,7 @@ public IItemStack craft(IItemStack[][] contents) {
267
267
return getIItemStack (result );
268
268
}
269
269
}
270
-
270
+
271
271
public abstract static class ActionBaseRemoveRecipes implements IUndoableAction {
272
272
public abstract boolean matches (IRecipe r );
273
273
public abstract Set <IRecipe > find ();
@@ -284,7 +284,7 @@ public static class ActionRemoveRecipesNoIngredients extends ActionBaseRemoveRec
284
284
public void addOutput (IIngredient output , @ Optional boolean nbtMatch ) {
285
285
outputs .add (Pair .of (output , nbtMatch ));
286
286
}
287
-
287
+
288
288
public void clearOutputs () {
289
289
outputs .clear ();
290
290
}
@@ -350,13 +350,13 @@ private boolean matches(IItemStack stack) {
350
350
}
351
351
352
352
}
353
-
353
+
354
354
public static class ActionRemoveShapelessRecipes extends ActionBaseRemoveRecipes implements IUndoableAction {
355
355
final IIngredient output ;
356
356
final IIngredient [] ingredients ;
357
357
final boolean wildcard ;
358
358
Set <IRecipe > toRemove = new HashSet <>();
359
-
359
+
360
360
public ActionRemoveShapelessRecipes (IIngredient output , IIngredient [] ingredients , boolean wildcard ) {
361
361
this .output = output ;
362
362
this .ingredients = ingredients ;
@@ -434,7 +434,7 @@ public Set<IRecipe> find() {
434
434
public void apply () {
435
435
toRemove = find ();
436
436
MineTweakerAPI .logInfo ("Removing " + toRemove .size () + " Shapeless recipes." );
437
- super .removeRecipes (toRemove );
437
+ super .removeRecipes (toRemove );
438
438
}
439
439
440
440
@ Override
@@ -468,7 +468,7 @@ public Object getOverrideKey() {
468
468
return null ;
469
469
}
470
470
}
471
-
471
+
472
472
public static class ActionRemoveShapedRecipes extends ActionBaseRemoveRecipes implements IUndoableAction {
473
473
final IIngredient output ;
474
474
final IIngredient [][] ingredients ;
@@ -548,7 +548,7 @@ public void apply() {
548
548
toRemove = find ();
549
549
550
550
MineTweakerAPI .logInfo (toRemove .size () + " removed" );
551
- super .removeRecipes (toRemove );
551
+ super .removeRecipes (toRemove );
552
552
}
553
553
554
554
@ Override
@@ -582,20 +582,20 @@ public Object getOverrideKey() {
582
582
return null ;
583
583
}
584
584
}
585
-
585
+
586
586
public static class ActionBaseAddRecipe implements IUndoableAction {
587
587
private final IRecipe iRecipe ;
588
588
private final ICraftingRecipe craftingRecipe ;
589
-
589
+
590
590
protected final IItemStack output ;
591
591
protected final boolean isShaped ;
592
592
protected final boolean isRestoring ;
593
-
593
+
594
594
private ActionBaseAddRecipe (IRecipe iRecipe ) {
595
595
this .iRecipe = iRecipe ;
596
596
this .craftingRecipe = null ;
597
597
this .isRestoring = true ;
598
-
598
+
599
599
this .isShaped = iRecipe instanceof ShapedRecipes ;
600
600
this .output = new MCItemStack (iRecipe .getRecipeOutput ());
601
601
}
@@ -604,10 +604,10 @@ private ActionBaseAddRecipe(ICraftingRecipe craftingRecipe, IItemStack output, b
604
604
this .iRecipe = RecipeConverter .convert (craftingRecipe );
605
605
this .craftingRecipe = craftingRecipe ;
606
606
this .isRestoring = false ;
607
-
607
+
608
608
this .output = output ;
609
609
this .isShaped = isShaped ;
610
-
610
+
611
611
}
612
612
613
613
@ Override
@@ -639,7 +639,7 @@ public String describe() {
639
639
640
640
@ Override
641
641
public String describeUndo () {
642
- return "Undoing addition of " + output .getDisplayName ();
642
+ return "Undoing addition of " + ( output != null ? output .getDisplayName () : "invalid output" );
643
643
}
644
644
645
645
@ Override
@@ -653,7 +653,7 @@ public ActionAddShapedRecipe(IItemStack output, IIngredient[][] ingredients, IRe
653
653
super (new ShapedRecipe (output , ingredients , function , action , mirrored ), output , true );
654
654
}
655
655
}
656
-
656
+
657
657
private static class ActionAddShapelessRecipe extends ActionBaseAddRecipe {
658
658
public ActionAddShapelessRecipe (IItemStack output , IIngredient [] ingredients , IRecipeFunction function , IRecipeAction action ) {
659
659
super (new ShapelessRecipe (output , ingredients , function , action ), output , false );
@@ -698,7 +698,7 @@ public Object getOverrideKey() {
698
698
return null ;
699
699
}
700
700
}
701
-
701
+
702
702
public static void applyAdditionsAndRemovals () {
703
703
System .out .println ("MineTweaker: Applying additions and removals" );
704
704
MineTweakerAPI .apply (MCRecipeManager .actionRemoveRecipesNoIngredients );
@@ -722,7 +722,7 @@ public static void applyAdditionsAndRemovals() {
722
722
recipesToRemove .forEach (ActionBaseRemoveRecipes ::apply );
723
723
}
724
724
MCRecipeManager .recipesToAdd .forEach (MineTweakerAPI ::apply );
725
-
725
+
726
726
actionRemoveRecipesNoIngredients .clearOutputs ();
727
727
recipesToRemove .clear ();;
728
728
recipesToAdd .clear ();
0 commit comments