mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 18:30:27 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8
This commit is contained in:
commit
114fb63c1e
@ -12,7 +12,7 @@ Network=network:1:dyeLime
|
|||||||
OpenIRC=irc:1:dyeLightBlue
|
OpenIRC=irc:1:dyeLightBlue
|
||||||
OpenLoader=openloader:1:dyeMagenta
|
OpenLoader=openloader:1:dyeMagenta
|
||||||
OpenOS=openos:0:dyeGreen
|
OpenOS=openos:0:dyeGreen
|
||||||
OPPM=oppm:1:dyeCyan
|
OPPM=oppm:0:dyeCyan
|
||||||
# Higher chance to find the dig program, because it has the most immediate
|
# Higher chance to find the dig program, because it has the most immediate
|
||||||
# use - OpenOS is craftable and IRC can be downloaded once an internet card
|
# use - OpenOS is craftable and IRC can be downloaded once an internet card
|
||||||
# is available - which one needs anyway, to use the program...
|
# is available - which one needs anyway, to use the program...
|
||||||
|
@ -117,19 +117,17 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
|||||||
}
|
}
|
||||||
case _ => 0
|
case _ => 0
|
||||||
}))
|
}))
|
||||||
val oldArchitecture = architecture
|
var newArchitecture: Architecture = null
|
||||||
architecture = null
|
|
||||||
components.find {
|
components.find {
|
||||||
case stack: ItemStack => Option(Driver.driverFor(stack, host.getClass)) match {
|
case stack: ItemStack => Option(Driver.driverFor(stack, host.getClass)) match {
|
||||||
case Some(driver: Processor) if driver.slot(stack) == Slot.CPU =>
|
case Some(driver: Processor) if driver.slot(stack) == Slot.CPU =>
|
||||||
Option(driver.architecture(stack)) match {
|
Option(driver.architecture(stack)) match {
|
||||||
case Some(clazz) =>
|
case Some(clazz) =>
|
||||||
if (oldArchitecture == null || oldArchitecture.getClass != clazz) {
|
if (architecture == null || architecture.getClass != clazz) {
|
||||||
architecture = clazz.getConstructor(classOf[machine.Machine]).newInstance(this)
|
newArchitecture = clazz.getConstructor(classOf[machine.Machine]).newInstance(this)
|
||||||
if (node.network != null) architecture.onConnect()
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
architecture = oldArchitecture
|
newArchitecture = architecture
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
case _ => false
|
case _ => false
|
||||||
@ -138,6 +136,12 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
|||||||
}
|
}
|
||||||
case _ => false
|
case _ => false
|
||||||
}
|
}
|
||||||
|
// This needs to operate synchronized against the worker thread, to avoid the
|
||||||
|
// architecture changing while it is currently being executed.
|
||||||
|
if (newArchitecture != architecture) this.synchronized {
|
||||||
|
architecture = newArchitecture
|
||||||
|
if (architecture != null && node.network != null) architecture.onConnect()
|
||||||
|
}
|
||||||
hasMemory = Option(architecture).fold(false)(_.recomputeMemory(components))
|
hasMemory = Option(architecture).fold(false)(_.recomputeMemory(components))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user