Skip to content

Resource Pack Generator

Gili Barlev edited this page Oct 19, 2024 · 3 revisions

If manually converting mp3s and hand-editing JSON isn't your idea of a fun time, this project provides an alternative in the form of a stand-alone and portable (read: no installation or setup required) resource pack generator.

Installation

  1. Download the executable from the release page that matches your operating system and your version of the mod.
  2. Depending on your operating system and security settings, you may need to explicitly make the resource pack generator executable (on *nix systems, you can do this from a terminal by running chmod u+x /path/to/FoxNapRPG or by going into Properties in most file managers).

You can also build the generator from source.

Generating Resource and Data Packs

Place the generator executable in an empty folder, then move any music you want to turn into records into that folder. There is no limit to the number of tracks you can include, and they do not need to be pre-converted to Ogg. The only requirement is that the files have to be decodable by ffmpeg.

Pro Tip: if your music files include metadata, the title and artist name will get automatically extracted, and any album art will be used to help generate the music disc texture.

When you're ready, simply double-click the FoxNapRPG executable. A terminal window may pop up showing progress of the resource pack creation, and before you know it you should have some new files in your current directory:

  • FoxNapRP.zip is the resource pack containing all your converted songs and music disc textures, and you can throw that into your Minecraft resourcepacks folder
  • FoxNapDP.zip is the datapack that defines all the properties of the tracks themselves. You'll need to put this pack into the datapacks folder of any world where you want to use your music (see note below about multiplayer).
  • foxnap.yaml needs to go into your Minecraft config folder. This tells the game how many music discs to enable for you.

Advanced Options: Command-Line Options

You can also run the generator from the command-line, which will give you access to a bunch of additional customization options, such as setting the directories to search for music or the locations the generated resource pack and mod config should be saved.

For further details, run:

$ ./FoxNapRPG --help

from the folder where you saved the generator executable.

Advanced Options: Spec File

The Resource Pack Generator also allows you to finely tune the resource pack generation behavior via a configuration file. The pack generator currently supports the following formats:

  • INI (.ini, .cfg, .config, .conf, .txt)
  • JSON (.json)
  • CSV (.csv, .tsv) where each entry specifies a single track via either its full path or its file name.

For each track, you can specify:

  • num: a track number (to override the tracks bundled with the mod or just to make sure the tracks are ordered consistently)
  • description: the name to give to the track (if you don't want this read from the ID3 tag)
  • hue: the color to give to the vinyl part of the record template
  • use_album_art: whether the album art (embedded in the track tag data) for the inlay

To use a spec configuration file when running the resource pack generator, use the -s command-line flag, e.g.

$ ./FoxNapRPG -i /path/to/my/music -s track_specs.csv

Example spec files can be found here.

Building the Resource Pack Generator from Source

You can also build the generator from source.

  1. Clone this repo
  2. Download or install a version of ffmpeg that can decode files from your music library and that has support for encoding using libvorbis. Put the executable (or symbolic links to the executable) in the foxnap_rpg/bin folder.
  3. Create and activate a virtual environment using python 3.10 or above
    1. If you have a conda-based environment and package manager installed on your system, such as mambaforge, you can use the project's dedicated dev/build environment, creatable from the repo root via mamba env create -f environment.yml (substitute conda for mamba as needed)
  4. From the repo's root, with your virtual environment activated, run python -m pip install .
  5. At this point, you have two options:
    1. Use FoxNap as a python package, with $ FoxNapRPG available from the command line
    2. Create a stand-alone executable using pyinstaller ( included in the conda environment). The scripts ./rpg-build.sh for *nix or .\rpg-build.bat for Windows are available for reference.