压缩 & 混淆
为了让玩家更快的下载资源包 (并节省你的流量),你需要对资源包进行压缩
或者为了防止他人轻易的偷走你的资源包,你也需要对资源包进行混淆
推荐使用 PackSquash 进行压缩和混淆,注意:本部分内容仅限于 ZIP 层面的压缩 & 混淆
前往 官网 下载即可
PackSquash 需要你在目录下创建配置文件 packsquash.toml 才可以使用
然后向文件中写入以下内容
pack_directory = 'C:\path\to\pack(填写你的资源包所在目录)'然后在当前目录运行 packsquash packsquash.toml 即可
指定输出文件位置
Section titled “指定输出文件位置”output_file_path = 'C:\path\to\result\pack\zip\file\my_pack.zip'zip_spec_conformance_level = 'pedantic'默认取值为 pedantic,表示完全遵循 ZIP 文件规范,所有的查看和托管都可以识别
disregard 为加料模式,包括提取保护和改进的内部 ZIP 文件结构压缩,会获得更好的性能,非常推荐
ZIP 混淆
Section titled “ZIP 混淆”size_increasing_zip_obfuscation = true当使用disregard模式时,启用此选项将增加对生成的 ZIP
文件进行查看、提取或篡改的保护,这会略微增加其大小。此选项不影响是否添加 不增加文件大小 的保护,并且如果 ZIP 标准不提供保护,则没有任何影响
percentage_of_zip_structures_tuned_for_obfuscation_discretion = 100当此选项设置为 0(最小值)时,每个 ZIP 记录将优先存储以提高压缩性。相反,当设置为 100(最大值)时,每个 ZIP 记录将优先存储以提高保密性。其他值将结合提高保密性和压缩性。
OGG 混淆
Section titled “OGG 混淆”ogg_obfuscation = truetwo_pass_vorbis_optimization_and_validation = true如果开启该选项,生成的 Ogg 文件将会被破坏,使得它们在 Minecraft 之外难以播放
ItemsAdder Armor 在使用 PackSquash 后无法正常工作
Section titled “ItemsAdder Armor 在使用 PackSquash 后无法正常工作”在配置文件中添加如下内容
['**/*?.{fsh,vsh,glsl}']minify_shader = false
['**/textures/models/armor/*?.png']image_data_compression_iterations = 0skip_alpha_optimizations = truecolor_quantization_target = 'none'推荐配置文件
Section titled “推荐配置文件”zip_spec_conformance_level = 'disregard'size_increasing_zip_obfuscation = truepercentage_of_zip_structures_tuned_for_obfuscation_discretion = 100pack_directory = 'src'output_file_path = 'resources.min.zip'zip_spec_conformance_level = 'disregard'zip_compression_iterations = 255never_store_squash_times = true
['**/*?.png']image_data_compression_iterations = 255