Thursday, 18 February 2021

Setting up a Minecraft Mod project using Eclipse


Here's some instructions how to setup a new Mod project for Minecraft Java using Eclipse. It's really so I can remember how to do this in future!

First, I built spigot. The instructions are here: https://www.spigotmc.org/wiki/buildtools/ (I built spigot_1.16.5.jar Windows)

There's a whole world of exploring to do around setting up Minecraft servers, let alone playing the game and I can't do it justice here. Needless to say, I'm making the assumption you already know how to run a Minecraft server locally.

Now, to create the project follow these steps:

  1. Open Eclipse
  2. Select File -> New -> Java Project
  3. In the Dialog, enter the name of the project, MinecraftMod, say, and click Next 
  4. Select the Libraries tab on the next Dialog then select Add External JARS... Add the spigot jar built earlier


  5. Click on Finish
  6. Select File -> New -> Class
  7. In the Dialog, enter com.javaminecraft into the Package field, the Name of the Mod into the Name field and make sure the main method stub is unchecked
  8. Click Finish
  9. Enter the Java code for the Mod (I won't tell you what to write here!)
  10. We now need to create the plugin.yml. Select File -> New -> File
  11. Call the file plugin.yml
  12. Make sure the Parent Folder is the name of the project, MinecraftMod in this case
  13. Enter the yaml required for the Mod (again, not for this blog)
  14. To be able to add to the Minecraft server we need to export as a JAR. Right-click on the Project name and click on Export...
  15. Select Java -> JAR File

  16. The export destination will be the Minecraft plugins folder for the server
  17. Restart the Minecraft server

There. Hopefully this is a simple recipe for setting up from scratch.

No comments:

Post a Comment