add nullchecks to assembly tables
This commit is contained in:
parent
4ef1b06aaf
commit
e1bb073228
3 changed files with 13 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
package buildcraft.builders;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.TreeSet;
|
||||
|
|
|
@ -41,6 +41,10 @@ public class AssemblyRecipeManager implements IAssemblyRecipeManager {
|
|||
}
|
||||
|
||||
private void addRecipe(String id, IFlexibleRecipe<ItemStack> recipe) {
|
||||
if (recipe == null) {
|
||||
throw new RuntimeException("Recipe \"" + id + "\" is null!");
|
||||
}
|
||||
|
||||
if (assemblyRecipes.containsKey(id)) {
|
||||
throw new RuntimeException("Recipe \"" + id + "\" already registered");
|
||||
}
|
||||
|
|
|
@ -267,6 +267,10 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
|
|||
for (String recipeId : plannedOutput) {
|
||||
IFlexibleRecipe<ItemStack> recipe = AssemblyRecipeManager.INSTANCE.getRecipe(recipeId);
|
||||
|
||||
if (recipe == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recipe == currentRecipe) {
|
||||
takeNext = true;
|
||||
} else if (takeNext && recipe.canBeCrafted(this)) {
|
||||
|
@ -278,6 +282,10 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
|
|||
for (String recipeId : plannedOutput) {
|
||||
IFlexibleRecipe<ItemStack> recipe = AssemblyRecipeManager.INSTANCE.getRecipe(recipeId);
|
||||
|
||||
if (recipe == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recipe.canBeCrafted(this)) {
|
||||
setCurrentRecipe(recipe);
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue