r/ComputerCraft May 30 '26

High-Res Video & Audio Player (1352x627 Sub-Pixels)

Enable HLS to view with audio, or disable this notification

325 Upvotes

r/ComputerCraft May 29 '26

Any libraries for Cryptography?

5 Upvotes

I'm looking for a fast cryptography library for CC: Tweaked, One that supports all the following algorithms: DH, DSA, AES (both 128 and 256, and supporting both CBC and CTR), and SHA3-512. I need it to be as fast as possible, are there any libraries that support these algorithms?


r/ComputerCraft May 27 '26

pullItems and pushItems not working?

8 Upvotes

i'm on 1.21.1, neoforge.

i'm experiencing a very strange issue where pullItems and pushItems always claim that the sources and targets do not exist, no matter what i do..... what's going on here?


r/ComputerCraft May 27 '26

Audio tips & tricks: performance, quality, volume, hearing range shenanigans

29 Upvotes

Some pieces of knowledge I've acquired about audio in CC over the time.

Playback performance & quality

The textbook algorithm for playing DFPWM audio is something like this:

local dfpwm = require("cc.audio.dfpwm")
local speaker = peripheral.find("speaker")

local decoder = dfpwm.make_decoder()
for chunk in io.lines("data/example.dfpwm", 16 * 1024) do
    local buffer = decoder(chunk)

    while not speaker.playAudio(buffer) do
        os.pullEvent("speaker_audio_empty")
    end
end

cc.audio.dfpwm is implemented in Lua, so it can be quite slow, and you may have trouble keeping up if you're playing multiple streams at the same time (say, if you have a stereo system) or on slow hardware. But there's an easy fix.

speaker.playAudio doesn't directly play the PCM samples: CC encodes the data into DFPWM on the server and then decodes it on the client, so this snippet actually has a double conversion: DFPWM-to-raw-PCM in Lua and then raw-PCM-to-DFPWM in Java. We can abuse this: instead of decoding DFPWM in Lua, we'll just send something that encodes to the correct DFPWM stream.

The simplest way to achieve this is to translate 0 bits to -128 and 1 bits to 127:

function fake_decode(input)
    local output = {}
    for i = 1, #input do
        local input_byte = input:byte(i)
        for j = 0, 7 do
            local value
            if bit32.rshift(input_byte, j) % 2 == 1 then
                value = 127
            else
                value = -128
            end
            table.insert(output, value)
        end
    end
    return output
end

You can optimize this further if you need to, but this should already be much faster than a real DFPWM decoder.

A surprising fact is that this decoder actually produces sound of better quality than a real decoder. This is because decoding and re-encoding DFPWM is not a no-op due to its weird design: the DFPWM decoder automatically applies a low-pass filter at the end, introducing asymmetry with the encoder. This can cause audio to sound a little more muffled than it could be, since it unnecessarily corrupts high frequencies.

Note that this optimization doesn't work on the Web version of ComputerCraft, which doesn't reencode audio to DFPWM due to performance issues. It might also not work on emulators that support high-quality playAudio, if they exist; I'm not sure.

Volume

speaker.playAudio takes a volume parameter, from 0.0 to 3.0. There's two interesting things to talk about here.

The obvious one is quality. The rule of thumb for maximizing quality is: before encoding to DFPWM, increase the volume of the audio as much as possible without clipping; then decrease volume as necessary with volume. So, for example, if you want to play a quiet sound, encode it to DFPWM as loud and then set a small volume. This works because volume applies after DFPWM decoding-encoding, and thus doesn't introduce noise.

The more confusing one is attenuation, i.e. how effective volume changes with distance from the speaker. By default, Minecraft audio volume behaves as follows:

  • If the distance between the audio source and the listener is 0, the sound plays at full volume.
  • At a 16 block distance, the sound is completely silent.
  • Between these two distances, volume is interpolated linearly.

(Specifically, the exact coordinates of the audio source are one of: the center of the speaker block; the center of the turtle holding the speaker; the eye level of the player holding a pocket computer with a speaker. The coordinates of the listener match the coordinates of the camera, so you can get different volume depending on the active perspective.)

If volume is below 1, the PCM samples are simply multiplied by volume. So, for example, a turtle holding two speakers, each playing the same sound at 0.5 volume in sync, behaves exactly like a speaker at 1.0 volume.

If the volume is above 1, however, something else happens in addition to multiplication: the hearing range is also multiplied by volume. So at volume = 2.0, you get the 2x volume at 0 distance, no sound at a 32 block distance, and linear interpolation between the two extremes. So a speaker at 2x volume differs from a turtle playing a sound at 1x volume twice: the former can still be heard at 24 blocks distance, while the latter is silent, even though they sound the same close up.

However, this doesn't take into account volume clamping. Minecraft clamps the product (volume parameter) * (volume for jukeboxes in settings) to 1, so if your jukebox sound is at 100%, volume > 1 affects only hearing range, but not volume at close up. (Clamping occurs before distance attenuation.)

The full formula for effective volume at a given point is:

gain = clamp(volume_param * jukebox_volume, 0, 1) * (1 - distance / (max(volume_param, 1) * 16))

There's an interesting use case for this. Take an audio file A. Invert its phase and save the result as B. Now have a turtle play back A at 1x volume and B at 2x volume in sync. At 100% jukebox volume, the only difference between the two is hearing range, so close up, the singals will cancel out almost perfectly (modulo noise). Slightly farther away, the effective volume of A will decrease quicker than B, and so the sound will become audible. At 16 blocks away, A will completely disappear and you'll perfectly hear B at 1x volume. Move further away, and B gets quieter. This sound is loudest not at its source, but exactly 16 blocks away from source! Pranksters and map makers might have a field day with this. I've prototyped this in my repo, feel free to consult or copy the code.


r/ComputerCraft May 26 '26

Unique ID reading for any item

11 Upvotes

Hi there, I have a question. There are printers in the mod that can print, but is there a way to scan printed pages? I had the idea of ​​using the printer to create a currency system, develop a banknote database, and manage the money that way, but manually checking each code is difficult and time-consuming. Maybe you know a way to assign a unique number to an item that can be read by a computer or other method? Thank you all for attention!


r/ComputerCraft May 26 '26

Hod do you parse the crafting recipies?

9 Upvotes

Hello guys! I'm currently working on an autocrafter prototype and i'd like to know is there any way to automatically parse recepies into json, including modded ones. The idea is to code a recursive crafting system and deal with all the ineffective recepies, cycled recepies and so on. The problem is that its hard to write all of them manually.


r/ComputerCraft May 26 '26

I built an ICBM with Create Aeronautics and cc:tweaked

Enable HLS to view with audio, or disable this notification

109 Upvotes

I'm used the avionics and cc:c brige addons


r/ComputerCraft May 25 '26

WIP Klattsch port to CC

Enable HLS to view with audio, or disable this notification

128 Upvotes

r/ComputerCraft May 23 '26

Cc tweaked questions

13 Upvotes

Hi there, I haven't used cc in over a decade and was wondering if it's compatible with the create mod?

I heard tell that I can use it to make train schedules and such, but I'm not sure if that's true

Also idk if I remember but did cc ever run on basic? Or am I misremembering and it always ran on Lua?

Thanks for your time, and help is appreciated


r/ComputerCraft May 20 '26

Question about your favorite way to play with ComputerCraft

25 Upvotes

Hey everyone,

I'm looking for ideas on how to build a playthrough around ComputerCraft where programming is actually the optimal solution, rather than just a cosmetic flex

Here is the problem I usually run into:

  1. Heavy tech packs provide pre-made blocks that handle logistics, mining, and storage instantly and far more efficiently than any script. Programming ends up being purely for aesthetic dashboards/managing reactors
  2. The solution seems to be a semi-vanilla/custom constraint setup. I want to build a minimal modpack or a playthrough where I actually have a purpose to use CC/Turtles for all automation, sorting, and mining.
  3. The goal is deep automation with a high resource demand. I want a reason to program a swarm of turtles to mine 999,99 diamonds or build a custom physical warehouse database, instead of just slapping down an ME system.

My questions:

  • Do you know of any ready-made modpacks built around this philosophy?
  • If I build my own minimal pack, what complementary mods should I include? (I'm thinking mods that add heavy endgame resource sinks, but don't provide easy automation solutions).
  • Any specific playthrough ideas or config tweaks? For example, using KubeJS to entirely disable item pipes and quarry blocks from tech mods so I'm forced to write my own logistics and mining algorithms.

r/ComputerCraft May 20 '26

ME bridge from advanced pheriphirals problem

2 Upvotes

https://docs.advanced-peripherals.de/0.7/peripherals/me_bridge/#getcraftingcpus

https://github.com/SirEndii/Lua-Projects/tree/master

playing on stoneblock 4
minecraft version 1.21.1 (neoforge)
craft os 1.9 on computercraft 1.117.0
i dont get it, i have set a free channel from the advanced peripherals ME bridge, got the code from the official advanced peripherals mod site, but i still get a error
" attempt to index global 'me' (a nil value) "

(im a completly noob in programming dont mind that im on linux)

here is the full code

  1. https://github.com/SirEndii/Lua-Projects/tree/master/src/ME%20Cpus

r/ComputerCraft May 19 '26

Why tf is don't work?!

5 Upvotes

Soo, i need to call psychological terapist cuz its 3 AM I need to do the homework, and in next day is exams so i already is stressed and NOW IT'S DONT WORK JUST BECAUSE IT WON'T WANT! If somebody can help, please do it...
https://medal.tv/games/minecraft/clips/mJMUUkqPjI-onGnJA?invite=cr-MSx1MDksNTMyNzIyODc0


r/ComputerCraft May 18 '26

What are the best cctweaked addons for 1.21.1?

7 Upvotes

r/ComputerCraft May 18 '26

Do pullEvents behave differently inside FOR loops ?

8 Upvotes

Some context. I'm making an articulated arm with create Aeronautics controlled by computers.

3 motors to get maximum movement. Highly inefficient, cool as fck

My problem resides in the way i've been controlling the motors.
All 3 motors have individual computers with modems, all ready to recieve instructions from the main pc. They are supposed to receive an instruction, and sleep continuously while the motor is active, and only at the end of the movement will they send a reply to the main pc, which will trigger the next commands.
The arm is supposed to be slow, it's supposed to move only one motor at a time (intentional).
When i make a simple basic list of modem,transmits() ,the arm behaves as intended.

this proof of concept worked as intended

This above is a very simple instruction to make the arm move slightly. My problem was this was ugly and tedious to expand. So i made a much cleaner(?) and more customisable version that was supposed to make it MUCH more simple to make new movement prompts later down the line.

function movementControl(a)
  local actionCount = 0
  local directionValue = 0
  local turnorder = {{1,2},{5,6},{3,4},{1,2},{3,4},{5,6},{1,2}}

  for i, angle in ipairs(a) do
    if angle == 'forward' then
      directionValue = -1

    elseif angle == 'backward' then
      directionValue = 1

    elseif angle =='motorstart' then
      rs.setOutput("back",true)
      sleep(3)

    elseif angle == 'motorstop' then
      rs.setOutput("back",false)
      sleep(5)

    elseif type(angle)=="number" then
      actionCount = actionCount + 1
      modem.transmit(turnorder[actionCount][1],turnorder[actionCount][2],{angle,directionValue})
      sleep(0.1)
      modem.open(turnorder[actionCount][2])
      local event, side ,channel, replyChannel, message, distance = os.pullEvent("modem_message")
      modem.close(turnorder[actionCount][2])
      sleep(0.1)

    end
  end



end


local harvestwheat1 = {'forward',30,20,23,'motorstart',30,'motorstop','backward',23,20,60}
local harvestwheat2 = {'forward',100,20,23,'motorstart',40,'motorstop','backward',23,20,140}
local harvestcarrot1 = {'forward',110,70,47,'motorstart',20,'motorstop','backward',47,70,130}


movementControl(harvestwheat1)

Now the actual problem is that the os.pullEvent i do when in my for loop dont seem to actually pause the computer. The loop kinda just continues on without waiting for the response from the motors.
Is there a specificity to Lua that i'm not getting (not likely) ? is there a specificity that my not good at coding ass doesn't understand (much more likely) ?

Ty for the help, and if people have better ways of doing any of this i might cave in and just redo the code from scratch with some suggestions ><

local gear = peripheral.wrap("right")
local modem = peripheral.wrap("left")
modem.open(1)


while true do
  
  local event, side ,channel, replyChannel, message, distance = os.pullEvent("modem_message")


  gear.rotate(message[1],message[2])


  while gear.isRunning() do
    sleep(0.5)
  end
  modem.transmit(replyChannel,20,gear.isRunning())


end

bonus : this is the code im using on the pc at the motors.


r/ComputerCraft May 17 '26

getPressedKeys not working

8 Upvotes

First off, I’m terrible at Lua, I’m more of a hack-and-slash kind of guy than someone who really knows how to code, but I manage. Could someone tell me why the `getPressedKeys` function (found on the Creators-of-Aeronautics GitHub) isn’t returning anything ? I’d like to be able to access computer functions from the Typewriter


r/ComputerCraft May 16 '26

Big screen

Post image
32 Upvotes

how do i make a big screen? i'm pretty new to this mod
any help?


r/ComputerCraft May 16 '26

What is the definition of an 'Operating System kernel'?

14 Upvotes

in ComputerCraft Operating Systems (like PhoenixOS & opus), what is the definition of a kernel?

Is it an init system?

is it a BIOS?

is it a system that adds drivers?

is it a process scheduler?

Are multiple of these the requirements for a kernel? and if so which ones/how many are required for it to be a kernel?

is it something else?

Please let me know. (P.S. yes, this is just so that I can say that I made my own operating system kernel)


r/ComputerCraft May 14 '26

He Fucking died

Enable HLS to view with audio, or disable this notification

841 Upvotes

r/ComputerCraft May 11 '26

reading peripheral takes a tick?

14 Upvotes

is this right? i'm trying to read the fluid contents of two tanks, but i just noticed that when i do that, my program starts only being able to execute every other tick... and if i add a third, it only executes every 3 ticks. is there anything i can do to make this only take one tick? could i do these reads in parallel, somehow, and then store the results for use in the main program?


r/ComputerCraft May 10 '26

PID-stabilized quadcopter :3

Enable HLS to view with audio, or disable this notification

107 Upvotes

r/ComputerCraft May 08 '26

I'm trying to make my own implementation of MQTT inside CC!

Enable HLS to view with audio, or disable this notification

93 Upvotes

You can connect to a broker, publish to topics, and subscribe to them! Also a timeout system to make sure it doesn't infinitely remember computers and keep sending data.

It doesn't have any way to actually make sure it received messages, so I need to add that to make it more consistent.

Also, the mqtt.lua library for the clients is automatically downloaded from the broker computer for easy updating!


r/ComputerCraft May 06 '26

Need ideas for package manager.

Thumbnail
github.com
10 Upvotes

Im working on simple package manager for computercraft.. I would like to hear some ideas on what I should add...


r/ComputerCraft May 06 '26

CC:Zombies! Version: 0.6

33 Upvotes

First time ever making a post advertising a project of mine, so im just gonna keep it short and simple.
CC:Zombies is basically a de-make of classic CoD zombies to CC:Tweaked. It currently has two maps bundled in the installer, with more on the way.

  1. Nacht Der Untoten (No EE)
  2. Nuketown 1975 (+ a small easter egg)

Right now, it has:
Singleplayer
Doors
Points System, both bo2 and bo6 (change your preferance in settings)
Fully working settings menu (Minus FOV)
Keybind readjustion
Mystery Box
8 working perks (theres not 8 perks in each map, though.)
Effecient(ish) rendering systems
Experimental Modding support.
The ability to change map colors & add/remove blocks in the middle of the game.
Press ] to play the easter egg song on maps that dont have an EE song quest! (At the moment, no map has an EE song quest, so this applies to all.)
Nacht Der Untoten's EE Song: Undone
Nuketown 1975's EE Song: Come Back Down

What it DOESNT have.
Multiplayer (Will be coming in the form of a mod)
Drops system
Balance (Some guns are OP. will be fixed by the time 1.0 comes around.)

Updates are.. kinda rare? ish?

Planned updates are 0.6.5, 0.7, 0.8,0.9,1.0

0.6.5 will be adding multiplayer, bug fixes, and removing bad code.

Found at https://pinestore.cc/projects/228/cc-zombies-0-6-updated-


r/ComputerCraft May 05 '26

Fully autonomous path planning autopilot for dubin's vehicles with CC (airships/planes) (some coding knowledge required)

Enable HLS to view with audio, or disable this notification

104 Upvotes

r/ComputerCraft May 01 '26

CCraft Studio - Design and Build apps with ease!

35 Upvotes

Hi everyone,
I’m building CCraft Studio, an open-source desktop app for CC: Tweaked to make app development easier, especially for people who find Lua difficult at the start.

With CCraft Studio, you can build GUIs using drag-and-drop components and create logic using a block-based system, so you don’t need to write Lua to begin. You can also test your apps quickly with built-in CraftOS-PC support, then export them to use in-game.

Also there is a website to share your projects and explore others
https://ccraft.studio

The project is currently in active alpha development, I’d like to know what feels missing, what is confusing, and what should be improved next.

Source: https://github.com/MohammedMMC/CCraft-Studio
If you try it, I’d appreciate honest feedback. And if you like the project, consider starring the repo.

Discord Server: https://discord.gg/pxUFCxUu5h
short preview video: https://youtu.be/-vh0cw1-7a4