mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-24 18:37:38 +00:00
Add a standalone CC:T UI
Does it count as an emulator when it's official? I hope not, as this'd make it my fourth or fifth emulator at this point. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Developing/debugging CraftOS is a massive pain to do inside Minecraft, as any change to resources requires a compile+hot swap cycle (and sometimes a `/reload` in-game). As such, it's often more convenient to spin up an emulator, pointing it to load the ROM from CC:T's sources. However, this isn't practical when also making changes to the Java classes. In this case, we either need to go in-game, or build a custom version of CCEmuX. This commit offers an alternative option: we now have our own emulator, which allows us to hot swap both Lua and Java to our heart's content. Most of the code here is based on our monitor TBO renderer. We probably could share some more of this, but there's not really a good place for it - feels a bit weird just to chuck it in :core. This is *not* a general-purpose emulator. It's limited in a lot of ways (won't launch on Mac[^1], no support for multiple computers) - just stick to what's there already. [^1]: We require OpenGL 4.5 due to our use of DSA.
This commit is contained in:
@@ -6,6 +6,7 @@ package dan200.computercraft.core.apis.transfer;
|
||||
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -18,15 +19,19 @@ public class TransferredFiles {
|
||||
public static final String EVENT = "file_transfer";
|
||||
|
||||
private final AtomicBoolean consumed = new AtomicBoolean(false);
|
||||
private final Runnable onConsumed;
|
||||
private final @Nullable Runnable onConsumed;
|
||||
|
||||
private final List<TransferredFile> files;
|
||||
|
||||
public TransferredFiles(List<TransferredFile> files, Runnable onConsumed) {
|
||||
public TransferredFiles(List<TransferredFile> files, @Nullable Runnable onConsumed) {
|
||||
this.files = files;
|
||||
this.onConsumed = onConsumed;
|
||||
}
|
||||
|
||||
public TransferredFiles(List<TransferredFile> files) {
|
||||
this(files, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* All the files that are being transferred to this computer.
|
||||
*
|
||||
@@ -40,6 +45,6 @@ public class TransferredFiles {
|
||||
|
||||
private void consumed() {
|
||||
if (consumed.getAndSet(true)) return;
|
||||
onConsumed.run();
|
||||
if (onConsumed != null) onConsumed.run();
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user