mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-23 20:40:37 -04:00
Merge branch 'OC1.3-MC1.6.4' of github.com:MightyPirates/OpenComputers into OC1.3-MC1.7.2
This commit is contained in:
commit
4a2629a4d3
@ -28,10 +28,10 @@ class UpgradeChunkloader(val owner: Container) extends component.ManagedComponen
|
||||
}
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(doc = """function():boolean -- Gets whether the chunkloader is currently active.""")
|
||||
def isActive(context: Context, args: Arguments): Array[AnyRef] = result(ticket.isDefined)
|
||||
|
||||
@Callback
|
||||
@Callback(doc = """function(enabled:boolean):boolean -- Enables or disables the chunkloader.""")
|
||||
def setActive(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
val enabled = args.checkBoolean(0)
|
||||
if (enabled && ticket.isEmpty) {
|
||||
|
@ -39,7 +39,7 @@ class UpgradeExperience extends component.ManagedComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Callback(direct = true, doc = """function():number -- The current level of experience stored in this experience upgrade.""")
|
||||
def level(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
val xpNeeded = xpForNextLevel - xpForLevel(level)
|
||||
val xpProgress = math.max(0, experience - xpForLevel(level))
|
||||
|
@ -585,7 +585,7 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
|
||||
|
||||
tmp.foreach(fs => fs.load(nbt.getCompoundTag("tmp")))
|
||||
|
||||
if (state.size > 0 && state.top != Machine.State.Stopped && init()) {
|
||||
if (state.size > 0 && state.top != Machine.State.Stopped && init()) try {
|
||||
architecture.load(nbt)
|
||||
|
||||
signals ++= nbt.getTagList("signals", NBT.TAG_COMPOUND).map((list, index) => {
|
||||
@ -618,6 +618,11 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
|
||||
pause(Settings.get.startupDelay)
|
||||
}
|
||||
}
|
||||
catch {
|
||||
case t: Throwable =>
|
||||
OpenComputers.log.log(Level.SEVERE, s"""Unexpected error loading a state of computer at (${owner.x}, ${owner.y}, ${owner.z}). """ +
|
||||
s"""State: ${state.headOption.fold("no state")(_.toString)}. Unless you're upgrading/downgrading across a major version, please report this! Thank you.""", t)
|
||||
}
|
||||
else close() // Clean up in case we got a weird state stack.
|
||||
}
|
||||
|
||||
@ -647,7 +652,7 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
|
||||
|
||||
tmp.foreach(fs => nbt.setNewCompoundTag("tmp", fs.save))
|
||||
|
||||
if (state.top != Machine.State.Stopped) {
|
||||
if (state.top != Machine.State.Stopped) try {
|
||||
architecture.save(nbt)
|
||||
|
||||
val signalsNbt = new NBTTagList()
|
||||
@ -680,6 +685,11 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
|
||||
nbt.setLong("cpuTime", cpuTotal)
|
||||
nbt.setInteger("remainingPause", remainingPause)
|
||||
}
|
||||
catch {
|
||||
case t: Throwable =>
|
||||
OpenComputers.log.log(Level.SEVERE, s"""Unexpected error saving a state of computer at (${owner.x}, ${owner.y}, ${owner.z}). """ +
|
||||
s"""State: ${state.headOption.fold("no state")(_.toString)}. Unless you're upgrading/downgrading across a major version, please report this! Thank you.""", t)
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
Loading…
x
Reference in New Issue
Block a user