mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
make computer state save system more compatible with non-standard use of save/load
This commit is contained in:
parent
2e92183abb
commit
cba29b2e9a
@ -24,6 +24,19 @@ object SaveHandler {
|
||||
|
||||
def load(dimension: Int, chunk: ChunkCoordIntPair, name: String): Array[Byte] = {
|
||||
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 dimPath = new io.File(path, dimension.toString)
|
||||
val chunkPath = new io.File(dimPath, s"${chunk.chunkXPos}.${chunk.chunkZPos}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user