12e82afad2
The latest version of Cobalt has several major changes, which I'm looking forward to taking advantage of in the coming months: - The Lua interpreter has been split up from the actual LuaClosure instance. It now runs multiple functions within one loop, handling pushing/popping and resuming method calls correctly. This means we have a theoretically infinite call depth, as we're no longer bounded by Java's stack size. In reality, this is limited to 32767 (Short.MAX_VALUE), as that's a mostly equivalent to the limits PUC Lua exposes. - The stack is no longer unwound in the event of errors. This both simplifies error handling (not that CC:T needs to care about that) but also means one can call debug.traceback on a now-dead coroutine (which is more useful for debugging than using xpcall). - Most significantly, coroutines are no longer each run on a dedicated thread. Instead, yielding or resuming throws an exception to unwind the Java stack and switches to a different coroutine. In order to preserve compatability with CC's assumption about LuaJ's threading model (namely that yielding blocks the thread), we also provide a yieldBlock method (which CC:T consumes). This suspends the current thread and switches execution to a new thread (see SquidDev/Cobalt@b5ddf164f1 for more details). While this does mean we need to use more than 1 thread, it's still /substantially/ less than would otherwise be needed. We've been running these changes on SwitchCraft for a few days now and haven't seen any issues. One nice thing to observe is that the number of CC thread has gone down from ~1.9k to ~100 (of those, ~70 are dedicated to running coroutines). Similarly, the server has gone from generating ~15k threads over its lifetime, to ~3k. While this is still a lot, it's a substantial improvement. |
||
---|---|---|
.github | ||
gradle/wrapper | ||
src | ||
.editorconfig | ||
.gitignore | ||
.luacheckrc | ||
.travis.yml | ||
build.gradle | ||
codeStyleSettings.xml | ||
gradlew | ||
gradlew.bat | ||
LICENSE | ||
LICENSE-luaj | ||
logo.png | ||
README.md | ||
settings.gradle |
CC: Tweaked is a fork of ComputerCraft which aims to provide earlier access to the more experimental and in-development features of the mod. For a more stable experience, I recommend checking out the original mod.
What?
CC: Tweaked (or CC:T for short) does not aim to create a competing fork of ComputerCraft, nor am I planning to take it in in a vastly different direction to the original mod. In fact, CC:T aims to be a nurturing ground for various features, with a pull request against the original mod being the end goal.
CC:T also includes many pull requests from the community which have not yet been merged, offering a large number of additional bug fixes and features over the original mod.
Features
CC: Tweaked contains all the features of the latest alpha, as well as numerous fixes, performance improvements and several additional features. I'd recommend checking out the releases page to see the full changes, but here's a couple of the more interesting changes:
- Replace LuaJ with Cobalt.
- Allow running multiple computers at the same time.
- Websocket support in the HTTP library.
- Wired modems and cables act more like multiparts.
- Add map-like rendering for pocket computers and printed pages/books.
- Adds the
/computercraft
command, offering various diagnostic tools for server owners. This allows operators to track which computers are hogging resources, turn on and shutdown multiple computers at once and interact with computers remotely. - Add full-block wired modems, allowing one to wrap non-solid peripherals (such as turtles, or chests if Plethora is installed).
- Extended binary file handles. They support file seeking, and reading new lines, allowing full (and accurate)
emulation of the standard Lua
io
library.
Relation to CCTweaks?
This mod has nothing to do with CCTweaks, though there is no denying the name is a throwback to it. That being said, several features have been included, such as full block modems, the Cobalt runtime and map-like rendering for pocket computers.
Contributing
Any contribution is welcome, be that using the mod, reporting bugs or contributing code. If you do wish to contribute code, do consider submitting it to the ComputerCraft repository first.
That being said, in order to start helping develop CC:T, you'll need to follow these steps:
- Clone the repository:
git clone https://github.com/SquidDev-CC/CC-Tweaked.git && cd CC-Tweaked
- Setup Forge:
./gradlew setupDecompWorkspace
- Test your changes:
./gradlew runClient
(or run theGradleStart
class from your IDE).
If you want to run CC:T in a normal Minecraft instance, run ./gradlew build
and copy the .jar
from build/libs
.