mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 03:05:30 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8
Conflicts: src/main/scala/li/cil/oc/util/ItemCosts.scala
This commit is contained in:
commit
1f0a00cf35
@ -168,7 +168,7 @@ object SaveHandler {
|
|||||||
val chunk = e.getChunk.getChunkCoordIntPair
|
val chunk = e.getChunk.getChunkCoordIntPair
|
||||||
val dimPath = new io.File(path, dimension.toString)
|
val dimPath = new io.File(path, dimension.toString)
|
||||||
val chunkPath = new io.File(dimPath, s"${chunk.chunkXPos}.${chunk.chunkZPos}")
|
val chunkPath = new io.File(dimPath, s"${chunk.chunkXPos}.${chunk.chunkZPos}")
|
||||||
if (chunkPath.exists && chunkPath.isDirectory) {
|
if (chunkPath.exists && chunkPath.isDirectory && chunkPath.list() != null) {
|
||||||
for (file <- chunkPath.listFiles() if System.currentTimeMillis() - file.lastModified() > TimeToHoldOntoOldSaves) file.delete()
|
for (file <- chunkPath.listFiles() if System.currentTimeMillis() - file.lastModified() > TimeToHoldOntoOldSaves) file.delete()
|
||||||
}
|
}
|
||||||
saveData.get(dimension) match {
|
saveData.get(dimension) match {
|
||||||
@ -209,7 +209,7 @@ object SaveHandler {
|
|||||||
// But that's really not something I'm bothered by, it's a fallback.
|
// But that's really not something I'm bothered by, it's a fallback.
|
||||||
def recurse(file: File) {
|
def recurse(file: File) {
|
||||||
file.setLastModified(System.currentTimeMillis())
|
file.setLastModified(System.currentTimeMillis())
|
||||||
if (file.isDirectory) file.listFiles().foreach(recurse)
|
if (file.exists() && file.isDirectory && file.list() != null) file.listFiles().foreach(recurse)
|
||||||
}
|
}
|
||||||
recurse(statePath)
|
recurse(statePath)
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ trait Buffered extends OutputStreamFileSystem {
|
|||||||
for (child <- directory.listFiles() if isValidFilename(child.getName)) {
|
for (child <- directory.listFiles() if isValidFilename(child.getName)) {
|
||||||
val childPath = path + child.getName
|
val childPath = path + child.getName
|
||||||
val childFile = new io.File(directory, child.getName)
|
val childFile = new io.File(directory, child.getName)
|
||||||
if (child.isDirectory) {
|
if (child.exists() && child.isDirectory && child.list() != null) {
|
||||||
recurse(childPath + "/", childFile)
|
recurse(childPath + "/", childFile)
|
||||||
}
|
}
|
||||||
else if (!exists(childPath) || !isDirectory(childPath)) {
|
else if (!exists(childPath) || !isDirectory(childPath)) {
|
||||||
|
@ -3,7 +3,7 @@ package li.cil.oc.server.fs
|
|||||||
import java.io
|
import java.io
|
||||||
|
|
||||||
trait FileInputStreamFileSystem extends InputStreamFileSystem {
|
trait FileInputStreamFileSystem extends InputStreamFileSystem {
|
||||||
protected val root: io.File
|
protected def root: io.File
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ trait FileInputStreamFileSystem extends InputStreamFileSystem {
|
|||||||
|
|
||||||
override def list(path: String) = new io.File(root, path) match {
|
override def list(path: String) = new io.File(root, path) match {
|
||||||
case file if file.exists() && file.isFile => Array(file.getName)
|
case file if file.exists() && file.isFile => Array(file.getName)
|
||||||
case directory if directory.exists() && directory.isDirectory =>
|
case directory if directory.exists() && directory.isDirectory && directory.list() != null =>
|
||||||
directory.listFiles().map(file => if (file.isDirectory) file.getName + "/" else file.getName)
|
directory.listFiles().map(file => if (file.isDirectory) file.getName + "/" else file.getName)
|
||||||
case _ => throw new io.FileNotFoundException("no such file or directory")
|
case _ => throw new io.FileNotFoundException("no such file or directory")
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,9 @@ object ItemCosts {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val recipes = CraftingManager.getInstance.getRecipeList.map(_.asInstanceOf[IRecipe])
|
val recipes = CraftingManager.getInstance.getRecipeList.map(_.asInstanceOf[IRecipe])
|
||||||
val recipe = recipes.find(recipe => recipe.getRecipeOutput != null && fuzzyEquals(stack, recipe.getRecipeOutput))
|
if (recipes == null) Iterable((stack, 1.0))
|
||||||
|
else {
|
||||||
|
val recipe = recipes.filter(_ != null).find(recipe => recipe.getRecipeOutput != null && fuzzyEquals(stack, recipe.getRecipeOutput))
|
||||||
val (ingredients, output) = recipe match {
|
val (ingredients, output) = recipe match {
|
||||||
case Some(recipe: ShapedRecipes) => (recipe.recipeItems.flatMap(accumulate(_, path :+ stack)).toIterable, recipe.getRecipeOutput.stackSize)
|
case Some(recipe: ShapedRecipes) => (recipe.recipeItems.flatMap(accumulate(_, path :+ stack)).toIterable, recipe.getRecipeOutput.stackSize)
|
||||||
case Some(recipe: ShapelessRecipes) => (recipe.recipeItems.flatMap(accumulate(_, path :+ stack)).toIterable, recipe.getRecipeOutput.stackSize)
|
case Some(recipe: ShapelessRecipes) => (recipe.recipeItems.flatMap(accumulate(_, path :+ stack)).toIterable, recipe.getRecipeOutput.stackSize)
|
||||||
@ -121,6 +123,7 @@ object ItemCosts {
|
|||||||
scaled
|
scaled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case list: java.util.List[ItemStack]@unchecked if !list.isEmpty =>
|
case list: java.util.List[ItemStack]@unchecked if !list.isEmpty =>
|
||||||
var result = Iterable.empty[(ItemStack, Double)]
|
var result = Iterable.empty[(ItemStack, Double)]
|
||||||
for (stack <- list if result.isEmpty) {
|
for (stack <- list if result.isEmpty) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user