diff --git a/src/main/resources/assets/opencomputers/recipes/default.recipes b/src/main/resources/assets/opencomputers/recipes/default.recipes index fde7bb50f..4d51eb9e8 100644 --- a/src/main/resources/assets/opencomputers/recipes/default.recipes +++ b/src/main/resources/assets/opencomputers/recipes/default.recipes @@ -32,12 +32,12 @@ wrench { } lootdisks: [ { - name: "OpenComputers:openos" + name: "opencomputers:openos" type: shapeless input: ["oc:floppy", "oc:manual"] }, { - name: "OpenComputers:oppm" + name: "opencomputers:oppm" type: shapeless input: ["oc:floppy", "oc:materialInterweb"] } diff --git a/src/main/scala/li/cil/oc/common/recipe/ColorizeRecipe.scala b/src/main/scala/li/cil/oc/common/recipe/ColorizeRecipe.scala index ec7dd8d5a..9105a9e8c 100644 --- a/src/main/scala/li/cil/oc/common/recipe/ColorizeRecipe.scala +++ b/src/main/scala/li/cil/oc/common/recipe/ColorizeRecipe.scala @@ -22,7 +22,7 @@ class ColorizeRecipe(target: Item, source: Array[Item] = null) extends Container override def matches(crafting: InventoryCrafting, world: World): Boolean = { val stacks = (0 until crafting.getSizeInventory).flatMap(i => Option(crafting.getStackInSlot(i))) val targets = stacks.filter(stack => sourceItems.contains(stack.getItem) || stack.getItem == targetItem) - val other = stacks.filterNot(targets.contains) + val other = stacks.filterNot(stack => stack.isEmpty || targets.contains(stack)) targets.size == 1 && other.nonEmpty && other.forall(Color.isDye) } @@ -37,7 +37,7 @@ class ColorizeRecipe(target: Item, source: Array[Item] = null) extends Container || stack.getItem == targetItem) { targetStack = stack.copy() targetStack.setCount(1) - } else { + } else if(!stack.isEmpty) { val dye = Color.findDye(stack) if (dye.isEmpty) return ItemStack.EMPTY diff --git a/src/main/scala/li/cil/oc/common/recipe/DecolorizeRecipe.scala b/src/main/scala/li/cil/oc/common/recipe/DecolorizeRecipe.scala index f26e965a5..b067f1b5e 100644 --- a/src/main/scala/li/cil/oc/common/recipe/DecolorizeRecipe.scala +++ b/src/main/scala/li/cil/oc/common/recipe/DecolorizeRecipe.scala @@ -19,7 +19,7 @@ class DecolorizeRecipe(target: Item) extends ContainerItemAwareRecipe { override def matches(crafting: InventoryCrafting, world: World): Boolean = { val stacks = (0 until crafting.getSizeInventory).flatMap(i => Option(crafting.getStackInSlot(i))) val targets = stacks.filter(stack => stack.getItem == targetItem) - val other = stacks.filterNot(targets.contains) + val other = stacks.filterNot(stack => stack.isEmpty || targets.contains(stack)) targets.size == 1 && other.size == 1 && other.forall(_.getItem == Items.WATER_BUCKET) } @@ -30,7 +30,7 @@ class DecolorizeRecipe(target: Item) extends ContainerItemAwareRecipe { if (stack.getItem == targetItem) { targetStack = stack.copy() targetStack.setCount(1) - } else if (stack.getItem != Items.WATER_BUCKET) { + } else if (!stack.isEmpty && stack.getItem != Items.WATER_BUCKET) { return ItemStack.EMPTY } } diff --git a/src/main/scala/li/cil/oc/common/recipe/LootDiskCyclingRecipe.scala b/src/main/scala/li/cil/oc/common/recipe/LootDiskCyclingRecipe.scala index 1793944a8..7922ff44b 100644 --- a/src/main/scala/li/cil/oc/common/recipe/LootDiskCyclingRecipe.scala +++ b/src/main/scala/li/cil/oc/common/recipe/LootDiskCyclingRecipe.scala @@ -14,7 +14,7 @@ import scala.collection.immutable class LootDiskCyclingRecipe extends IRecipe { override def matches(crafting: InventoryCrafting, world: World): Boolean = { val stacks = collectStacks(crafting).toArray - stacks.length == 2 && stacks.exists(Loot.isLootDisk) && stacks.exists(Wrench.isWrench) + stacks.count(!_.isEmpty) == 2 && stacks.exists(Loot.isLootDisk) && stacks.exists(Wrench.isWrench) } override def getCraftingResult(crafting: InventoryCrafting): ItemStack = { diff --git a/src/main/scala/li/cil/oc/common/recipe/Recipes.scala b/src/main/scala/li/cil/oc/common/recipe/Recipes.scala index e2c8f4a9e..304a3d71c 100644 --- a/src/main/scala/li/cil/oc/common/recipe/Recipes.scala +++ b/src/main/scala/li/cil/oc/common/recipe/Recipes.scala @@ -169,8 +169,8 @@ object Recipes { } // Register all unknown recipes. Well. Loot disk recipes. - if (recipes.hasPath("lootDisks")) try { - val lootRecipes = recipes.getConfigList("lootDisks") + if (recipes.hasPath("lootdisks")) try { + val lootRecipes = recipes.getConfigList("lootdisks") val lootStacks = Loot.globalDisks.map(_._1) for (recipe <- lootRecipes) { val name = recipe.getString("name")