Merge remote-tracking branch 'src/master-MC1.7.10' into gtnh-oc-1.8.9

This commit is contained in:
Adrian Siekierka 2025-06-02 15:42:14 +02:00
commit e9e52144a2
9 changed files with 45 additions and 24 deletions

View File

@ -1,10 +1,11 @@
## Fixes/improvements ## Fixes/improvements
* [#3769] Add default user agent configuration option; change OpenComputers' default user agent to "opencomputers/$version". * [#3621] Fix `os.time()` being off by one hour
* [#3759] Add V1 and V2 to the robot name list. (AutumnalModding) * [#3682] Add error handling to the `flash` OpenOS program
* [#3727] Fix more regressions related to OpenOS error handling. (jasonS05, kcinnajlol) * [#3764] Fix left and right names being swapped in the Rack GUI
* Fix client-side memory leak on anything RedstoneAware (Glease) * [#3779] Fix `os.sleep(0)` causing `too long without yielding` (Ocawesome101)
* (1.12) [#3774] Fix Jukebox driver (kebufu)
## List of contributors ## List of contributors
asie, AutumnalModding, Glease, jasonS05, kcinnajlol asie, kebufu, Ocawesome101

View File

@ -53,5 +53,5 @@ dependencies {
testImplementation("org.mockito:mockito-all:1.10.19") testImplementation("org.mockito:mockito-all:1.10.19")
testImplementation("org.scalatest:scalatest_2.11:2.2.6") testImplementation("org.scalatest:scalatest_2.11:2.2.6")
testImplementation("junit:junit:4.13") testImplementation("junit:junit:4.13.2")
} }

View File

@ -15,6 +15,8 @@ end
local function printRom() local function printRom()
local eeprom = component.eeprom local eeprom = component.eeprom
io.write(eeprom.get()) io.write(eeprom.get())
return nil
end end
local function readRom() local function readRom()
@ -37,6 +39,8 @@ local function readRom()
if not options.q then if not options.q then
io.write("All done!\nThe label is '" .. eeprom.getLabel() .. "'.\n") io.write("All done!\nThe label is '" .. eeprom.getLabel() .. "'.\n")
end end
return nil
end end
local function writeRom() local function writeRom()
@ -60,7 +64,10 @@ local function writeRom()
io.write("Please do NOT power down or restart your computer during this operation!\n") io.write("Please do NOT power down or restart your computer during this operation!\n")
end end
eeprom.set(bios) local result, reason = eeprom.set(bios)
if reason then
return nil, reason
end
local label = args[2] local label = args[2]
if not options.q and not label then if not options.q and not label then
@ -68,7 +75,11 @@ local function writeRom()
label = io.read() label = io.read()
end end
if label and #label > 0 then if label and #label > 0 then
eeprom.setLabel(label) local result, reason = eeprom.setLabel(label)
if reason then
return nil, reason
end
if not options.q then if not options.q then
io.write("Set label to '" .. eeprom.getLabel() .. "'.\n") io.write("Set label to '" .. eeprom.getLabel() .. "'.\n")
end end
@ -77,12 +88,19 @@ local function writeRom()
if not options.q then if not options.q then
io.write("All done! You can remove the EEPROM and re-insert the previous one now.\n") io.write("All done! You can remove the EEPROM and re-insert the previous one now.\n")
end end
return nil
end end
local result, reason
if options.l then if options.l then
printRom() result, reason = printRom()
elseif options.r then elseif options.r then
readRom() result, reason = readRom()
else else
writeRom() result, reason = writeRom()
end
if reason then
io.stderr:write(reason..'\n')
return 1
end end

View File

@ -1,7 +1,7 @@
-- called from /init.lua -- called from /init.lua
local raw_loadfile = ... local raw_loadfile = ...
_G._OSVERSION = "OpenOS 1.8.8" _G._OSVERSION = "OpenOS 1.8.9"
-- luacheck: globals component computer unicode _OSVERSION -- luacheck: globals component computer unicode _OSVERSION
local component = component local component = component

View File

@ -143,7 +143,7 @@ function event.pullFiltered(...)
local deadline = computer.uptime() + (seconds or math.huge) local deadline = computer.uptime() + (seconds or math.huge)
repeat repeat
local waitTime = deadline - computer.uptime() local waitTime = deadline - computer.uptime()
if waitTime <= 0 then if waitTime < 0 then
break break
end end
local signal = table.pack(computer.pullSignal(waitTime)) local signal = table.pack(computer.pullSignal(waitTime))

View File

@ -81,8 +81,8 @@ class Rack(playerInventory: InventoryPlayer, val rack: tileentity.Rack) extends
def sideName(side: ForgeDirection) = side match { def sideName(side: ForgeDirection) = side match {
case ForgeDirection.UP => Localization.Rack.Top case ForgeDirection.UP => Localization.Rack.Top
case ForgeDirection.DOWN => Localization.Rack.Bottom case ForgeDirection.DOWN => Localization.Rack.Bottom
case ForgeDirection.EAST => Localization.Rack.Left case ForgeDirection.WEST => Localization.Rack.Left
case ForgeDirection.WEST => Localization.Rack.Right case ForgeDirection.EAST => Localization.Rack.Right
case ForgeDirection.NORTH => Localization.Rack.Back case ForgeDirection.NORTH => Localization.Rack.Back
case _ => Localization.Rack.None case _ => Localization.Rack.None
} }

View File

@ -76,7 +76,7 @@ class EEPROM extends prefab.ManagedEnvironment with DeviceInfo {
return result(Unit, "storage is readonly") return result(Unit, "storage is readonly")
} }
label = args.optString(0, "EEPROM").trim.take(24) label = args.optString(0, "EEPROM").trim.take(24)
if (label.length == 0) label = "EEPROM" if (label.isEmpty) label = "EEPROM"
result(label) result(label)
} }

View File

@ -67,10 +67,11 @@ class OSAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
if (lua.isNoneOrNil(1)) { if (lua.isNoneOrNil(1)) {
// Game time is in ticks, so that each day has 24000 ticks, meaning // Game time is in ticks, so that each day has 24000 ticks, meaning
// one hour is game time divided by one thousand. Also, Minecraft // one hour is game time divided by one thousand. Also, Minecraft
// starts days at 6 o'clock, versus the 1 o'clock of timestamps so we // starts days at 6 o'clock; os.time() reflects UTC while os.date()
// add those five hours. Thus: // reflects the local time zone, but Minecraft has no concept of
// timestamp = (time + 5000) * 60[kh] * 60[km] / 1000[s] // time zones, so this detail can be ignored. Thus:
lua.pushNumber(((machine.worldTime + 5000) * 60 * 60) / 1000.0) // timestamp = (time + 6000) * 60[kh] * 60[km] / 1000[s]
lua.pushNumber(((machine.worldTime + 6000) * 60 * 60) / 1000.0)
} }
else { else {
def getField(key: String, d: Int) = { def getField(key: String, d: Int) = {

View File

@ -51,10 +51,11 @@ class OSAPI(owner: LuaJLuaArchitecture) extends LuaJAPI(owner) {
if (args.isnoneornil(1)) { if (args.isnoneornil(1)) {
// Game time is in ticks, so that each day has 24000 ticks, meaning // Game time is in ticks, so that each day has 24000 ticks, meaning
// one hour is game time divided by one thousand. Also, Minecraft // one hour is game time divided by one thousand. Also, Minecraft
// starts days at 6 o'clock, versus the 1 o'clock of timestamps so we // starts days at 6 o'clock; os.time() reflects UTC while os.date()
// add those five hours. Thus: // reflects the local time zone, but Minecraft has no concept of
// timestamp = (time + 5000) * 60[kh] * 60[km] / 1000[s] // time zones, so this detail can be ignored. Thus:
LuaValue.valueOf((machine.worldTime + 5000) * 60 * 60 / 1000) // timestamp = (time + 6000) * 60[kh] * 60[km] / 1000[s]
LuaValue.valueOf((machine.worldTime + 6000) * 60 * 60 / 1000)
} }
else { else {
val table = args.checktable(1) val table = args.checktable(1)