mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 17:28:52 -04:00
Merge pull request #2174 from Vexatos/no-crash-in-NBT
Fix robots duplicating with SpongeForge.
This commit is contained in:
commit
6e1270ef08
@ -765,7 +765,11 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
||||
})
|
||||
|
||||
override def save(nbt: NBTTagCompound): Unit = Machine.this.synchronized(state.synchronized {
|
||||
assert(!isExecuting) // Lock on 'this' should guarantee this.
|
||||
// The lock on 'this' should guarantee that this never happens regularly.
|
||||
// If something other than regular saving tries to save while we are executing code,
|
||||
// e.g. SpongeForge saving during robot.move due to block changes being captured,
|
||||
// just don't save this at all. What could possibly go wrong?
|
||||
if(isExecuting) return
|
||||
|
||||
if (SaveHandler.savingForClients) {
|
||||
return
|
||||
@ -1076,4 +1080,4 @@ object Machine extends MachineAPI {
|
||||
}
|
||||
|
||||
private val threadPool = ThreadPoolFactory.create("Computer", Settings.get.threads)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user