Version: 2.1
Install: pastebin get Rc1PCzLH music
To update from the original version, run delete music
first.
Run: music
- Install the CC: Tweaked mod to your world/server. Make sure you're using version 1.100.0 of the mod (released December 2021) or newer, or it won't work.
- Craft an Advanced Computer and connect it to a speaker, or craft an Advanced Noisy Pocket Computer.
- Open the computer and then drag and drop the
music.lua
script on top of the Minecraft window to transfer the file over. - Run the
music
command and enjoy your music!
- "No speakers attached" when using an Advanced Noisy Pocket Computer: Restart your Minecraft game. If that doesn't work, restart the server.
- "Module 'cc.audio.dfpwm' not found" error: Make sure you're using version 1.100.0 or newer of the CC: Tweaked mod (December 2021 or later). New audio features were added in this version, so it won't work in 1.99.X or below.
Important
Self-hosting is not required to use this program. You can simply use the pastebin command above.
The ComputerCraft program connects to a web server to download the music files. This server is hosted with Firebase Cloud Functions. The server downloads YouTube videos using an unofficial API on RapidAPI.
- Download this repository to your computer into a folder.
- Create an account for RapidAPI and sign up for the free tier of "YT-API" here: https://rapidapi.com/ytjar/api/yt-api
- Copy and paste your API key into the file
functions/index.js
where it says "YOUR API KEY HERE". Leave the quotes. - Sign up for Firebase and make a new project at https://firebase.google.com/. A billing account is required even for the free plan. The limits of the free plan should be plenty for most people.
- Install Node.js version 20 from https://nodejs.org/en/download/.
- In your terminal, run
npm install -g firebase-tools
to install Firebase. - In your terminal, navigate inside the project folder. Run
firebase login
and follow the steps. - Run
firebase init functions
and follow the steps. Choose JavaScript. Don't choose to overwrite thefunctions/index.js
orfunctions/package.json
files when it asks you. Install the dependencies when prompted. - Run
cd functions
to go inside thefunctions
directory and then runnpm install
to install more dependencies. - Run
cd ..
to go back and then runfirebase deploy
to deploy your new Cloud Function. - After the deployment is complete it will give you the Function URL. Copy that URL into the first line of
music.lua
.