-
Notifications
You must be signed in to change notification settings - Fork 61
Step 3: Packaging and Playing the Default; Writing Your First Mod!
If you have followed the steps so far, you should be able to package and run this mod.
If you have not read through/followed the comments in the main mod file, go back to step 2 as otherwise, the mod will crash on launch.
Assuming you have changed the IDs/Resource folders, it's time to package and play the Default!:
In IntelliJ, open the Maven project tab and select the "Execute maven goal" button.
In the command line field, type package
.
(Good practice is to do clean
followed by package
, especially if you are replacing, for example, an image a file with another one and they have an identical name.)
You can also asign a shortcut to the both those commands by opening the Lifecycle drop-down folder (also in the image above) and right-click > Asign shortcut on them. A nice setup is F5 for clean, F6 for package, and F7 will run a debug that will launch ModTheSpire (explained further below)
You can now find your mod in [slay the spire install folder]/mods/[name_of_mod_as_it_is_in_pom].jar
. If you can't find it, check at the bottom of your pom.xml for the location.
You should be able to run Slay the Spire through Steam by selecting Play With Mods
and selecting it. But Wait! Running via debug is way better and cooler!:
If you wanna run MtS through IntelliJ and get cool features such as:
- Clickable line numbers when you get a crash-log that'll instantly direct you to where your error is:
- Searchable log by pressing ctrl+f
- The ability to use debug mode for things like breaks and step-by-step code exectuion
Do the following:
(0. Thank kio for the original version of this debugging guide)
- Press the "Add Configuration..." button at the top right of your screen.
- Press the plus button at the top left of the newly opened window
3. Select "Jar Application"
- Name it appropriately
- Point "Path to JAR" to your ModTheSpire.jar's workshop folder
- Point "Working directory" to your Slay the Spire install directory
- Make sure ModTheSpire is selected and press the debug icon or keyboard shortcut to run ModTheSpire through IntelliJ in debug mode!
Wanna put your mod on GitHub to share your code with others? Or use git for Version Control in order to revert changes in case you make a mistake? Continue to Step 4: Git(Hub) Integration.
What else can I do with AbstractCard
or AbstractDungeon
? How does the Silent's Choke
really work? How does Slay the Spire work under the hood. A lot of these questions can be answered by looking at the game's source code. You can do this by decompiling the game.
IntelliJ comes with it's own internal decompiler. Once you set your lib folder correctly and start up the mod, you will see the External Libraries
folder on the left-hand side. Basemod and the Slay the Spire's Desktop-1-0.jar
are both there, and can simply be oppened and explored. Alternatively, you can always search up the card/class you are looking for in intelliJ's class search (quadtriple-tap Shift
).
Finally, you can also find the original declaration of something already in the code by right clicking on it and selecting Go to -> Declaration
, or, even faster, ctrl+left clicking on it.
If you do not wish to use the built-in decompiler, follow this guide instead.
You made a card/event/relic and wanna test it? Please remember that the console exists and you can just spawn it in/give yourself energy/teleport to shops via debug, etc: https://github.com/daviscook477/BaseMod/wiki/Console
Mods do a whole lot of things. A full list of listeners can be found in src/main/java/basemod/interfaces
in BaseMod.
You bet you can. Check out how listeners are made in BaseMod and check out the documentation about SpirePatch
in the ModTheSpire docs