Mods/Creating mods

From Minecraft Wiki
< Mods(Redirected from Mods/Creating Mods)
Jump to: navigation, search
The contents of this page are not supported by Mojang AB, the Minecraft Wiki, the Minecraft IRC channel or the Minecraft Forums.

Minecraft modding is one of the most popular features introduced into the community. There are many different kinds of mods. This tutorial will present you information on how to make your very own Minecraft Mod whether it be with Modloader, Minecraft Forge or hard coded in to the core source. Some knowledge of Java is necessary; it is assumed the reader is familiar with common programming terminology.

Contents

[edit] Other Tutorials

For other tutorials not listed on this page (including some that are), the Minecraft Forums Modding Tutorials page will help to create your first mod. There are various tutorials for both ModLoader and Minecraft Forge.

[edit] Tools

There are many tools that can be used to mod Minecraft. The following is a list of any that people put on here or suggest in the discussion page.

  • Mod loading APIs standardize things, allowing for compatibility between mods. The official Minecraft API is not published yet. In the meantime, the Minecraft modding community has filled that void:
  • ModLoader is among the oldest and most popular mod APIs.
  • Minecraft Forge is backwards-compatible with ModLoader and also adds dozens of additional methods to assist mod authors.
  • Bukkit is a popular server-side-only API.
  • Decompiling tools help you work with Minecraft's source code, which is not published by Mojang.
  • The Minecraft Coder Pack utility (MCP) is the community-standard tool to both decompile and deobfuscate the Minecraft code, making it much easier to read and modify.
  • General-purpose Java decompilers, such as JAD and fernflower, will help you when MCP is not released or unavailable (for example, when modding snapshots).
  • Simplified mod generators, such as Mod Maker and MCreator, exist for mod authors who don't want to have to write and compile Java code.
  • 3D modeling tools, such as Techne, help you create or modify a TileEntity or Entity.
  • Protocol analysis tools, many of which are documented on the List #mcdevs wiki, can be useful for debugging multiplayer mods.

[edit] The ModLoader API

The ModLoader API is a very useful tool in creating new mods. Its most important use is preventing conflicts between mods. It also contains convenience methods for creating mods more easily than without it; for example, the addSmelting method adds smelting recipes in one line of code. Many other methods exist. Tutorials on using the ModLoader API can be found many places, including several YouTube videos.

[edit] Learning Java

These tutorials use Java terms that may confuse new users. Below are some links about the structure of Java and what certain terms mean. It is recommended that those who are not knowledgeable in the Java programming language read the links.

For more links, see Helpful Links.

[edit] Tutorials

[edit] Setting up the MCP workspace

Main article: Setting up the MCP workspace

Setting up the MCP workspace allows you to access Minecraft and ModLoader's source code and begin modding. The tutorial provides step-by-step instructions for installing Java SE Developer's Kit, the Minecraft Coder Pack, Eclipse IDE for Java Developers, and other programs/mods required to begin modding. The tutorial is written for Windows, Mac, and Linux operating systems.

[edit] Starting your first mod

Main article: Starting your first mod

This tutorial helps you set up and program the primary file for your mod. This file serves a very important purpose. In future tutorials, they will require that you have entered the code explained in this tutorial. This tutorial requires that you have completed the Setting up the MCP Workspace tutorial first.

[edit] Methods in Minecraft

Main article: Methods in Minecraft

This guide contains a table that lists how blocks, items, and entities are referenced in the code. These references are listed as methods. This is useful in many tutorials below.

[edit] Adding a block/item

Main article: Creating Blocks

This guide will teach you how to create your very own block.

Main article: Creating an Item

This guide will teach you how to create your very own item.

[edit] Mob Creation

Main article: Creating A Mob

This tutorial shows you how to create a mob with Techne.

[edit] Adding recipes

Main article: Adding a recipe

This tutorial teaches you how to create unique and simple crafting recipes for items and/or blocks already in the game. It also guides you in creating shapeless recipes and smelting recipes in the Furnace. This tutorial requires that you have completed the Starting your First Mod tutorial.

[edit] Creating an armor set

Main article: Creating an armor set

[edit] Recompiling and reobfuscating

Main article: Recompiling and reobfuscating

This tutorial is quite small, and allows you to finalize your mod by retrieving the .class files you have created and/or edited to be copied into the minecraft.jar. By sending these .class files to other players, they can play your mod as long as they have ModLoader installed.

[edit] Tips

  • One of the simplest types of mod is adding new blocks or items. Copy a similar class, and rewrite it as necessary. If the new block or item will share most of its behavior with an existing one, it may be easier to subclass that one and override only the parts that will be different. Depending on the desired behavior and how it will interact with other objects, it may be necessary to modify other classes, which makes it more likely to conflict with other mods.

[edit] Creating mods without MCP

Sometimes it is useful to create mods without MCP. For example, MCP is usually not released for snapshots.

To create mods without MCP you must either decompile obfuscated code or modify java bytecode. Decompiling is easy, but you can decompile only simple classes.

But never the less, DON'T EVER get someone else's mod and modify that WITHOUT their permission!

This is generally against the law in most countries and discouraged by the community. If you wish to modify or extend someone else's mod you should first find out which license it's published under, some licenses allow you to make modifications. You should also contact them. In many cases people like seeing their mods grow and change into different things.

Personal tools
Namespaces
Variants
Actions
Minecraft Wiki
Minecraft
Useful pages
Toolbox

Recent Community Articles

Mojang Tweets

    Getting your tweets...
Become a Premium Member!