Skip to content

Step 2: Setting up DefaultMod

Alchyr edited this page Dec 8, 2021 · 2 revisions

At this point, you should have DefaultMod open in your IDE, but there are a bunch of errors. In this step, you'll be fixing those errors.

Dependencies

For a mod to work, it needs to interact with existing code, such as Slay the Spire itself, ModTheSpire, BaseMod, and possibly others. Dependencies are how the IDE knows what you need.

First, you'll need to make sure you have all of the dependencies downloaded.

  1. Make sure Slay the Spire is installed.
  2. Subscribe to ModTheSpire, BaseMod, and stslib on the Steam Workshop if you haven't already. If you don't have the game on Steam, these instructions may be helpful. Do note that not being able to upload to the workshop will greatly limit how many people will see your mod.

Setting up your pom

Open the pom.xml file.

The pom.xml file is the key to your project. It contains information such as the name, version, description, and of course, dependencies. To work, these dependencies need to point at files that exist on your system.

If you are using Steam:

Simply change this line to wherever you have your Steam games installed. If you aren't sure where this is, go to any game in your Steam Library and access its properties and browse local files.

Not on Steam:

A bit further down in the pom.xml file is this section.

For each individual dependency, you'll have to update the <systemPath> to be the full filepath of wherever they are.

After updating:

You may also update the name of your mod/author at the top of the pom.xml at this time. If you've updated your pom.xml correctly, the dependencies should no longer be red, and there will be this small popup.

Clicking it will make your changes actually take effect.

Setting project JDK

This step is necessary so that the IDE knows what version of Java your project is supposed to be. Which in this case, is 1.8.

Open the project structure, which can be found under the Settings button at the top right, or using the Ctrl+Alt+Shift+S shortcut.

This is what you're interested in. If it says 1.8 java version "1.8.0_232" you're good to go. If it doesn't, click the dropdown. If 1.8 is an option, choose it. Otherwise, choose Add SDK -> Download JDK....

Change the version to 1.8. Any of the vendors should work fine, as there are only minor differences between them.

Once you have your project's SDK set to Java 1.8, you can click OK.

From here, you may move to the original DefaultMod tutorial, as the only the initial setup was out of date.

https://github.com/Gremious/StS-DefaultModBase/wiki/Step-2:-Setting-up-the-Default-Mod-for-Packaging

Clone this wiki locally