Skip to content
LostEnginePublic

About

An open-source Minecraft: Java Edition resource pack minimizer written in Rust.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

PackOBF,

an open-source Minecraft: Java Edition resource pack minimizer written in Rust.

PackOBF is a resource pack minimizer and checker for Minecraft: Java Edition. PackOBF is able to reduce the size of a resource pack and detect issues with PNG/OGG/JSON files. By parsing these files like Minecraft would do, it can detect issues like missing required fields, wrong value types in JSON files and malformed PNG/OGG files.

Usage

PackOBF comes with a command-line interface, here is how to use it:

Usage: packobf_cli [OPTIONS] --input-file <FILE> --output-file <FILE>

Options:
  -i, --input-file <FILE>                        
  -o, --output-file <FILE>                       
  -p, --preset <PRESET>                          [possible values: fast, normal, best]
  -l, --log-level <LOG_LEVEL>                    [default: info] [possible values: info, warning, error, none]
      --cache-file <CACHE_FILE>                  
  -c, --compression <COMPRESSION>                [default: normal] [possible values: fast, normal]
      --shader-compression <SHADER_COMPRESSION>  [default: minify] [possible values: none, minify, minify-and-obfuscate]
      --rename-files                             
      --block-unzipping                          
      --corrupt-png-files                        
      --num-threads <NUM_THREADS>                
      --target-version <TARGET_VERSION>          [possible values: v1-21-1, v1-21-2, v1-21-4, v1-21-5, v1-21-6, v1-21-7, v1-21-9, v1-21-11, v26-1, v26-2, v26-3]
  -h, --help                                     Print help
  -V, --version                                  Print version

Tip

Using --preset is a good choice when trying PackOBF for the first time, possible values are: fast, normal, and best.

Alternatively, you can use PackOBF in your browser at https://packobf.misieur.me/ however, it will be way slower than the native app because of internet browser restrictions. PackOBF on internet browsers is deprecated.

Note

See OPTIONS for more information about each option.

List of features

JSON Files

PackOBF parses JSON files in memory and knows for JSON files in items, models, blockstates, fonts, sound_definitions, and atlas folders which fields exist, which ones are required, their type (string, integer, etc.) and their default value. With all of this data, PackOBF removes fields that are unknown by Minecraft, values that are already the default one, spaces and line breaks.

Note

For any other JSON file, PackOBF only simplifies them, removes spaces, newlines, etc.

PNG Files

PackOBF uses an oxipng fork to losslessly minimize PNG files.
Moreover, if you enable the Corrupt PNG Files option (--corrupt-png-files), your PNG images will be corrupted and unreadable for lots of image software except for Minecraft, and they will have some bytes removed.

Resource pack file

PackOBF has its own way of writing ZIP files, which will break popular ZIP file extractors but works with Minecraft. This way of writing ZIP files is not conventional, but it allows saving file size when duplicated files are in the resource pack and does not write useless data like folders and other fields on the ZIP file. PackOBF by itself breaks some ZIP file software, however, the jar -xf output.zip command from Java will still be able to unzip it. By enabling the Block resource pack unzipping option (--block-unzipping), it will totally block JAR and lots of software (including JD-GUI, Minecraft mods) from unzipping your resource pack while Minecraft can still load it.

Renaming files

PackOBF is able to rename resource pack overlays, models, textures and sounds that don't override Minecraft files to smaller names (example: assets/_/textures/i/a.png instead of assets/minecraft/textures/item/my_cool_item.png) while keeping everything working.

Core Shaders (Experimental/Deprecated)

PackOBF is able to parse core shaders, minify them, rename variables and functions to short names. It can be enabled using the --shader-compression [none, minify, minify-and-obfuscate] option, minify-and-obfuscate will rename variables and functions which might break your shaders, while minify does not.

License

PackOBF is open-source software (OSS) distributed under the MIT license. See LICENSE.md for complete license.

Note

No code from any other project has been "stolen" or used as inspiration, all researches were made using public server resource packs and online resources such as ImHex.

How to use the library (for developers)

See How to use the library (for developers)

About

An open-source Minecraft: Java Edition resource pack minimizer written in Rust.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages