DEV Community

Fisher
Fisher

Posted on

How I host Minecraft Server ResourcePacks on Github

Github is dope.

Yes, we all knew this. Anyways, with the addition of Actions to your team's workflow, you can make the process of editing a resourcepack, automatically building it, and shipping it to your live production Minecraft server so very easy.

Initial thoughts & Planning

Before this switch, we (being SupremeObsidian) were using Dropbox to host the resourcepack. This was a quick and easy solution, as you could get the share link from Dropbox, and add it to your server. However, the downside to this was that this was not a good solution for a team working on a resourcepack that needed to be constantly uploaded to the server so that everyone could see the changes live (even though at the moment, we are only in the development stage).

I started thinking maybe we could use releases in Github for this. This raised the issues:

  1. Versions (v1.0.0) in the download url for the release that we would have to change every time, so this wouldn't work
  2. The project directory in the sources zip

If you don't know what I'm talking about on the second point, when you make releases or download the cloned zip, you get the zip with a directory in the root, so all of the repository files are now in RepositoryName-version.zip/RepositoryName/files-here.
This would not work, as the resource pack zip had to have the assets, pack.mcmeta, and pack.png in the root of the zip.

And then it hit me.

We could use Github actions for this purpose, of creating a zip, and uploading it to the repository, and fetching the pack zip from the raw url of the file. This works great.

I am no expert in Github actions, and I had never put one together before until a day ago, but I managed to get it to do exactly what I wanted.

To explain a little, the action checks out to the main branch, pulls latest files, deletes the current release.zip, zips the files in current directory, adds any edited files (in this case release.zip), commits, and pushes.

Closing and specifics

This whole process takes ~30 seconds on average to complete, and then you have your brand spankin' new resource pack zip that works to download with Minecraft through the raw url.

Note: The raw url for github files that you should use is https://github.com/user/repo/blob/branch/release.zip?raw=true
That is, if your release.zip is in the repo root.

Also of Note: I use WorldResourcePack for my resourcepack downloading on the server. Any time we update it in github and zip the files with the action, we run /wrp generatehashes and this will generate new hashes for the resourcepack(s) that you have on your server so that when players join, their clients will compare the local hash to the new one and realize they are different, hence downloading the new version.

Thanks for reading my first real dev.to article, and if you made it this far, I commend you, and give you a šŸŖ. What a champ.

Top comments (1)

Collapse
 
volved profile image
Volved

Hi, would you be able to help me set this up for my server resource pack. I'm trying to automate my process of updating the resource pack and this is my best choice at the moment, I know this is a few months old but any help would be great!