Earlier today, at BUILD, we announced the public availability of a new open source project meant to simplify the development of Minecraft mods within Visual Studio. This Visual Studio extension can be downloaded from the Visual Studio gallery right now: http://aka.ms/vsminecraft. It supports bothVS 2013 Update 4 and VS 2015 RC.
If you're interested in jumping into its source code and learn more about how it was built, head over to GitHub: http://aka.ms/vsminecraftsrc.
Don't know what Minecraft modding is? Bing can help.
A short history
Here at Microsoft, we love Minecraft and there are many folks that spend time playing mods or writing their own. We also spend a lot of time using Visual Studio both at work and at home. One thing led to another and in our last Microsoft Garage's Hackathon, February this year, the first prototype of what became today the Minecraft Mod Developer Pack saw the light of day. We've already been dogfooding it internally at Microsoft since then and it gradually became better. But let's be clear, this extension is still young.
We're releasing it today as pre-release software and it needs your contribution to grow into something bigger.
- Are you a mod writer already? You’re likely already using a mature Java IDE. We'd love to hear from you what are the main IDE features you use most often when writing mods
- Are you thinking of starting writing mods? Try VS with this extension and let us know when the going gets tough. This is how we learn and improve.
- Want to show off your VS extensibility chops or just make this extension's code better? Send us a pull request.
- Want to learn how to write VS extensions? Fork our codebase, play around, publish your own extension
How to get started
1. Download and install the Java Development Kit which is a prerequisite. Please make sure you install the X64 JDK version. Then download and launch the Minecraft Mod Developer Pack VSIX package from http://aka.ms/vsminecraft.
Once installed, inside Visual Studio's New Project dialog, you'll notice three Minecraft project templates under the "Java" node:
These templates will get you started with a working example.
3. As soon as a project is created, a provisioning build is automatically started. It may take a while - between 5 and 20 minutes depending on your Internet connection (yes, you need one for this step). This is when MinecraftForge starts downloading and building the needed packages, including Minecraft, on your machine. The MinecraftForge team did an amazing job at automating this process so all you have to do is sit back and enjoy the output of the Gradle script that's doing all the hard work. The other good news is that this provisioning build is a one-time build - the next time you start a build of this project, the only thing getting compiled will be your source code.
Note: the provisioning build creates a global cache for downloads, so the second time you create a project, the actual provisioning build time will be much shorter.
4. When the provisioning build is complete, the References node of your project will be populated with all the packages needed by your mod. Now you can do one of two things: press F5 to see your mod in action or open your mod source files in the editor.
5. In the editor, your Java files will have syntax colorization and outlining. And as you type, IntelliSense services (e.g. squiggles, parameter help, member list, and quick info) will aid you in writing correct code. Go to definition will open the source file defining the selected symbol including symbols defined in external jar libraries.
6. You can debug your Java code. Set the breakpoints you need and inspect the state of your program using the Locals, Watch and Call Stack windows.
7. The project debug settings are already configured to launch the Minecraft client and preload your mod. Another project configuration allows you to launch the Minecraft server too.
8. That's it. Now you should inspire others by writing mods and sharing them with the Minecraft community.
Behind the scenes (A bit about how the Minecraft Mod Developer Pack extension works)
Minecraft Mod Developer Pack extension (MMDP) is comprised of 3 components:
- MinecraftForge project templates
- A NuGet package that is installed by each template that orchestrates the provisioning build
- A VS editor extension (MEF-based) for Java IntelliSense & Browsing support
Overall MMDP relies on several open-source projects to accomplish the current experience:
MinecraftForge (http://www.minecraftforge.net/wiki) is the power engine behind the modding development experience. Forge provides the Gradle scripts that MMDP invokes that configure the build environment as well as the prerequisites to make Java IntelliSense & browsing work inside VS. It also provides the API you will use inside your mod.
Sam Harwell's Java Language Support VS extension (https://visualstudiogallery.msdn.microsoft.com/bc561769-36ff-4a40-9504-e266e8706f93) is the project providing the Java project system, build system, basic editor facilities and the rich Java debugger capabilities in Visual Studio. We've worked closely with Sam to make sure that we refine the end-to-end Minecraft development experience and simplify its acquisition. Thanks Sam!
Eclipse JDT (http://www.eclipse.org/jdt/) is bundled together with MMDP as an Eclipse application and is used to provide all IntelliSense and browsing information inside the VS editor.
Aidan Brady's Mekanism (https://github.com/aidancbrady/Mekanism) is bundled as a Minecraft mod sample inside MMDP's New Project Dialog.
For more details on how these dependencies contribute to the experience, check out the MMDP's source code.
What's next?
We’d like your feedback. Download the developer pack and try writing some mods. Let us know what you like about it, what you would fix. Are you learning or already know VS extensibility? Even better! Show us how to fix it.
Marian