mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Merge branch 'master-MC1.9.4' of github.com:MightyPirates/OpenComputers into master-MC1.10
This commit is contained in:
commit
6cc69b65bd
@ -2,6 +2,7 @@ package li.cil.oc.integration.opencomputers
|
||||
|
||||
import li.cil.oc
|
||||
import li.cil.oc.Constants
|
||||
import li.cil.oc.OpenComputers
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.api.network.EnvironmentHost
|
||||
@ -18,6 +19,8 @@ import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraftforge.common.DimensionManager
|
||||
|
||||
object DriverFileSystem extends Item {
|
||||
val UUIDVerifier = """^([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})$""".r
|
||||
|
||||
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
||||
api.Items.get(Constants.ItemName.HDDTier1),
|
||||
api.Items.get(Constants.ItemName.HDDTier2),
|
||||
@ -85,7 +88,14 @@ object DriverFileSystem extends Item {
|
||||
|
||||
private def addressFromTag(tag: NBTTagCompound) =
|
||||
if (tag.hasKey("node") && tag.getCompoundTag("node").hasKey("address")) {
|
||||
tag.getCompoundTag("node").getString("address")
|
||||
tag.getCompoundTag("node").getString("address") match {
|
||||
case UUIDVerifier(address) => address
|
||||
case _ => // Invalid disk address.
|
||||
val newAddress = java.util.UUID.randomUUID().toString
|
||||
tag.getCompoundTag("node").setString("address", newAddress)
|
||||
OpenComputers.log.warn(s"Generated new address for disk '${newAddress}'.")
|
||||
newAddress
|
||||
}
|
||||
}
|
||||
else java.util.UUID.randomUUID().toString
|
||||
|
||||
|
@ -19,7 +19,7 @@ object ModRedLogic extends ModProxy with RedstoneProvider {
|
||||
}
|
||||
|
||||
override def computeInput(pos: BlockPosition, side: ForgeDirection): Int = {
|
||||
pos.world.get.getTileEntity(pos) match {
|
||||
pos.world.get.getTileEntity(pos.offset(side)) match {
|
||||
case emitter: IRedstoneEmitter =>
|
||||
var strength = 0
|
||||
for (i <- -1 to 5) {
|
||||
|
@ -782,7 +782,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
|
||||
@ -1093,4 +1097,4 @@ object Machine extends MachineAPI {
|
||||
}
|
||||
|
||||
private val threadPool = ThreadPoolFactory.create("Computer", Settings.get.threads)
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ class LuaJLuaArchitecture(val machine: api.machine.Machine) extends Architecture
|
||||
|
||||
recomputeMemory(machine.host.internalComponents)
|
||||
|
||||
val kernel = lua.load(classOf[Machine].getResourceAsStream(Settings.scriptPath + "machine.lua"), "=kernel", "t", lua)
|
||||
val kernel = lua.load(classOf[Machine].getResourceAsStream(Settings.scriptPath + "machine.lua"), "=machine", "t", lua)
|
||||
thread = new LuaThread(lua, kernel) // Left as the first value on the stack.
|
||||
|
||||
true
|
||||
|
Loading…
x
Reference in New Issue
Block a user