mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Fix potential division by zero in loot disk cycling recipe.
This commit is contained in:
parent
650ee2c45d
commit
32ab472370
@ -15,10 +15,10 @@ class LootDiskCyclingRecipe extends IRecipe {
|
||||
}
|
||||
|
||||
override def getCraftingResult(crafting: InventoryCrafting): ItemStack = {
|
||||
val lootDiskStacks = Loot.worldDisks.map(_._1)
|
||||
collectStacks(crafting).find(Loot.isLootDisk) match {
|
||||
case Some(lootDisk) =>
|
||||
case Some(lootDisk) if lootDiskStacks.nonEmpty =>
|
||||
val lootFactoryName = getLootFactoryName(lootDisk)
|
||||
val lootDiskStacks = Loot.worldDisks.map(_._1)
|
||||
val oldIndex = lootDiskStacks.indexWhere(s => getLootFactoryName(s) == lootFactoryName)
|
||||
val newIndex = (oldIndex + 1) % lootDiskStacks.length
|
||||
lootDiskStacks(newIndex).copy()
|
||||
|
Loading…
x
Reference in New Issue
Block a user