Overview
Mods (short for 'modifications') can modify or add items, blocks, entities, and much more. Presumably, you already have an idea for a mod you want to create. If you simply want to add custom advancements, functions, loot tables, structures, recipes or tags to your game, look into how to make a Data pack, which does not require programming. Or look into how to make a resource pack if you simply want to customize textures (colors and designs), models, music, sounds, languages, splashes, fonts, or the end poem. Or perhaps you want to 'fork' a favorite mod to update for newer versions of Minecraft. In any case, this guide will cover ( eventually) only the most basic elements of creating an item and creating an entity (a moving thing like a villager, sheep, zombie, etc.), and distributing the resulting mod package.
Minecraft mods consist of jar files (example: yournewmod.jar) which contain class files, JSON files, and image files, to name a few of the most common.
- Class files are specific to the Java programming language. A few Java tutorials to try include w3schools (web and mobile), SoloLearn (web and mobile), and kodevelopment(web). You will need an IDE (Integrated Development Environment) such as IntelliJ or Eclipse to read or create class files. This tutorial will focus on IntelliJ IDEA Community Edition 2019.
- JSON files are a means of detailing the characteristics of objects used by Java class files. JSON is much simpler than Java. You will need a text editor such as Notepad++, Vim, or Emacs to read or create JSON files. You probably already have a basic text editor on your computer, but there are many advantages to using other ones instead.
- Image files you may be familiar with include .bmp and .jpg formats, but Minecraft requires .png format (example: yournewlogo.png) in multiples of 16 pixels square (example: 16x16, 32x32, 64x64). You will need an image editor such as Paint.NET or GIMP to edit or create .png files. You probably already have MS Paint on your computer, but GIMP has so much more functionality, and Paint.NET is quite user-friendly. There are also several websites with tools for creating pixel art.
If you have been playing Minecraft Java Edition, you probably already have JRE (Java Runtime Environment). To develop a mod, you will need to find JDK (Java Development Kit), which includes the JRE and an emulator. Create a free account at oracle.com and download JDK Standard Edition version 8. Then follow the instructions for installing it, and make note of the location it installs to. Pay particular attention to the section on Updating the PATH Environment Variable.
With a Java Development Kit installed, and the IntelliJ Integrated Development Environment to manipulate Java with, you now have the tools to develop custom software that can be used in a variety of applications. While working on a mod, continue working through Java tutorials false. The lessons will enable you to put your ideas into action, while the ideas will make the lessons more interesting and memorable.
One more tool you should set up before starting a mod is the Forge MDK (Mod Development Kit). Forge is a collection of useful resources and mod loader, designed specifically to simplify compatibility between Minecraft Java Edition and multiple community-created mods. This tutorial will focus on the MDK for version 1.12.2 of Minecraft Java Edition, although Forge for 1.14.4 has been around for some time. An alternative to Forge is Fabric, but Java is still used to code mods either way.
Things you should not do
There are some things that you should be careful to not do when creating a mod. Keep this list in mind:
- Don't do anything that violates Mojang Studios' terms of use for Minecraft.
- Don't release Minecraft versions or modifications that allow you to play without having bought Minecraft from Mojang Studios.
- Don't release the de-compiled source code of Minecraft in any way.
- Don't modify existing mods without permission from that mod's author(s). Check their License, usually available in the author's GitHub repository. If you can't find the license, then you do not have permission to share a modified version with anybody. You may tinker with the files for personal use only.
First steps with Forge
This wiki article aims to provide a foolproof walk-through of a few key elements of Forge's tutorial: https://mcforge.readthedocs.io. Bookmark their page, as it addresses many issues this article will not. Moreover, there's more than one valid way to achieve the desired result; this wiki article will focus on the simplest, which is probably not the most efficient or elegant. If you follow precisely the steps outlined here, you should soon have a functional mod, which you can then tinker with to your heart's content. If you use Linux, Forge's tutorial will probably be more useful for you. If you use Windows, read on.
A note about placeholders
This tutorial will use "You" to represent the User profile you are logged in with; if you copy-paste paths from this tutorial, be sure to replace "You" with your own Windows username. This tutorial will use "yournewmod" to represent sections you should replace with the mod name you choose for your project.
1. Create a folder for your project
Navigate to C:/Users/You/Documents and create a new folder. The name of this folder may be changed easily later.
2. Obtain a "source distribution"
Visit https://files.minecraftforge.net and make sure the version selected is the version for which you want to create a mod. In the large "Download Recommended" box, click on the small MDK box. A dialog box will appear, asking where you want to save the file, and what to name it. Choose any convenient location, but leave the name unchanged.
3. Copy key files to your project folder
Open the forge-1.12.2-...-mdk folder (with or without unzipping it first) and copy-paste the following 5 files from this folder to the project folder you created in the first step:
- the
srcfolder - the
gradlefolder gradlewgradlew.batbuild.gradle
4. Import the gradle project
Open/Run the IntelliJ IDEA program. In the landing screen, click on "Import Project." A dialog box will appear, asking which file to import. Navigate to your project folder and select "build.Gradle," then click OK.
5. Designate the JDK
In the next window, click in the "Gradle JVM" field and navigate to the JDK files you installed earlier. If you got version 8 update 212, select the folder named "jdk1.8.0_212." Click OK and wait for the build to finish, displaying the results in the bottom field.
6. Set up workspace
No Dependencies needed to be Installed. Move to next step as new update in Forge command setupDecompWorkspace is not needed
7. Configure Run settings
After refreshing, double-click the "genIntellijRuns" entry. Open the "Edit configurations" window of Run settings and look approximately halfway down, for "Use classpath of module." Click on its dropdown field, and select the option that ends with .main, then click Apply. If the settings you just finished editing were for the Minecraft Client, click on Minecraft Server and repeat the steps to set the classpath.
You can now Run the client, which will start the Launcher with your mod included. When you get to the landing menu, you can check whether your mod is present.
Creating a mod for Forge
Identifying your mod
Creating a Custom Tool
Let's make a simple spear, with damage ability similar to a stone sword.
So, to start off with we need to make a new directory called tools in your com.com package. Next create a new java class called ModItemTier. in this java class you need to type a variant of the following:
/* */ package com.com.tools;
/* */
/* */
/* */
/* */
/* */ public enum ModItemTier implements IItemTier {
/* 10 */ CUSTOMNAMEHERE(1, 131, 4.0F, 3.0F, 5, () -> Ingredient.fromItems(RegistryHandler.YourItem.get()));
/* */
/* */ private final Supplier<Ingredient> repairmaterial;
/* */
/* */ private final int enchantability;
/* */
/* */ private final float attackDamage;
/* */
/* */ private final float efficiency;
/* */
/* */ private final int maxUses;
/* */
/* */ private final int harvestLevel;
/* */
/* */ ModItemTier(int harvestLevel, int maxUses, float efficiency, float attackDamage, int enchantability, Supplier<Ingredient> repairmaterial) {
/* 25 */ this.harvestLevel = harvestLevel;
/* 26 */ this.maxUses = maxUses;
/* 27 */ this.efficiency = efficiency;
/* 28 */ this.attackDamage = attackDamage;
/* 29 */ this.enchantability = enchantability;
/* 30 */ this.repairmaterial = repairmaterial;
/* */ }
/* */
/* */
/* */
/* */
/* */ public int func_200926_a() {
/* 37 */ return this.maxUses;
/* */ }
/* */
/* */
/* */ public float func_200928_b() {
/* 42 */ return this.efficiency;
/* */ }
/* */
/* */
/* */ public float func_200929_c() {
/* 47 */ return this.attackDamage;
/* */ }
/* */
/* */
/* */ public int func_200925_d() {
/* 52 */ return this.harvestLevel;
/* */ }
/* */
/* */
/* */ public int func_200927_e() {
/* 57 */ return this.enchantability;
/* */ }
/* */
/* */
/* */ public Ingredient func_200924_f() {
/* 62 */ return this.repairmaterial.get();
/* */ }
@Override
public int getMaxUses() {
return this.maxUses;
}
@Override
public float getEfficiency() {
return this.efficiency;
}
@Override
public float getAttackDamage() {
return this.attackDamage;
}
@Override
public int getHarvestLevel() {
return this.harvestLevel;
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public Ingredient getRepairMaterial() {
return (Ingredient) this.repairmaterial;
}
/* */ }
Next, you need to register your item. Go to your item registry class and make a new item like the one here:
public static final RegistryObject<SwordItem> NAME_SPEAR = ITEMS.register("name_spear", () -> new SwordItem(ModItemTier.ITEMTIERTHATYOUPUTEARLIER, DAMAGE, COOLDOWN(float), (new Item.Properties()).group(ItemGroup.COMBAT)));
. After this, you need to make a JSON file in resources/assets/mod/models/item called what you set earlier, like so:
{
"parent": "item/handheld",
"textures": {
"layer0": "mod:items/name_spear"
}
}
Then, go to your textures folder and input the texture you will make in the next step. If you want to know more about durability I recommend this page.
Custom Layers over Vanilla Textures
A Few Cards Short Of A Full Deck –
Everyone knows that in order for you to be able to play any game of cards, you need a full deck. After all, without it, there is a limit to how well you can actually play a card game. Or if you can play it at all. That may explain why referring to someone as having ‘a few cards short of a full deck‘ is a nice way of telling them they are stupid.
You may also want to take a look at these Commonly Misused Words – Learn to Use Them Correctly
Not The Sharpest Tool In The Shed! –
Having a tool shed is very important because it means, that when the time calls for it, you will find one that you need to do the job. But when you have a tool that is not the sharpest in the shed, it is another story. This is a subtle way of speaking about a person who is not too bright or just plain stupid.
As Smart As Bait –
No one wants to be bait for any kind of reason. Specially when it refers to your mental intellect. When someone is referred to as not being as “Smart as bait” it means that they are dumb. After all, bait usually ends up being used and abused.
The Light Is On But Nobody’s Home –
You only leave your light on in your house whenever you are trying to convince burglars someone is home. Otherwise, it is simply a waste of energy and serves no purpose. That may explain why the “Light is on but nobody’s home” expression means that someone is kind of mentally slow.
A Few Beers Short Of A Six-pack –
You will never find anyone who wants to buy a six pack missing some beers. In the same manner, when a person has a few beers short of a six-pack, it means they are an idiot.
There’s A Village Missing Its Idiot –
No one wants to be the village idiot. That may explain why no one will also want to be described as the idiot who is missing from a village either. Yet this is another unflattering way to refer to a person who’s got a hole in his or her bag of marbles.
One Fry Short Of A Happy Meal –
Happy meals are meant to be just that, happy. But when you have a happy meal with missing fries, it is not a good thing. The same goes for a person who is ‘one fry short of a happy meal.’ When you run into a person whose brain is not full, this is a way to refer to them.
Couple Of Quarters Short Of A Roll –
If you ever been to the bank to exchange a roll of a quarters or to get one, you know the importance of that roll being complete. Without all the quarters there, no one will take the roll. This may explain why when a person is alluded to being a ‘couple of quarters short of a roll,’ it means they are dumb or ignorant.
The Elevator Doesn’t Go To The Top Floor –
No use for an elevator that doesn’t go to the top floor. So when you are referred to as the person’s whose elevator doesn’t make it to the top, be warned. You have just been called stupid in the slickest way.
Check out these 289 Words Most Commonly Misspelled In English
Missing A Few Buttons On His/Her Remote Control –
For people who want to control their Television or electronic gadget, the remote control is the most important thing. But what if your remote control has a few buttons missing? Well chances are that you won’t really want to use it unless you have to. Avoid being identified as someone who is ‘missing a few buttons on his or her remote control.’ It is the ultimate – albeit nice way – of telling you that you are stupid!
Textures from Scratch
Open an image editor, preferably one that supports transparency, and create a new image, with a size that is a multiple of 16x16 (eg. 32x32, 64x64. etc.)
Creating a 32x32 pixel canvas in GIMP
This example is using a 32x32 pixel image and is made in GIMP.
Create your file, making sure it is in pixels and not inches, millimetres, or any other measurement.
Create a new layer, and delete the original canvas. If you don't do that, then your image will have a white background.
Using a brush of 1x1 pixel, start drawing your item. Make sure to use separate layers for separate parts of the item to allow changes to be made easier.
When you're done creating your art, press file to save. If you're using GIMP or another advanced editor, it won't save as a .png. For GIMP, it saves as a .xcf.
With the spear done, press file and then save. Note the lack of white in the background, and instead the blank .png background.
Navigate to the export dropdown or press ctrl+e on Windows or ⌘+E for macOS. This is to export the file. Make sure you export as a .png, not a .jpg or any other file extension. If it is not saved as a .png, it will have a white background and won't look correct.
Exporting the art of the stone spear to desktop. Note that it is being exported as a .png. Certain parts censored for privacy.
If you're following along with this tutorial and wish to use this image, you can download this finished pixel art here.
Creating a Custom Mob
Models from Scratch
Creating a Config file
Sharing Your Mod
To build your mod, run gradlew build or ./gradlew build for macOS. This will output a file in build/libs with the name [archivesBaseName]-[version].jar. This file can be placed in the mods folder of a forge enabled Minecraft setup, and distributed.
Further Reading
https://mcforge.readthedocs.io/en/latest/gettingstarted/
Additional Info
Recommended:
- create a GitHub account to manage versions of your mod and collaborate with other developers.
- further tutorials (in video form, for version 1.15.2)
See also
- Tutorials/Loading a resource pack
- Tutorials/Creating a resource pack
- Tutorials/Installing a data pack
- Tutorials/Creating a data pack