MC-Repack
A repacking tool for Minecraft mods to optimize size and loading speed of mods.
Why?
MC-Repack was created with a simple thought in mind: How many Minecraft mods and resource packs come with unoptimized files? And I don't mean just pretty-printed JSON files. You will be surprised that in some cases a PNG file's metadata added by Photoshop is much larger than its content.
One other important thing is that MC-Repack determines if a file really needs to be compressed.Most PNG files and smaller JSON files will usually be stored uncompressed. This kind of operation saves bytes if a "compressed" form is larger than original. Also, uncompressed data can be loaded faster.
This is a great tool that can be helpful for:
- Mod developers and resource pack makers – they can provide mods with smaller file sizes, optimized PNGs and correctly formatted JSONs
- Players and server owners – optimized and repacked files can speed up Minecraft load time while using less memory.
MC-Repack shows all errors happened during repacking. Most of them are errors that can be simply ignored (like "trailing comma at line X column Y").
Features
- Minifying JSON files
- Optimizing PNG files
- Optimizing TOML files
- Recompressing NBT files
- Optimizing OGG audio files
- Removing unwanted files – some project files (from Blender, Photoshop, etc.) are mistakenly packed in mods. This operation will detect and remove (ignore while repacking) these files.
- Stripping unneeded Unicode BOM (sometimes found in many files)
- Removing comment lines in many file types: cfg, obj, mtl, zs, vsh, fsh
- Recompressing files more efficiently
Original vs repacked
MC-Repack can save about 10% of file size for larger mods (see data below). It may be difficult to understand, but JAR files are already compressed. The difference of uncompressed files is usually much larger.
-
MineColonies
Tested file: minecolonies-1.19.2-1.0.1247-BETA.jar
74,630.5 kB65,209.6 kBSaved: 9,421 kB -
Ice and Fire
Tested file: iceandfire-2.1.12-1.18.2-beta2.jar
21,017.8 kB15,959 kBSaved: 5,058.8 kB -
Blue Skies
Tested file: blue_skies-1.19.4-1.3.24.jar
81,271.3 kB77,476.6 kBSaved: 3,794.7 kB -
Blood Magic
Tested file: BloodMagic-1.18.2-3.2.6-41.jar
14,021.5 kB12,140.6 kBSaved: 1,880.9 kB -
Supplementaries
Tested file: supplementaries-1.19.2-2.3.7.jar
14,233.6 kB12,815.9 kBSaved: 1,417.7 kB
Check all tested mods HERE!
Usage
After installation, the tool can be run by just double-clicking its file. It can also be used by typing the mc-repack
command in a terminal/shell.
When a file path is provided, then MC-Repack will repack the file contents into a file ending with _repack.jar
. If a path is a directory, then all files inside (non-recursive) will be repacked.
More options are provided by typing mc-repack --help
in a shell/terminal.