diff --git a/README.md b/README.md index 82bde2737..09f33d5d0 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ repositories { url "https://squiddev.cc/maven/" content { includeGroup("cc.tweaked") - includeModule("org.squiddev", "Cobalt") } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 20f3c511a..6df908ef2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -68,7 +68,7 @@ mixinGradle = "0.7.+" nullAway = "0.9.9" spotless = "6.21.0" taskTree = "2.1.1" -teavm = "0.10.0-SQUID.1" +teavm = "0.10.0-SQUID.2" vanillaGradle = "0.2.1-SNAPSHOT" vineflower = "1.11.0" diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/term.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/term.lua index 30aaa5355..56dbc21f1 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/term.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/term.lua @@ -35,6 +35,7 @@ local term = _ENV -- @since 1.31 -- @usage -- Redirect to a monitor on the right of the computer. +-- -- term.redirect(peripheral.wrap("right")) term.redirect = function(target) expect(1, target, "table") diff --git a/projects/web/src/main/java/dan200/computercraft/core/computer/computerthread/TComputerThread.java b/projects/web/src/main/java/dan200/computercraft/core/computer/computerthread/TComputerThread.java index 211faed33..1e31fb04e 100644 --- a/projects/web/src/main/java/dan200/computercraft/core/computer/computerthread/TComputerThread.java +++ b/projects/web/src/main/java/dan200/computercraft/core/computer/computerthread/TComputerThread.java @@ -28,6 +28,7 @@ public class TComputerThread implements ComputerScheduler { private static final ArrayDeque executors = new ArrayDeque<>(); private static final TimerHandler callback = TComputerThread::workOnce; + private static boolean enqueued; public TComputerThread(int threads) { } @@ -38,6 +39,8 @@ public class TComputerThread implements ComputerScheduler { } private static void workOnce() { + enqueued = false; + var executor = executors.poll(); if (executor == null) throw new IllegalStateException("Working, but executor is null"); @@ -50,7 +53,14 @@ public class TComputerThread implements ComputerScheduler { } executor.afterWork(); - if (!executors.isEmpty()) Callbacks.setImmediate(callback); + if (!executors.isEmpty()) enqueue(); + } + + private static void enqueue() { + if (enqueued) return; + + enqueued = true; + Callbacks.setImmediate(callback); } @Override @@ -75,8 +85,8 @@ public class TComputerThread implements ComputerScheduler { if (onQueue) return; onQueue = true; - if (executors.isEmpty()) Callbacks.setImmediate(callback); executors.add(this); + enqueue(); } void beforeWork() {