From a181c38991aa4f8556590c8b1c3b3495f11aae64 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sun, 6 Apr 2025 13:52:13 +0200 Subject: [PATCH 1/9] chore: fix GitHub CI --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 122ee3c0d..4024c7a85 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -77,7 +77,7 @@ jobs: run: chmod +x gradlew - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: | ~/.gradle/caches From 76d7abe74fb0e90f2e1ef97971e6bf1c6934d98b Mon Sep 17 00:00:00 2001 From: Ocawesome101 <50844998+Ocawesome101@users.noreply.github.com> Date: Sat, 31 May 2025 17:02:22 -0400 Subject: [PATCH 2/9] fix `os.sleep(0)` causing `too long without yielding` --- .../resources/assets/opencomputers/loot/openos/lib/event.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua index 1ad8b4698..7c7ab7eab 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua @@ -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)) From 6e8574990d14c147e96ca3df51c6c1a9f353b2d5 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sun, 1 Jun 2025 13:37:40 +0200 Subject: [PATCH 3/9] Gradle build script dependency updates --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 97151ba3e..a5debf009 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ buildscript { } } dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11' + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.13' } } @@ -27,7 +27,7 @@ plugins { id 'idea' id 'maven-publish' id "com.matthewprenger.cursegradle" version "1.4.0" - id 'com.modrinth.minotaur' version '2.2.0' + id 'com.modrinth.minotaur' version '2.8.7' } apply plugin: 'forge' @@ -165,7 +165,7 @@ dependencies { embedded name: 'OC-JNLua', version: '20230530.0', ext: 'jar' embedded name: 'OC-JNLua-Natives', version: '20220928.1', ext: 'jar' - testCompile "junit:junit:4.13" + testCompile "junit:junit:4.13.2" testCompile "org.mockito:mockito-all:1.10.19" testCompile "org.scalactic:scalactic_2.11:2.2.6" testCompile "org.scalatest:scalatest_2.11:2.2.6" From a483a8bd64a829bea468c01013b92625849096ff Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sun, 1 Jun 2025 13:45:26 +0200 Subject: [PATCH 4/9] fix #3764 --- src/main/scala/li/cil/oc/client/gui/Rack.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/li/cil/oc/client/gui/Rack.scala b/src/main/scala/li/cil/oc/client/gui/Rack.scala index ea60d4114..878010623 100644 --- a/src/main/scala/li/cil/oc/client/gui/Rack.scala +++ b/src/main/scala/li/cil/oc/client/gui/Rack.scala @@ -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 } From 49b128ec69e534553fe7a6a8143ba5e468c45552 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sun, 1 Jun 2025 13:46:54 +0200 Subject: [PATCH 5/9] update changelog --- changelog.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 517ab0846..642dfd8e3 100644 --- a/changelog.md +++ b/changelog.md @@ -1,10 +1,9 @@ ## 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) +* [#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 From 5d35d7f9e1bb46dd1e22befc97a44faa2397e9c1 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sun, 1 Jun 2025 19:46:48 +0200 Subject: [PATCH 6/9] fix #3682 --- changelog.md | 1 + .../opencomputers/loot/openos/bin/flash.lua | 28 +++++++++++++++---- .../li/cil/oc/server/component/EEPROM.scala | 2 +- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 642dfd8e3..bc595dcce 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ ## Fixes/improvements +* [#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) diff --git a/src/main/resources/assets/opencomputers/loot/openos/bin/flash.lua b/src/main/resources/assets/opencomputers/loot/openos/bin/flash.lua index f8ecf4762..13e080e15 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/bin/flash.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/bin/flash.lua @@ -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 \ No newline at end of file diff --git a/src/main/scala/li/cil/oc/server/component/EEPROM.scala b/src/main/scala/li/cil/oc/server/component/EEPROM.scala index cc907aff6..59143cb21 100644 --- a/src/main/scala/li/cil/oc/server/component/EEPROM.scala +++ b/src/main/scala/li/cil/oc/server/component/EEPROM.scala @@ -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) } From a31f90a08820f7d003ff15fad348c7128a210a2a Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Mon, 2 Jun 2025 15:35:10 +0200 Subject: [PATCH 7/9] fix #3621 --- changelog.md | 1 + src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala | 9 +++++---- src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/changelog.md b/changelog.md index bc595dcce..513a1a570 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ ## Fixes/improvements +* [#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) diff --git a/src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala b/src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala index 56773404f..9d539f356 100644 --- a/src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala +++ b/src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala @@ -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) = { diff --git a/src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala b/src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala index 06e721194..41b3e0e39 100644 --- a/src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala +++ b/src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala @@ -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) From d1ca1ce0cd3ee1b261156320097033f3b7f3e633 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Mon, 2 Jun 2025 15:38:01 +0200 Subject: [PATCH 8/9] OpenComputers 1.8.9 --- build.properties | 2 +- .../assets/opencomputers/loot/openos/lib/core/boot.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 8c68b14b3..615e0c8e0 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 -oc.version=1.8.8-snapshot +oc.version=1.8.9-snapshot ae2.version=rv2-stable-10 bc.version=7.1.24 diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua index 736fe1129..34c966cf7 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua @@ -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 From a43004760ff4f8107cdae3ad140d1d72a2c985c9 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Mon, 2 Jun 2025 17:18:25 +0200 Subject: [PATCH 9/9] different fix for #3764 --- .../resources/assets/opencomputers/lang/en_US.lang | 1 + src/main/scala/li/cil/oc/Localization.scala | 2 ++ src/main/scala/li/cil/oc/client/gui/Rack.scala | 11 +++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/opencomputers/lang/en_US.lang b/src/main/resources/assets/opencomputers/lang/en_US.lang index 30da048b9..c56f78f4c 100644 --- a/src/main/resources/assets/opencomputers/lang/en_US.lang +++ b/src/main/resources/assets/opencomputers/lang/en_US.lang @@ -231,6 +231,7 @@ oc:gui.Rack.Right=Right oc:gui.Rack.Enabled=Enabled oc:gui.Rack.Disabled=Disabled oc:gui.Rack.RelayModeTooltip=Relay Mode +oc:gui.Rack.OrientationTooltip=Note: If facing the front[nl]of the Rack, the right[nl]side of the Rack is to[nl]your left. oc:gui.Rack.Top=Top oc:gui.Switch.PacketsPerCycle=Packets / cycle oc:gui.Switch.QueueSize=Queue size diff --git a/src/main/scala/li/cil/oc/Localization.scala b/src/main/scala/li/cil/oc/Localization.scala index 29b8ca04b..23349438d 100644 --- a/src/main/scala/li/cil/oc/Localization.scala +++ b/src/main/scala/li/cil/oc/Localization.scala @@ -147,6 +147,8 @@ object Localization { def RelayDisabled = localizeImmediately("gui.Rack.Disabled") def RelayModeTooltip: String = localizeImmediately("gui.Rack.RelayModeTooltip") + + def OrientationTooltip: String = localizeImmediately("gui.Rack.OrientationTooltip") } object Switch { diff --git a/src/main/scala/li/cil/oc/client/gui/Rack.scala b/src/main/scala/li/cil/oc/client/gui/Rack.scala index 878010623..4aa50de90 100644 --- a/src/main/scala/li/cil/oc/client/gui/Rack.scala +++ b/src/main/scala/li/cil/oc/client/gui/Rack.scala @@ -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.WEST => Localization.Rack.Left - case ForgeDirection.EAST => Localization.Rack.Right + case ForgeDirection.WEST => Localization.Rack.Right + case ForgeDirection.EAST => Localization.Rack.Left case ForgeDirection.NORTH => Localization.Rack.Back case _ => Localization.Rack.None } @@ -250,6 +250,13 @@ class Rack(playerInventory: InventoryPlayer, val rack: tileentity.Rack) extends x, y, 0x404040) } + if (mouseX >= guiLeft + 122 && mouseY >= guiTop + 20 && mouseX < guiLeft + 158 && mouseY < guiTop + 20 + 5 * 11) { + val tooltip = new java.util.ArrayList[String] + tooltip.addAll(asJavaCollection(Localization.Rack.OrientationTooltip.lines.toIterable)) + copiedDrawHoveringText(tooltip, mouseX - guiLeft, mouseY - guiTop, fontRendererObj) + + } + if (relayButton.func_146115_a) { val tooltip = new java.util.ArrayList[String] tooltip.addAll(asJavaCollection(Localization.Rack.RelayModeTooltip.lines.toIterable))