-
Notifications
You must be signed in to change notification settings - Fork 191
Adding support for a new Mod
Crafting Guide represents all its data in the form of simple configuration files and images. Anyone with a text editor can easily create everything needed to add a new mod. Here's a guide to how create everything from scratch.
Create a fork of this repo in which to make your changes. If you're not sure how to do this, check out GitHub's help page to get started. This will guide you through the process starting from the GitHub website all the way through having the code on your own computer. You'll need both the crafting-guide and crafting-guide-data repos. They should both be cloned into the same directory.
Crafting Guide comes with a number of different command-line scripts for processing data and testing. You'll need to get your machine set up with a few command-line tools to run them before you can begin.
NOTE: If you're using Windows (instead of MacOS or Linux), you'll want to perform all of these commands using the Git for Windows shell. You will also need to install rsync manually. Finally, windows users should leave out the word sudo
from all commands.
Start by opening up a terminal window checking to see if you already have Node.js or Ruby installed on your machine by running the following commands: which node
and which ruby
. If you have them installed, you'll see where they're installed. If you don't have them, then there will be no output. If either is missing, download and install the most recent version of each from their websites: Node.js and Ruby.
Next, open a terminal and navigate to your new local repo. Create a file called .env
with the following contents:
WEBSITE_SERVER_PORT=8080
Finally, run the following commands to get the rest of the tools you need and build everything locally.
sudo npm install -g browserify
sudo npm install -g coffee-script
sudo npm install -g grunt-cli
sudo npm install -g nodemon
gem install sass --version "= 3.4"
cd ../crafting-guide-data
npm install
grunt test
cd ../crafting-guide
npm install
grunt clean build start
./scripts/start
At this point, you'll have a local server running the CraftingGuide website at [http://localhost:8000] (http://localhost:8000). As you work with your mod, you should verify your work on your local website. Your working directory will be in the CraftingGuideData repository: all the remaining commands deal with that repository.
Open up your clone of the Crafting Guide Data repository, and create a new directory: ./data/<mod_slug>/
where the mod_slug
is the slug generated from the Mod's official name (see: About Slugs).
The easiest way to access all the raw information is through the game itself. Start by installing both the mod you want to add and NotEnoughItems (along with its dependency, CodeChickenCore). Then, launch Minecraft, and create a new world for yourself.
When you pop open your inventory, you'll see the NotEnoughItems (NEI) interface. Click on "NEI Subsets", then "Mod", and finally, hold Shift and click the mod you want to work with. This will restrict the NEI display to only the items from that mod.
Next, you'll want to drill through the Options, Tools, and Data Dumps buttons. Mid-way down, you'll see an "Item Panel" row. Click the "CSV" button until it reads "PNG", and click the button to its left until it reads "48x48". Finally, click the "Dump" button.
Now, if you check your world's directory, you should see a dumps/itempanel_icons
directory containing all the images for that mod's items. These will need to be renamed by converting each file name into the slug version.
Next, run the ./scripts/convert-nei-dump <path to .../dumps> <mod> <version>
command to convert the images into the format needed by Crafting Guide. This will also give you a starter data file for that mod version.
Create the mod's overall data file by following the Mod Data Format guide to create the ./data/<mod>/mod.cg
file.
Next is the hard part. From the last step, you should have a mod-version.cg
in your Mod's current version directory. Now, for each item whose image you exported, follow the Mod Version Data Format reference to enter all the groups, items, recipes, and other information needed to describe your mod.
Be sure to test frequently using the grunt test
command, or run grunt watch
to continuously run tests as you work.
As you're going along, you may find it helpful to view your new mod in the website. To do so, switch back to the CraftingGuide repository, and add your new file name to the DefaultMods
list in ./src/coffee/constants.coffee
. Then, run grunt build
to update the website. It's often handy to open a second terminal window and run grunt watch
in the crafting-guide-data
repo to continuously test the data files as you're working, but keep in mind that you'll need to restart the command if you happen to add a new file. Recall that you local server should still be running at http://localhost:8000.
Test by crafting the various items in your mod, and walking through the steps to ensure everything makes sense. In particular, you should look for:
- Do the proper images show up for each item? If not...
- Check that the item name is correct in the data file, and that the image file has the matching slugified version of that name.
- If the item is gatherable, but not craftable, make sure you added it with the
gatherable: yes
command even though it doesn't have any recipes.
- Do the recipes show each item in the correct place on the grid? If not...
- Check that the pattern's numbers are correct. Remember, it starts counting at 0, not 1.
- Check that you added the right number of
.
s to position things in the right places. - Check that you spelled each item correctly in the
input
section
- Does anything show up in "Items you'll need" which shouldn't? If so...
- Check that the spelling is correct. If it's wrong, then you have a mistaken in an
input
ortools
command.
- Check that the spelling is correct. If it's wrong, then you have a mistaken in an
- Can you add everything (even non-craftable items) to the "Items you have" section? If not...
- Make sure you added those items to the data file, even if they don't have recipes.
Finally, you're almost done! Push your changes up to your fork of the crafting-guide-data
repository, and submit a pull request which includes your work. Someone will review your work, and will probably point out a few things to correct. Make those changes locally, and push them up to your fork just as you did with the original set of changes. Once everything looks good, your changes will be integrated into the main repo.