Files
wiki/Adding-support-for-a-new-Mod.md
T

5.5 KiB

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.

1. Set up Minecraft

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.

2. Fork the repo

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.

3. Create a new directory

Open up your clone of the Crafting Guide repository, and create a new directory: ./src/data/<mod_slug>/ where the mod_slug is the slug generated from the Mod's official name (see: About Slugs).

2. Export the images

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> ./src/data/<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.

3. Create the data files

Create the mod's overall data file by following the Mod Data Format guide to create the ./src/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 ./script/verify script included in the repo.

4. Test Locally

As you're going along, you may find it helpful to view your new mod in the website. To do so, first add your new file name to the DefaultMods list in ./src/scripts/constants.coffee. Then, on the command line, use the grunt clean build command to rebuild the project. Finally, run ./scripts/server to start a local server. At this point, you should have your own version of Crafting Guide (with your mod included) running at [http://localhost:8000] (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.
    • Check that the image file was copied to the ./dist/data/<mod_slug>/images directory. If not, you may need to rebuild your project using grunt.
    • 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 or tools command.
  • 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.

5. Submit a pull request

Finally, you're almost done! Push your changes up to your fork of the 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 look good, you're changes will be integrated into the main repo.

6. Review in staging

All changes are first deployed to a staging site at http://new.crafting-guide.com for testing. When this is done, you'll be notified and asked to perform one last check. If everything looks good, then simply reply that you're satisfied, and your changes will be promoted to the main site.