The article on the topic: “dream book swearing in a dream with a man” presents current...
![Swearing in a dream, interpretation of the dream book](https://i1.wp.com/sonnikpro.com/wp-content/uploads/2017/03/rugatsya2.jpg)
This article describes the process of creating modifications for Minecraft using Forge and Eclipse. You don't need to be a professional to create simple modifications, but at least a mediocre understanding of the principles of the Java programming language is desirable. If you encounter any questions or problems while making modifications that are not covered here, please post them on the talk page.
Readiness table | ||
---|---|---|
Lesson | 1.6+ | 1.7+ |
Block | Ready | Ready |
Item | Ready | Ready |
Craft | Ready | Ready |
Compilation | Ready | Ready |
Generation | Not planned | Ready |
Proxy and instance | Not planned | Ready |
Mob | Not planned | Ready |
Blocks with model | Not planned | Maybe |
Add. Lessons | Total: 2 | Total: 12 |
Let's do the most important thing first: install Java and Eclipse. Regardless Minecraft versions, for which you want to create a modification, these steps are the same.
The most important thing for writing anything in Java is, naturally, the Java libraries themselves.
You can download them from the Oracle website. Go to this page and click on the Java icon on the left. Scroll down the page that opens a little, select that you agree with the license agreement (Accept License Agreement), and select the item corresponding to yours at the bottom of the first list operating system, and download. After downloading, simply install by clicking Next. After installation, you need to set the installation path to your Windows environment variables. To do this, go to the Computer Properties menu (⊞ Win + PauseBreak or My Computer -> Properties -> Advanced system settings -> Environment variables). Find the Path system variable, highlight it, and click Edit. At the very end of the Value line, add the path to JDK/bin separated by a semicolon, for example, C:\Program Files\Java\jdk1.7.0_45\bin . Then click OK three times.
How to create a mod for Minecraft?
In order to create mods in Minecraft, you must have at least basic knowledge of working with applications and programming in general.
You can create mods for Minecraft using the API or without it. API is an application programming interface that allows you to work with ready-made classes, functions, procedures, structures and constants for use in other programs. The most popular API for Minecraft is Minecraft Forge. Using Forge to create mods in a game requires the use of this API for the game itself, which significantly complicates the gameplay itself, but at the same time allows you to install applications without conflicts with your modifications and with the mods of other players. It is impossible to achieve this without an API.
Preparing to create mods in the game is as follows:
After this, you can proceed directly to creating the mod. You will need to go through the following steps:
By starting small, you will gradually understand the basic principles of how to create mods for Minecraft, and you can even add your own mods to the server in order to show them to your friends. If creating mods is not yet within your capabilities, read the article
No need to delete META-INF in minecraft.jar, and minecraft_server.jar
1. Create a folder (For example: MCP Forge) and unpack the contents of the archive with MCP there.
2. Copy the bin and resources folder from the client to the ../MCP Forge/jars/ folder, from the server we only need minecraft_server.jar.
3. Unpack the archive with Forge-src into the MCP Forge folder
4. Open the folder ../MCP Forge/forge/ and run the install.cmd file. We are waiting for the decompilation to finish..
(P.S If you want you to already have a ready-made MCP with Forge, for example, if you accidentally deleted it or something else, then: When the decompilation is completed, run the game and let it download the lib, and then add this MCP Forge to the archive, for example like this (mcp Forge 1.5.1)
5. “Install” and launch Eclipse, during startup you will be “asked” for the folder with the project, specify the path: ../MCP Forge/eclipse/
6. So, we opened the project, now (Usually on the left, there is a Package explorer) we look at what library it “eats” (In the Package explorer window, “open the Minecraft project” and if there is a line “JRE System Library”, then everything is fine, but if the line is “JRE System Library”, then right-click (Right-click), select Properties, then a window opens in which Execution environment is selected, select JavaSE-1.7 in it and click Ok.
7. So, the preparations are ready.
How do you start writing a mod?
First, we need to create a “base”, that is, the main “folder” in which our “base” and everything else will be stored.
1. Go to Eclipse, see the Minecraft folder in Package Explorer, open it, and right-click on the src folder, select New->Package. Open window in the Name line, we indicate the name of the folder in which everything will be stored (For example, take: mods.testmod.src) and click Ok.
2. Right-click on our folder (mods.testmod.src), then New -> Class. In the Name line, indicate the name of our file (For example: TestModBase) and click Finish.
3. Change the path, but do not remove mods, like this, for example mods.NewItemMod.src.
4. In new versions you need to import “A lot” of everything, to do it faster in Eclipse press “ctrl + shift + o”, and it will quickly import everything, and if a window appears then select the import you need.
5. If you do not work in Eclipse, then it will be much more difficult for you, so it is better to switch to it, it will indicate where the error is, and what imports are needed, and you will not ask stupid questions in the comments.
package mods.testmod.src;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.SidedProxy;
@Mod (modid = "TestMod", name = "Test Mod", version = "0.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false, versionBounds = "1.0.0")
public class TestModBase (
@Instance("TestModID")
public static TestModBase instance;
@Init
{
}
@PreInit
public void preLoad(FMLPreInitializationEvent event)
{
}
@PostInit
public void postLoad(FMLPostInitializationEvent event)
{
}
}
In our TestModBase file
After the inscription:
public class TestModBase (
Enter this line:
public static final Block testBlock = new TestBlock(2020).setUnlocalizedName("testBlock");
Parsing:
public static final Block "testBlock" - testBlock the name of our block in the code (not in the game)
new TestBlock(2020) - TestBlock the name of our block in the code (not in the game), 2020 block ID
setUnlocalizedName("testBlock") - ("testBlock") the name of our block in the code (not in the game)
After the inscription:
@Init
public void load(FMLInitializationEvent event)
{
Enter this line:
GameRegistry.registerBlock(testBlock);
LanguageRegistry.addName(testBlock, "Test Block");
Parsing:
(testBlock) - the name of our block in the code (not in the game)
(testBlock, "Test Block") - testBlock is the name of our block in the code (not in the game), "Test Block" is the name of our block in the game.
Create a file testBlock and enter the following code into it:
package mods.testmod.src;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
public class TestBlock extends Block (
public TestBlock(int par1)
{
super(par1, Material.ground);//Material
this.setCreativeTab(CreativeTabs.tabTools);//Add to creative
}
//Register the texture
@Override
{
}
}
In our TestModBase file
After the inscription:
public class TestModBase (
Enter this line:
public static Item testItem = new TestItem(2021).setUnlocalizedName("testItem");
Parsing:
public static final Item "testItem" - testItem is the name of our item in the code (not in the game)
new TestItem(2021) - TestItem the name of our item in the code (not in the game), 2021 item ID
setUnlocalizedName("testItem") - ("testItem") the name of our item in the code (not in the game)
After the inscription:
@Init
public void load(FMLInitializationEvent event)
{
Enter this line:
LanguageRegistry.addName(testItem, "Test Item");
Parsing:
(testItem, "Test Item") - testItem is the name of our item in the code (not in the game), "Test Item" is the name of our item in the game.
Create a file testItem and enter the following code into it:
package mods.testmod.src;
import net.minecraft.item.Item;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class TestItem extends Item
{
public TestItem(int par1)
{
super(par1);
setCreativeTab(CreativeTabs.tabTools);
}
//Texture registration for an item is slightly different from a block
@Override
public void registerIcons(IconRegister par1IconRegister)
{
}
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("testmod:testBlock");
}
("testmod:testBlock"), testmod is the "name of the folder" in which the "folder with the texture" will be, testBlock is the name of our texture. This is our texture placement:
\Tutorial Forge 1.5.1\mcp744\src\minecraft\mods\testmod\textures\blocks\testBlock.png
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon("testmod:testItem");
}
("testmod:testItem"), testmod is the "name of the folder" in which the "folder with the texture" will be, testItem is the name of our texture. This is our texture placement.
Custom modification computer games- this is a fairly common phenomenon, which is a change and addition of game files to obtain more content, variety of gameplay and so on. Sometimes mods can be small, adding only a couple of items or features. And sometimes you can find global mods that almost completely change the gameplay. For Minecraft, one of the most popular computer games of our time, gamers make quite a lot of different mods. Therefore, you can learn how to create a mod for Minecraft - it’s actually easier than it seems, but in any case it will take you quite a lot of time.
So, if you seriously decide to figure out how to create a mod for Minecraft, then you need to understand what exactly can be modified there. In fact, there are incredibly many possibilities - there are many more mods for this game than for all others. This is due to the fact that Minecraft looks quite simple - accordingly, it is easier to change something in it or add certain functions to it than to a top project on which hundreds of professionals have worked for several years. Now there are already mods such as “Industrial Craft” or “Taumcraft”, which can easily be considered global, as they add an incredible amount of content to the game - the first one takes Minecraft into the industrial era, adding hundreds of new recipes and items. The second one adds magic and everything that comes with it to the game. Naturally, it’s worth starting with more simple projects, but in the end you can also create something serious. But first, you need to learn how to create a mod for Minecraft.
If you want to learn how to create a mod for Minecraft, then you need to immediately understand that it can be done with two completely different methods- with or without API. First you need to figure out how to create a pure mod that does not require additional software. IN in this case you need to have a good understanding of the game mechanics and have certain design skills, as well as the ability to program in high level. Then you can introduce something new into the game, as well as change certain items, functions and much more. As a result, you will be able to create a unique and unusual mod, but it is likely that it will be limited in use by other gamers, since it will not be standardized - accordingly, some gamers may have problems with launching and compatibility, regardless of what mode was this Minecraft modification created - survival or creative?
API is a special software interface that already contains many functions from the game itself, as well as textures, skins and much more. This way, instead of writing all the code from scratch, you can already use ready-made solutions, which can be combined with each other, creating something new. Exists a large number of There are a variety of interfaces, and choosing something specific among them can be a challenge. Here you need to take into account the specifics of the mod, for example, in relation to the Minecraft mode - survival, hardcore, creative, and so on. But if you are just starting to make mods and also want your modification to be available maximum number people, then you need to use Minecraft Forge. This is the most common API that currently exists - at the same time, it is the most functional, extensive and in demand. Therefore, if you are going to add to Minecraft new fashion - pay attention to it first of all.
Many gamers who create or use mods wonder why Forge is needed at all. After all, this is so inconvenient - you definitely need to install the API itself in order to be able to then launch the modification. Is it really impossible to do clean fashions, which do not require anything additional to play? In fact, Forge has many more advantages than disadvantages (by the way, there is only one, which is the need to pre-install the API to run the mod). Firstly, the process of creating a mod is simplified, and secondly, you have much more more possibilities, which require no effort to use. But the most important thing is that your mod becomes universal. If you make a modification without an API, as mentioned above, there is a high probability that many gamers will not be able to install it. If you used Forge, then any gamer with the API installed will be able to install your mod without the slightest problem.
The most important rule of modification, no matter which option you choose, is to not modify the source files. For example, you decide to do for Minecraft mod on cars - it is better to add new objects rather than correct those that are in the game to avoid conflicts.