Fixed potential log spam in disassembler. Closes #1107.

This commit is contained in:
Florian Nücke 2015-04-29 18:24:42 +02:00
parent 8b149e1df6
commit f78d5a4277
3 changed files with 7 additions and 7 deletions

View File

@ -117,5 +117,5 @@ object Loot extends WeightedRandomChestContent(new ItemStack(null: Item), 1, 1,
if (disks.length > 0)
ChestGenHooks.generateStacks(random, disks(random.nextInt(disks.length)),
theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem)
else Array.empty
else Array.empty[ItemStack]
}

View File

@ -39,7 +39,7 @@ class EEPROM extends prefab.ManagedEnvironment {
if (!node.tryChangeBuffer(-Settings.get.eepromWriteCost)) {
return result(Unit, "not enough energy")
}
val newData = args.optByteArray(0, Array.empty)
val newData = args.optByteArray(0, Array.empty[Byte])
if (newData.length > Settings.get.eepromSize) throw new IllegalArgumentException("not enough space")
codeData = newData
context.pause(2) // deliberately slow to discourage use as normal storage medium
@ -85,7 +85,7 @@ class EEPROM extends prefab.ManagedEnvironment {
if (!node.tryChangeBuffer(-Settings.get.eepromWriteCost)) {
return result(Unit, "not enough energy")
}
val newData = args.optByteArray(0, Array.empty)
val newData = args.optByteArray(0, Array.empty[Byte])
if (newData.length > Settings.get.eepromDataSize) throw new IllegalArgumentException("not enough space")
volatileData = newData
context.pause(1) // deliberately slow to discourage use as normal storage medium

View File

@ -55,7 +55,7 @@ object ItemUtils {
// we have no way of returning the fluid only (and I can't be arsed
// to make it output fluids into fluiducts or such, sorry).
!input.getItem.isInstanceOf[ItemBucket]).toArray
def getOutputSize(recipe: IRecipe) =
def getOutputSize(recipe: IRecipe): Double =
if (recipe != null && recipe.getRecipeOutput != null)
recipe.getRecipeOutput.stackSize
else
@ -69,11 +69,11 @@ object ItemUtils {
case Some(recipe: ShapelessRecipes) => getFilteredInputs(recipe.recipeItems.map(_.asInstanceOf[ItemStack]), getOutputSize(recipe))
case Some(recipe: ShapedOreRecipe) => getFilteredInputs(resolveOreDictEntries(recipe.getInput), getOutputSize(recipe))
case Some(recipe: ShapelessOreRecipe) => getFilteredInputs(resolveOreDictEntries(recipe.getInput), getOutputSize(recipe))
case _ => Array.empty
case _ => Array.empty[ItemStack]
}
// Avoid positive feedback loops.
if (ingredients.exists(ingredient => ingredient.isItemEqual(stack))) {
return Array.empty
return Array.empty[ItemStack]
}
// Merge equal items for size division by output size.
val merged = mutable.ArrayBuffer.empty[ItemStack]
@ -98,7 +98,7 @@ object ItemUtils {
catch {
case t: Throwable =>
OpenComputers.log.warn("Whoops, something went wrong when trying to figure out an item's parts.", t)
Array.empty
Array.empty[ItemStack]
}
private lazy val rng = new Random()