Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.
I have been running a private Minecraft server for myself and some friends for a while now. We have been playing through a variety of Modpacks, starting with Tekkit then Voltz and yesterday we switched over to YogCraft.
On Minecraft servers you have the option to force users to download and automagically install a texture pack when they join. I’ve never tried this before but I thought I’d give it a go as I was starting a new server. The way it works is that you need a zip file containing the texture pack somewhere publicly accessible on the internet and you modify the server.properties file to tell it where to find it. I tried this but immediately realised that there is a limit of 10Mb for texture packs served in this way and the one I had was 38Mb!
A little research showed me that there are some command line utilities to optimize PNG files which might help reduce the file size. A guy who knows a lot about PNGs has made them more user friendly by making a free drag and drop PNG optimiser called ImageOptim. I gave it the texture pack to chew on, 1200+ images that come to 40.7Mb before zipping, and left it to cook overnight. I knew I was being overly optimistic seeing as I would need a 74% reduction overall to get it within the maximum allowed file size.
Additionally I found out that when you compress files on a Mac it includes all of the hidden system files (resource forks) in the archive. For a texture pack the system files are redundant and potentially increase the overall file size. Fortunately there are several applications available that allow you to create zip archives without the system files. I already use a free application called Keka to deal with archives and found that it offers this facility.
So after running all of the images through ImageOptim I was left with a folder weighing in at 32.1Mb. I then compressed it at the highest setting with with Keka telling it to “exclude Mac resource forks” and was rewarded with a 29.9Mb file. For the sake of comparison using the built in Compress command in OS X created a 30.5Mb zip file so excluding the resource forks saved 0.6Mb.
The net result is a decrease in file size of a little over 21% which although significant is sadly shy of the 74% saving required. So I guess I’ll just email my friends a link to the zip and instructions on how to install texture packs for Minecraft.
For the sake of anyone arriving here from google the folder for texture packs in YogCraft on the Mac is: /Applications/YogCraft/minecraft/texturepacks