mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Fixed potential log spam in disassembler. Closes #1107.
This commit is contained in:
parent
8b149e1df6
commit
f78d5a4277
@ -117,5 +117,5 @@ object Loot extends WeightedRandomChestContent(new ItemStack(null: Item), 1, 1,
|
|||||||
if (disks.length > 0)
|
if (disks.length > 0)
|
||||||
ChestGenHooks.generateStacks(random, disks(random.nextInt(disks.length)),
|
ChestGenHooks.generateStacks(random, disks(random.nextInt(disks.length)),
|
||||||
theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem)
|
theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem)
|
||||||
else Array.empty
|
else Array.empty[ItemStack]
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class EEPROM extends prefab.ManagedEnvironment {
|
|||||||
if (!node.tryChangeBuffer(-Settings.get.eepromWriteCost)) {
|
if (!node.tryChangeBuffer(-Settings.get.eepromWriteCost)) {
|
||||||
return result(Unit, "not enough energy")
|
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")
|
if (newData.length > Settings.get.eepromSize) throw new IllegalArgumentException("not enough space")
|
||||||
codeData = newData
|
codeData = newData
|
||||||
context.pause(2) // deliberately slow to discourage use as normal storage medium
|
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)) {
|
if (!node.tryChangeBuffer(-Settings.get.eepromWriteCost)) {
|
||||||
return result(Unit, "not enough energy")
|
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")
|
if (newData.length > Settings.get.eepromDataSize) throw new IllegalArgumentException("not enough space")
|
||||||
volatileData = newData
|
volatileData = newData
|
||||||
context.pause(1) // deliberately slow to discourage use as normal storage medium
|
context.pause(1) // deliberately slow to discourage use as normal storage medium
|
||||||
|
@ -55,7 +55,7 @@ object ItemUtils {
|
|||||||
// we have no way of returning the fluid only (and I can't be arsed
|
// 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).
|
// to make it output fluids into fluiducts or such, sorry).
|
||||||
!input.getItem.isInstanceOf[ItemBucket]).toArray
|
!input.getItem.isInstanceOf[ItemBucket]).toArray
|
||||||
def getOutputSize(recipe: IRecipe) =
|
def getOutputSize(recipe: IRecipe): Double =
|
||||||
if (recipe != null && recipe.getRecipeOutput != null)
|
if (recipe != null && recipe.getRecipeOutput != null)
|
||||||
recipe.getRecipeOutput.stackSize
|
recipe.getRecipeOutput.stackSize
|
||||||
else
|
else
|
||||||
@ -69,11 +69,11 @@ object ItemUtils {
|
|||||||
case Some(recipe: ShapelessRecipes) => getFilteredInputs(recipe.recipeItems.map(_.asInstanceOf[ItemStack]), getOutputSize(recipe))
|
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: ShapedOreRecipe) => getFilteredInputs(resolveOreDictEntries(recipe.getInput), getOutputSize(recipe))
|
||||||
case Some(recipe: ShapelessOreRecipe) => 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.
|
// Avoid positive feedback loops.
|
||||||
if (ingredients.exists(ingredient => ingredient.isItemEqual(stack))) {
|
if (ingredients.exists(ingredient => ingredient.isItemEqual(stack))) {
|
||||||
return Array.empty
|
return Array.empty[ItemStack]
|
||||||
}
|
}
|
||||||
// Merge equal items for size division by output size.
|
// Merge equal items for size division by output size.
|
||||||
val merged = mutable.ArrayBuffer.empty[ItemStack]
|
val merged = mutable.ArrayBuffer.empty[ItemStack]
|
||||||
@ -98,7 +98,7 @@ object ItemUtils {
|
|||||||
catch {
|
catch {
|
||||||
case t: Throwable =>
|
case t: Throwable =>
|
||||||
OpenComputers.log.warn("Whoops, something went wrong when trying to figure out an item's parts.", t)
|
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()
|
private lazy val rng = new Random()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user