szeweq / mc-repack Goto Github PK
View Code? Open in Web Editor NEWA Minecraft mod repacking tool to optimize size and loading speed of mods.
Home Page: https://szeweq.xyz/mc-repack
License: MIT License
A Minecraft mod repacking tool to optimize size and loading speed of mods.
Home Page: https://szeweq.xyz/mc-repack
License: MIT License
Hi,
just found your project and this looks rather interesting.
Here's a couple of improvements/changes that would be amazing if they could be added:
STORE
files. then add DEFLATE
compression at the final level.Based on a quick little command I ran, I recorded the frequencies of different file types present in jar files.
The command used was
mkdir ./tmp
# copy a bunch of jars into this temporary directory
for i in *.jar; do
unzd "$i"
done
find . -type f \( -iname '*.jar' -o -iname '*.zip' \) -print0 \
| xargs -0 -n1 unzip -qqql \
| perl -0777 -C -pe 's/.*?\/?(.*\.(.*))?/\2/g' \
| sed '/^$/d' \
| sort \
| uniq -c \
| sort -n \
| awk '{s+=$1; print $0} END {print s}'
# note: the last line is the total count of all files. this isn't by any means perfect, but whatever.
Here are the results from that:
% of files in jar | file extension |
---|---|
51.13% | .class |
31.34% | .json |
10.01% | .png |
2.5% | .nbt |
1.69% | .ogg |
0.51% | .MF |
0.4% | .jar |
0.28% | .mcmeta |
0.23% | .xdelta (I have no clue what this file format is) |
0.23% | .md5 |
0.21% | .properties |
0.14% | .at |
0.1% | .txt |
0.1% | .accesswidener |
0.09% | .xml |
0.07% | .md |
0.06% | .js |
Based on this, I think it might be reasonable to consider adding optimization processes for the following files:
.ogg
files. These can possibly be optimized using ffmpeg. (you could possibly consider decreasing the quality to increase compression. a cli arg for this would be nice.) (there seem to be a couple of crates that provide ffmpeg support, so those could be considered).nbt
files. They are just gzip compressed binary data, so uncompress then recompress with level 9, then STORE
them..properties
files. Blank lines can be stripped from these. (it doesn't make up a large amount of the files, but it's an easy addition).accesswidener
files. Blank lines can be stripped from these, as well as any lines starting with a hash (#
) are comments. (it doesn't make up a large amount of the files, but it's an easy addition)It's probably not worth it to consider additional compressors for files not in that table as they appear so infrequently it just won't make much of a difference.
Do note however, that this is not based off of the size of the files in the jar, rather just their count. may make something basic to calculate this using the size later.
I have a suggestion which would be useful for me and perhaps for other creators:
I am currently having to use the following combination:
- name: Install tools
uses: baptiste0928/[email protected]
with:
crate: mc-repack
- name: Clean files
run: mc-repack "/home/runner/work/[repository-name]/[repository-name]/build/libs/" --out "/home/runner/work/[repository-name]/[repository-name]/build/libs/clean/"
Note:
If there is anything I can do to help, let me know.
MC-Repack should have a minifier for handling JAR files stored inside another JAR file. (Suggestion from #2)
NBT files (from Notch's design) have its data compressed using Gzip. MC-Repack should have a special minifier for checking and recompressing this file format. (Suggestion from #2)
It should use either gzip
or zopfli
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.