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
* [#3769] Add default user agent configuration option; change OpenComputers' default user agent to "opencomputers/$version".
* [#3759] Add V1 and V2 to the robot name list. (AutumnalModding)
* [#3727] Fix more regressions related to OpenOS error handling. (jasonS05, kcinnajlol)
* Fix client-side memory leak on anything RedstoneAware (Glease)
* [#3621] Fix `os.time()` being off by one hour
* [#3682] Add error handling to the `flash` OpenOS program
* [#3764] Fix left and right names being swapped in the Rack GUI
* [#3779] Fix `os.sleep(0)` causing `too long without yielding` (Ocawesome101)
* (1.12) [#3774] Fix Jukebox driver (kebufu)
## 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.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 eeprom = component.eeprom
io.write(eeprom.get())
return nil
end
local function readRom()
@ -37,6 +39,8 @@ local function readRom()
if not options.q then
io.write("All done!\nThe label is '" .. eeprom.getLabel() .. "'.\n")
end
return nil
end
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")
end
eeprom.set(bios)
local result, reason = eeprom.set(bios)
if reason then
return nil, reason
end
local label = args[2]
if not options.q and not label then
@ -68,7 +75,11 @@ local function writeRom()
label = io.read()
end
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
io.write("Set label to '" .. eeprom.getLabel() .. "'.\n")
end
@ -77,12 +88,19 @@ local function writeRom()
if not options.q then
io.write("All done! You can remove the EEPROM and re-insert the previous one now.\n")
end
return nil
end
local result, reason
if options.l then
printRom()
result, reason = printRom()
elseif options.r then
readRom()
result, reason = readRom()
else
writeRom()
result, reason = writeRom()
end
if reason then
io.stderr:write(reason..'\n')
return 1
end

View File

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

View File

@ -143,7 +143,7 @@ function event.pullFiltered(...)
local deadline = computer.uptime() + (seconds or math.huge)
repeat
local waitTime = deadline - computer.uptime()
if waitTime <= 0 then
if waitTime < 0 then
break
end
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 {
case ForgeDirection.UP => Localization.Rack.Top
case ForgeDirection.DOWN => Localization.Rack.Bottom
case ForgeDirection.EAST => Localization.Rack.Left
case ForgeDirection.WEST => Localization.Rack.Right
case ForgeDirection.WEST => Localization.Rack.Left
case ForgeDirection.EAST => Localization.Rack.Right
case ForgeDirection.NORTH => Localization.Rack.Back
case _ => Localization.Rack.None
}

View File

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

View File

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

View File

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