Namespaces

Variants

Share

Share
Views
Actions

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 was previously one of the most popular mod APIs, although since it has lost most of its popularity to Minecraft Forge.
  • Minecraft Forge is backwards-compatible with ModLoader and also adds hundreds of additional methods, classes, and utilities 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 JD, 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. These are not recommended as they generally create poor quality code, and are very limited.
  • 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 Minecraft Forge API

The Minecraft Forge 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 Forge API can be found many places, including many YouTube videos. It can be downloaded at official forge downloads.

[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

Warning. These are outdated Risugami's modloader tutorials.

[edit] 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

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

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

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

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

[edit] Mob Creation

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

[edit] Adding recipes

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.

Making a recipe is not as hard as it looks. All you have to do is figure out what blocks/items you want to be used in you item. Then you insert the items used and you're done!

[edit] Creating an armor set

[edit] 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.