-
Notifications
You must be signed in to change notification settings - Fork 22
BasicMod Setup
At this point, you should have BasicMod open in IntelliJ, but if you open any files you'll see a large number of errors. This step will fix those errors.
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 dependencies. We'll go through everything you should change in order.
Starting from the top:
modID
is the ID of your mod. It should be unique to your mod to avoid any unintended interactions with other mods. Avoid putting any spaces in your modID
; they will cause problems if you do. Ideally, it should also be lowercase. Certain uppercase letters can cause issues. This should be the only place you need to set the mod ID. In the localization files, ${modID}
will be replaced by your actual mod ID by Maven, when you package your mod. In code, makeID
should be used (you will see this later).
You can set the modID
and author
at this time.
After that come the Steam paths. These will be used to load the dependencies. You only need to adjust the one for your system. Keep reading for more details.
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.
- Make sure Slay the Spire is installed.
- Subscribe to
ModTheSpire
,BaseMod
, andStSLib
on the Steam Workshop if you haven't already. If you don't have the game on Steam, these instructions may be helpful. If you don't have the game on Steam, you won't be able to upload to the workshop, which will greatly limit how many people will see your mod.
The pom.xml
file is set up to find the necessary files where they are downloaded from the Steam workshop.
All you should have to do is change the line for your operating system to match wherever you have Steam installed. If you aren't sure where this is: go to Slay the Spire in your Steam Library, access its properties, and browse local files.
The file path should end with steamapps
.
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. An example might be something like <systemPath>C:/Users/You/Downloads/desktop-1.0.jar</systemPath>
.
The last bits of information to change are the mod's name, version, and description.
Name and description can be whatever you like. For version, you'll want to update it whenever you update your mod. Generally, for small updates you increase the last number, for larger updates you change the middle number (and reset the last one to 0), and for really big updates you'll change the first number (and reset the other two).
Though you've edited the file, until you load the changes, it won't actually do anything. If you've updated your pom.xml
correctly, there should be no errors in the file, and there will be this small popup.
Clicking it will make your changes actually take effect. If you do not see this popup, you can hit the shortcut displayed in the screenshot (Ctrl+Shift+O) instead.
This step is necessary to make sure the IDE knows what version of Java your project is intended to use, which in this case, is 1.8
. It starts on a default setting, which may not be correct.
Open the Project Structure, which can be found under the Settings button at the top right, or using the Ctrl+Alt+Shift+S shortcut.
If it says 1.8
under Project SDK
, 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.
Setting the project's SDK to 1.8 should also set the Project language level
to 8. If it doesn't, set it to 8.
Click Ok
to confirm your changes.
Do not skip this step.
With this, setup is almost done. All that's left is to rename some of the code packages (folders) to whatever you'd like. This step is very important, as if there are multiple mods with their folders left as basicmod
, they'll replace each others' files if people use both of them.
Start by expanding the folders in the left sidebar.
Right click the basicmod
package (under java
), and choose Refactor
->Rename...
Make sure you're changing the package (folder), and not any of the Java files themselves!
Doing so should give you the warning below or something similar. If you don't see this, you're probably renaming the resources folder and not the one under java
. Make sure to choose In Whole Project
/All Directories
(depending on IntelliJ setup). It should change the name of the code package (folder under java
that you should be right clicking) and the name of the folder under resources
.
Name it based on your mod and click Refactor. Generally, package names are kept entirely lowercase. Spaces are not allowed.
Try not to rename anything manually when possible; use Refactor
->Rename
if possible. In code, a lot of pieces can refer to the name of something, and manually changing the name won't update all those other places, causing errors.
You can rename the BasicMod
file now if you want. This is only for you and will not affect any functionality, but it's good to keep things in your mod named appropriately. If you do rename it, try to avoid naming it the same as another class you might make. For example, if you're making a character called TheGuy
, avoiding calling this file TheGuy
since you'll probably want to name your character's file that. Instead, you can just use TheGuyMod
instead, to help signify that it's the main mod class and not the character itself.
If you want to rename the folder holding your entire mod, close IntelliJ and rename it from Windows Explorer (or whichever file manager your operating system has). This one really has no effect at all on the final product, only on your computer's file organization.
And with that, you're done! (With setup). Your mod is now functional, though it doesn't change anything. You can move onto testing to make sure you've got everything set up correctly.