mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-27 23:14:23 -04:00
Merge branch 'master' of https://github.com/MightyPirates/OpenComputers into MC1.7
This commit is contained in:
commit
e1ab023fa0
@ -24,6 +24,19 @@ object SaveHandler {
|
|||||||
|
|
||||||
def load(dimension: Int, chunk: ChunkCoordIntPair, name: String): Array[Byte] = {
|
def load(dimension: Int, chunk: ChunkCoordIntPair, name: String): Array[Byte] = {
|
||||||
if (chunk == null) throw new IllegalArgumentException("chunk is null")
|
if (chunk == null) throw new IllegalArgumentException("chunk is null")
|
||||||
|
// Use data from 'cache' if possible. This avoids weird things happening
|
||||||
|
// when writeToNBT+readFromNBT is called by other mods (i.e. this is not
|
||||||
|
// used to actually save the data to disk).
|
||||||
|
saveData.get(dimension) match {
|
||||||
|
case Some(chunks) => chunks.get(chunk) match {
|
||||||
|
case Some(map) => map.get(name) match {
|
||||||
|
case Some(data) => return data
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
val path = savePath
|
val path = savePath
|
||||||
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}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user