Hey All, this is my first tutorial so bear with me. I am primarily a Microsoft developer and I was at Build 2015 when they announced the new Minecraft Mod project type. Since my kids and I are really in to Minecraft, I had to give it a shot. Without further ado, here's a guide on how to build a mod using VS 2015 (which you can download for free by the way). This was originally a blog post but I wanted to post it here as well in case it helps any of you out (and I got permission to do so just to make sure I wasn't being rude).
IMPORTANT NOTE: You probably already know this, but, the difference between Version 1.7.10 and 1.8 is vast. If you choose to create a 1.8 mod (and you should; no sense in learning an old version), make sure the documentation you are looking at is for 1.8 and not an older version. For example, setting textures on blocks/items is totally different as of 1.8 (it is configured via JSON instead of by calling a method).
As you can see, in a fit of cleverness and originality I have named my project “Hello Minecraft”. When your project is created, Visual Studio will download a bunch of third-party packages and do a one-time provisioning build. It takes 5-20 minutes. For the curious, here is my build log. At this point we are ready to rock. Let’s hit F5 to debug the project just to make sure everything is working (since I am a skeptic at heart):
Creating a Block
Getting the mod project up and running was surprisingly easy. Next, we need to figure out something we want to modify. Since nobody else in the world is making custom TNT blocks (hah), let’s go ahead and build a custom TNT block.
Most of the TNT mods I have seen have been focused on making a bigger, better explosion. Being a man of restraint, I am going to create a smaller, wimpy explosion. In fact, Wimpy TNT is a great name for our new block! In /src/main/java/com/wimpy-tnt/WimpyTNTBlock (you will have to create the wimpy-tnt and WimpyTNTBlock subfolders) let’s create a class called WimpyTNTBlock. In that class, we will start to define our new block:
// I know there are a lot of imports here... we will use them later in the demo!
public class WimpyTNTBlock extends Block
private final String name = "wimpyTNT";
public WimpyTNTBlock ()
// We want this to show up on the "block" tab in creative mode.
public String getName()
Disclaimer: the spacing in my code here is messed up because I couldn't figure out how to get the forum software to not remove my whitespace (and using the pre tag makes the newlines FUBAR). Reformat it as you wish.
Next, we are going to need to set our mod up and instantiate / register our new block. In/src/main/java/com/wimpy-tnt/ create a class called WimpyTNTMod with the following content:
@Mod(modid = WimpyTNTMod.MODID, name = WimpyTNTMod.NAME, version = WimpyTNTMod.VERSION)
public class WimpyTNTMod
public static final String MODID = "WimpyTNT";
public static final String VERSION = "1.0";
public static final String NAME = "Wimpy TNT Mod";
public static Block wimpyTNT;
public void init(FMLInitializationEvent event)
wimpyTNT = new WimpyTNTBlock();
Your /src folder should now look something like this in solution explorer:
Alright - let’s fire this baby up. For testing, debugging (at least on my machine) is painfully slow. For a faster experience, let’s fire the project up without debugging (Ctrl + F5):
If you go to the Mod List, you should find that our new mod shows up with the correct Name and Version:
Create a new world in Creative mode and you will see our new block is available:
Let’s give our new block a custom texture. Using the most cutting-edge tools available (*ahem*), I created a PNG that I want to use as the texture for Wimpy TNT:
In order to set our block’s texture, we first need to add our texture image (named wimpyTNT.png) to/src/main/resources/assets/wimpytnt/textures/blocks. Next we need to create 3 JSON configuration files for our block:
To do this, I used an invaluable utility created by wuppy21. It will auto-generate the JSON files for you and all you have to do is move them in to your project. When you have all 3 JSON files and the texture image, your solution explorer should look like this:
Now when you run the project you can place the block and it will have the correct texture:
To fix the texture on inventory and when holding the item in your hand, we need to register a renderer for our block. Add the following to your init method in your WimpyTNTMod class:
// Register a renderer for our wimpy TNT block
renderItem.getItemModelMesher().register(Item.getItemFromBlock(wimpyTNT), 0, new ModelResourceLocation(WimpyTNTMod.MODID + ":" + ((WimpyTNTBlock)wimpyTNT).getName(), "inventory"));
This page was extremely helpful to me when trying to figure this out since most of the samples I found were prior to version 1.8. With this code in place, fire up the project and you will see that you are in good shape with regards to textures:
Give it a Name
Our name is still not ideal. To fix this, we need to add a lang file to/src/main/resources/assets/wimpytnt/lang/. Let’s create the lang folder and add en_US.lang to it:
The file needs the following line to give our block a name: tile.wimpyTNT.name=Wimpy TNT (huge thanks to this thread for helping me figure this out). The next time you debug the app, when you hover over your new block, the name is displayed:
Let’s make this block explode when you activate it with flint. I did a bit of spelunking in to the decompiled code for BlockTNT and, luckily, creating an explosion is easy. Add the following method to your WimpyTNTBlock class:
You should now be able to hit it with flint and steel to make it explode. It’s pretty underwhelming, but, that’s why we named it Wimpy TNT. Here is a video of it in action:
... and that's it. You can download the source for this project here. If you have any suggestions for edits, send me a pull request! Also, let me know what you think or if you have any suggestions for edits on this guide.
The example you posted looks correct to me. Which probably means there is something else that is preventing you from seeing the correct name associated with your block. Off the top of my head, I would say check these lines to make sure you are using "wimpyTNT" exactly (case-sensitive) as the name (when you click on these links, there will be a line highlighted):
Ferdz, I forgot to answer your question. Yes, at the moment it is just the three available in the picture. I would have edited my previous post but every time I edit a post with a quote my quote tags get messed up for some reason. Editing the markup doesn't seem to fix it.
Thanks for starting this, as there is not much out there to help get started yet with this path.
Just messing around with it was pretty simple and easy to understand. Some additions I uncovered as I followed the trail of some of the objects you used in your tutorial are elaborated on below. If there is a better way to do any of these things, please share feedback.
To specify block properties like hardness, resistance, and step sound:
In the beginning of the class, add a sound:
public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.5F);
More examples of sounds are available if you follow the definition (F12) to the Block class
I believe the string is for associating to existing sound files, and there are additional ways to specify dig and break sounds if different than main source
The 2nd and 3rd arguments are for volume and frequency respectively
At the beginning of the init method, update the setting of the wimpyTNT static block to:
wimpyTNT = (new WimpyTNTBlock()).setHardness(0.0F).setResistance(0.0F).setStepSound(soundTypeStone);
Again, the Block class is your friend here for other references on values for hardness (how long it takes to destroy a block) and resistance (how strong the block is against explosions); thanks to Creating_Blocks for the extra details on these methods
The soundTypeStone value passed into setStepSound is what you defined earlier
Mankind is the caretaker of nature, having been granted this responsibility by the Creator. Naturally, we screwed up and the Creator had to sacrifice His Son so we would not be destroyed. He is risen, as all shall be one day. Anyone who puts his trust in the Son of God will reign with Him forever; anyone who does not will be destroyed forever.
Is it really? I guess that kind of makes sense because in terms of performance, C++ is hard to compete with. I just did some searching and it doesn't appear as though Minecraft 10 has taken over yet. It also is purely for Windows 10 (hence them ditching previous versioning numbers) and I wonder if they abandoned that project. Completely scrapping the codebase and starting over seems like a pretty large undertaking.