-
Notifications
You must be signed in to change notification settings - Fork 118
Getting Started (For Modders)
Note that this guide is for Windows users. If you're using OS X or Linux most of the tutorial will be applicable but specific file locations, etc... may be different.
Slay The Spire is written in Java. So you'll need some prior experience using the Java Programming Language or be willing to learn. This tutorial will use two tools you'll need to download:
- The Eclipse IDE: link
- The JD-GUI Java Decompiler: link - click the download tab and then grab the
.jar
version which will look something likejd-gui-1.4.0.jar
We will be using Eclipse as our development environment for creating the mod and we will use JD-GUI as a way to read a decompiled version of the game's source code.
- Launch JD-GUI with
jd-gui.exe
and then when it prompts you to find a jar to decompile go ahead and navigate to your Slay The Spire folder and selectdesktop-1.0.jar
. If it does not automatically prompt you go to File -> Open File... - This will open a view in which you can look at the decompiled source code.
- Click File -> Save All Sources and save everything as
desktop-1.0.jar.src.zip
wherever you are going to be doing your modding. The output will be azip
file which you will then have to unzip to access all of the source code (note that it is not actual source code - just reconstructed source code by the decompiler).
In order to do modding for Slay The Spire you're absolutely going to need ModTheSpire link. It's also recommended that you download BaseMod to have access to an easier modding API link.
For this tutorial we are going to be using a folder called my_mods
in your Documents
folder. This folder (the my_mods
folder will be where you can place all your mods). For this example mod we will create an example_mod
folder inside my_mods
to contain all the code for this mod.
Now inside the my_mods
folder let's go ahead and create another folder called lib
(lib
is short for libraries
). This folder is where we'll place the dependencies for your mod. Go ahead and move the ModTheSpire.jar
and BaseMod.jar
that you downloaded in the last step into your lib
folder.
If this is your first time using Eclipse it will prompt you to select a Workspace location when you open it up. For the Workspace DO NOT use the default workspace. Instead we're going to use your my_mods
folder as the workspace. If you did end up using the default workspace or have used Eclipse before we're going to switch workspaces over to my_mods
. The black bars in the image are just covering up some personal information.
Now we can go ahead an create our mod using what Eclipse calls a project. So we will go to File
-> New
-> Java Project
. This will popup a modal. In the spot for the name of the project enter
example_mod
and then click Finish
. . This will create a new project for your mod! However we're not done yet because we have to configure its dependencies. Remember how earlier we put
ModTheSpire.jar
and BaseMod.jar
in the lib
folder? Well now we have to tell Eclipse that we actually put the dependencies there since it won't automatically know.
Your mod actually has one more dependency that we didn't download earlier (because if we could have downloaded it earlier it would be piracy). This is because we now need desktop-1.0.jar
as a dependency. So copy it over from your Slay The Spire directory into lib
so that your lib
folder now looks like this. .
To tell Eclipse about these dependencies we're going to need to go into the settings for your example_mod
. To do this right click on example_mod
and go down to Properties
. .