CC: Tweaked

CC: Tweaked is a mod for Minecraft which adds programmable computers, turtles and more to the game. A fork of the much-beloved ComputerCraft, it continues its legacy with improved performance and stability, along with a wealth of new features.

CC: Tweaked can be installed from CurseForge or Modrinth. It runs on both Minecraft Forge and Fabric.

Features

Controlled using the Lua programming language, CC: Tweaked's computers provides all the tools you need to start writing code and automating your Minecraft world.

A ComputerCraft terminal open and ready to be programmed.

While computers are incredibly powerful, they're rather limited by their inability to move about. Turtles are the solution here. They can move about the world, placing and breaking blocks, swinging a sword to protect you from zombies, or whatever else you program them to!

A turtle tunneling in Minecraft.

Not all problems can be solved with a pickaxe though, and so CC: Tweaked also provides a bunch of additional peripherals for your computers. You can play a tune with speakers, display text or images on a monitor, connect all your computers together with modems, and much more.

Computers can now also interact with inventories such as chests, allowing you to build complex inventory and item management systems.

A chest's contents being read by a computer and displayed on a monitor.

Getting Started

While ComputerCraft is lovely for both experienced programmers and for people who have never coded before, it can be a little daunting getting started. Thankfully, there's several fantastic tutorials out there:

Once you're a little more familiar with the mod, the sidebar and links below provide more detailed documentation on the various APIs and peripherals provided by the mod.

Community

If you need help getting started with CC: Tweaked, want to show off your latest project, or just want to chat about ComputerCraft, do check out our GitHub discussions page! There's also a fairly populated, albeit quiet IRC channel on EsperNet, if that's more your cup of tea. You can join #computercraft through your desktop client, or online using KiwiIRC.

Get Involved

CC: Tweaked lives on GitHub. If you've got any ideas, feedback or bugs please do create an issue.

Globals

_GFunctions in the global environment, defined in bios.lua.
colorsConstants and functions for colour values, suitable for working with term and redstone.
coloursAn alternative version of colors for lovers of British spelling.
commandsExecute Minecraft commands and gather data from the results from a command computer.
diskInteract with disk drives.
fsInteract with the computer's files and filesystem, allowing you to manipulate files, directories and paths.
gpsUse modems to locate the position of the current turtle or computers.
helpFind help files on the current computer.
httpMake HTTP requests, sending and receiving data to a remote web server.
ioEmulates Lua's standard io library.
keysConstants for all keyboard "key codes", as queued by the key event.
multishellMultishell allows multiple programs to be run at the same time.
osThe os API allows interacting with the current computer.
paintutilsUtilities for drawing more complex graphics, such as pixels, lines and images.
parallelA simple way to run several functions at once.
peripheralFind and control peripherals attached to this computer.
pocketControl the current pocket computer, adding or removing upgrades.
rednetCommunicate with other computers by using modems.
redstoneGet and set redstone signals adjacent to this computer.
settingsRead and write configuration options for CraftOS and your programs.
shellThe shell API provides access to CraftOS's command line interface.
termInteract with a computer's terminal or monitors, writing text and drawing ASCII graphics.
textutilsHelpful utilities for formatting and manipulating strings.
turtleTurtles are a robotic device, which can break and place blocks, attack mobs, and move about the world.
vectorA basic 3D vector type and some common vector operations.
windowA terminal redirect occupying a smaller area of an existing terminal.

Modules

cc.audio.dfpwmConvert between streams of DFPWM audio data and a list of amplitudes.
cc.completionA collection of helper methods for working with input completion, such as that require by _G.read.
cc.expectThe cc.expect library provides helper functions for verifying that function arguments are well-formed and of the correct type.
cc.image.nftRead and draw nft ("Nitrogen Fingers Text") images.
cc.prettyA pretty printer for rendering data structures in an aesthetically pleasing manner.
cc.requireA pure Lua implementation of the builtin require function and package library.
cc.shell.completionA collection of helper methods for working with shell completion.
cc.stringsVarious utilities for working with strings and text.

Peripherals

commandThis peripheral allows you to interact with command blocks.
computerA computer or turtle wrapped as a peripheral.
driveDisk drives are a peripheral which allow you to read and write to floppy disks and other "mountable media" (such as computers or turtles).
modemModems allow you to send messages between computers over long distances.
monitorMonitors are a block which act as a terminal, displaying information on one side.
printerThe printer peripheral allows printing text onto pages.
speakerThe speaker peripheral allows your computer to play notes and other sounds.

Generic Peripherals

energy_storageMethods for interacting with blocks which store energy.
fluid_storageMethods for interacting with tanks and other fluid storage blocks.
inventoryMethods for interacting with inventories.

Events

alarmThe alarm event is fired when an alarm started with os.setAlarm completes.
charThe char event is fired when a character is typed on the keyboard.
computer_commandThe computer_command event is fired when the /computercraft queue command is run for the current computer.
diskThe disk event is fired when a disk is inserted into an adjacent or networked disk drive.
disk_ejectThe disk_eject event is fired when a disk is removed from an adjacent or networked disk drive.
file_transferThe file_transfer event is queued when a user drags-and-drops a file on an open computer.
http_checkThe http_check event is fired when a URL check finishes.
http_failureThe http_failure event is fired when an HTTP request fails.
http_successThe http_success event is fired when an HTTP request returns successfully.
keyThis event is fired when any key is pressed while the terminal is focused.
key_upFired whenever a key is released (or the terminal is closed while a key was being pressed).
modem_messageThe modem_message event is fired when a message is received on an open channel on any modem.
monitor_resizeThe monitor_resize event is fired when an adjacent or networked monitor's size is changed.
monitor_touchThe monitor_touch event is fired when an adjacent or networked Advanced Monitor is right-clicked.
mouse_clickThis event is fired when the terminal is clicked with a mouse.
mouse_dragThis event is fired every time the mouse is moved while a mouse button is being held.
mouse_scrollThis event is fired when a mouse wheel is scrolled in the terminal.
mouse_upThis event is fired when a mouse button is released or a held mouse leaves the computer's terminal.
pasteThe paste event is fired when text is pasted into the computer through Ctrl-V (or ⌘V on Mac).
peripheralThe peripheral event is fired when a peripheral is attached on a side or to a modem.
peripheral_detachThe peripheral_detach event is fired when a peripheral is detached from a side or from a modem.
rednet_messageThe rednet_message event is fired when a message is sent over Rednet.
redstoneThe redstone event is fired whenever any redstone inputs on the computer change.
speaker_audio_emptyReturn Values
task_completeThe task_complete event is fired when an asynchronous task completes.
term_resizeThe term_resize event is fired when the main terminal is resized.
terminateThe terminate event is fired when Ctrl-T is held down.
timerThe timer event is fired when a timer started with os.startTimer completes.
turtle_inventoryThe turtle_inventory event is fired when a turtle's inventory is changed.
websocket_closedThe websocket_closed event is fired when an open WebSocket connection is closed.
websocket_failureThe websocket_failure event is fired when a WebSocket connection request fails.
websocket_messageThe websocket_message event is fired when a message is received on an open WebSocket connection.
websocket_successThe websocket_success event is fired when a WebSocket connection request returns successfully.

Guides

Setting up GPSThe gps API allows computers and turtles to find their current position using wireless modems.
Allowing access to local IPsBy default, ComputerCraft blocks access to local IP addresses for security.
Playing audio with speakersCC: Tweaked's speaker peripheral provides a powerful way to play any audio you like with the speaker.playAudio method.
Reusing code with requireA library is a collection of useful functions and other definitions which is stored separately to your main program.

Reference

Incompatibilities between versionsCC: Tweaked tries to remain as compatible between versions as possible, meaning most programs written for older version
The /computercraft commandCC: Tweaked provides a /computercraft command for server owners to manage running computers on a server.
Lua 5.2/5.3 features in CC: TweakedCC: Tweaked is based off of the Cobalt Lua runtime, which uses Lua 5.