All should work for 1.6.4, with maybe some minor changes in method names in NPC. Let me know if you have problems.
Hello again. Looks like we're back with an update that changes a lot. So I figured I mine as well document what I learn as I go. This is gonna be pretty relaxed, so I might write up a big, extensive tutorial documenting and explaining everything, I might just copy and paste another tutorial or some code, or I might just put a link to something helpful. The catch is I'm gonna do my best to keep everything updated.
If you have any comments or questions (or requests, once we all get a little more comfortable in 1.6.2), please leave a reply. Also, I admire simo_415's way of doing things (as you can see from my tutorial list), so if you can, please leave a tutorial as a reply on this thread & I can link to it below:
I've been dying to figure out how they changed it.... Thanks a ton! And if you ask me, I think this is a pretty bad way to change things to... I didn't even use a RenderENTITY file for my mobs! UF!
Do you think you could make a full mob tutorial for 1.6.1?
This tutorial is still being proof-read. If you find a problem, holler!
Tons of credit go out to Sprite99's Tutorials. He originally made this tutorial, and then I just changed the things that I thought should be different and added pictures for more visual instruction.
Setting Up MCP & Forge
First, download the recommended/latest version of the src download of Minecraft Forge from the forge website:http://files.minecraftforge.net. **Note**: The "latest" version can be unstable, so download the "recommended" version for the latest Minecraft Version if possible.
Shown above is the Forge download screen as of 7 July 2013
After you download the MCP and forge .zips, extract them using 7-Zip or another program (will be done automatically by double clicking if you are on a Mac or Linux).
Next, create a folder on your desktop called "Mod Making". Create another new folder in the "Mod Making" folder and rename it "Forge [Minecraft Version]". Drag the forge in folder and
Now we are ready to start forge! Operating System specific instructions below:
Mac OSX Open terminal (You can find terminal at /Applications/Utilities/Terminal.app, or you can use spotlight to find it. Navigate to the "forge" folder inside the "Forge [Minecraft Version]" folder Now type cd (make sure to include the space after) and drag the folder icon next to the title of the folder near the top of finder into the Terminal dialog (easier illustrated):
Now type in bash install.sh into Terminal.
Forge will now start to download and install the necessary files. It will then automatically decompile the Minecraft source code. This process can take between 15-20 minutes, and sometimes even longer, so be patient.
Linux/Unix All you need to do to install forge on Linux systems is locate the "install.sh" file in the "/Desktop/Mod Making/Forge [Minecraft Version]/forge" folder. After you double click it, it will begin to execute a script which will download and install the necessary files. It will then automatically decompile the Minecraft source code. This process can take between 15-20 minutes, and sometimes even longer, so be patient.
Windows All you need to do to install forge on Windows is locate the "install.bat" file in the "/Desktop/Mod Making/Forge [Minecraft Version]/forge" folder. After you double click it, it will begin to execute a script which will download and install the necessary files. It will then automatically decompile the Minecraft source code. This process can take between 15-20 minutes, and sometimes even longer, so be patient.
Eclipse is really key for modding. It's an IDE, which means that it will tell you most of the time what is wrong with your code before you test it. Also, you can launch a sample MCP version of Minecraft from by just clicking a button in Eclipse. Now, I credit Sprite99's Tutorials for this one. Please feel free to check them out as Sprite99 is a modder have a good respect for. What I did was change small stuff like file directories to coincide with the other tutorials. The fun stuff is once we have all this set up, so I'm trying to zoom through.
Setting Up Eclipse
First, download the latest version of Eclipse from the website, being sure to select the correct Operating System. Scroll down to the download"Eclipse IDE for Java Developers". The downloads are located at: http://www.eclipse.org/downloads/
Now, open Eclipse. You will be prompted to select the workspace location. Select your "Desktop" directory and then type in "/Mod Making/Forge [Minecraft Version]/forge/mcp/eclipse".
Important Note: Do not put any caps in your package name, I was tired when I made this tutorial and wasn't thinking! It isn't conventional and I don't like it, so future tutorials will have all lowercase package names. I'll edit this into this tutorial when I have a bunch of free time.
In this tutorial, I'm going to show you how to make a simple Forge mod. This mod will not do anything right now, but it sets up to be able to do much more!
Creating a Basic Mod
Now we need to create a new package. A package is kind like a scaled-down folder that holds code in a Java project.
Now there isn't a set requirement for naming packages, but to help with organization, I like to follow this method (username.ModName.common):
Make sure that the package you just created is selected
Next, we need to learn to create a class. Classes are the basic .java files.
Now we need to name our class. In my tutorials I usually use "Tutorial Mod" as the name of my example mod, so the first class (I call it the main class or mainframe) should be TutorialMod.java (no spaces in names, please). So for example, Glacier Ice gets GlacierIce.java as the name for its main class. Then click "Finish".
Now copy and paste this code into your new TutorialMod.java:
package fisherman77.TutorialMod.common; //The package your mod is in
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.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
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;
import fisherman77.TutorialMod.common.TutorialModCommonProxy;
@NetworkMod(clientSideRequired=true,serverSideRequired=true, //Whether client side and server side are needed
clientPacketHandlerSpec = @SidedPacketHandler(channels = {"TutorialMod"}, packetHandler = TutorialModClientPacketHandler.class), //For clientside packet handling
serverPacketHandlerSpec = @SidedPacketHandler(channels = {"TutorialMod"}, packetHandler = TutorialModServerPacketHandler.class)) //For serverside packet handling
//MOD BASICS
@Mod(modid="TutorialMod",name="Tutorial Mod",version="Release")
public class TutorialMod {
@Instance("TutorialMod") //The instance, this is very important later on
public static TutorialMod instance = new TutorialMod();
@SidedProxy(clientSide = "fisherman77.TutorialMod.client.TutorialModClientProxy", serverSide = "fisherman77.TutorialMod.common.TutorialModCommonProxy") //Tells Forge the location of your proxies
public static TutorialModCommonProxy proxy;
@PreInit
public void PreInit(FMLPreInitializationEvent e){
}
@Init
public void InitTutorialMod(FMLInitializationEvent event){ //Your main initialization method
//MULTIPLAYER ABILITY
NetworkRegistry.instance().registerGuiHandler(this, proxy); //Registers the class that deals with GUI data
}
}
You will have some initial errors, but we'll still be able to clean this up in a sec. I'll explain most of the class as we go through other tutorials that pertain to certain parts, but here are some basics:
"modid" is the name that show up in the console, "name" is the in-game name that you see in the "Mods" tab, and leave "version" at "Release", "Development", "Alpha", or "Beta". The number versioning, like "version 1.5" will be in mcmod.info (later).
"PreInit" comes before "Init"
"Network..." stuff is there to add LAN/SMP ability to your mods.
Now to settle the errors, we're gonna have to make 4 other classes. Use the same class-making method as before to make TutorialModCommonProxy.java in the same package ("fisherman77.TutorialMod.common") & copy and paste the following code.
TutorialModCommonProxy.java:
package fisherman77.TutorialMod.common;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class TutorialModCommonProxy implements IGuiHandler{ //THIS IS IMPORTANT, CANNOT BE A PROXY/GUI HANDLER WITHOUT THIS!!
public void registerRenderInformation() //Client side texture registering
{
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { //For GUI's
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { //For GUI's
return null;
}
public void registerTiles(){ //For registering TileEntities
}
public void registerBlocks(){ //For registering Blocks
}
public void registerItems(){ //For registering Items
}
}
Now we need to create two more packages named "fisherman77.TutorialMod.client" and "fisherman77.TutorialMod.common.handlers".
Good job! Only 3 more classes to make in these new packages!
In "fisherman77.TutorialMod.client" make the "TutorialModClientProxy" class.
TutorialModClientProxy.java:
package fisherman77.TutorialMod.client;
import fisherman77.TutorialMod.common.TutorialModCommonProxy;
import net.minecraftforge.client.MinecraftForgeClient;
public class TutorialModClientProxy extends TutorialModCommonProxy {
public void registerRenderInformation(){
}
}
In "fisherman77.TutorialMod.common.handlers" create the new classes "TutorialModClientPacketHandler" and "TutorialModServerPacketHandler" & copy and paste this code: (Sorry, this is as much copy and paste that happens, but there are comments inside the code to help you understand)
TutorialModClientPacketHandler.java:
package fisherman77.TutorialMod.common.handlers;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.*;
@SideOnly(Side.CLIENT)
public class TutorialModClientPacketHandler implements IPacketHandler{
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload payload, Player player){
DataInputStream data = new DataInputStream(new ByteArrayInputStream(payload.data)); //Handles incoming data
}
}
TutorialModServerPacketHandler.java:
package fisherman77.TutorialMod.common.handlers;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
public class TutorialModServerPacketHandler implements IPacketHandler{
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload payload, Player player){
DataInputStream data = new DataInputStream(new ByteArrayInputStream(payload.data)); //Handles incoming data
EntityPlayer sender = (EntityPlayer) player;
}
}
Good! You're now good to go for nearly all of the other basic tutorial, such as blocks, items, mobs, GUIs, etc!
Setting up a GitHub project for your mod really helps teams all working on the same mod. In case something does happen to your mod files on your computer (and trust me, something probably will happen), then this is a good way to back them up. GitHub is free, and you can also connect with your users and have a ticket-tracker that allows them to tell you about their problems and ideas for the mod in an organized way.
Setting Up GitHub
First, you've gotta sign up for GitHub. GitHub is a full-on private enterprise and widely respected in the oding world, so don't be worried, you won't receive unrelated spam, just a lot of completely related emails about your current projects' activity (you can toggle them off).
Once you've created your account, we've gotta create a project. Click the icon in the top right corner of the page, where the exclamation mark I placed is.
Now, once you click that icon, a screen like this should pop up:
It's pretty self-explanatory, so follow this template (you can have a private repository, but it costs money). I actually prefer clicking on the checkbox "Initialize this repository with a README". Later you can edit the README to have copyright information so that people can't skip away with your code and make a totally new mod that peculiarly resembles yours (or at least they can, before they wind up in court for copyright infringement).
Now we should have a screen that looks somewhat like this:
Now we need to download the official GitHub application to our computer for ease-of-access.
If you are on a Mac, like me, go here: http://mac.github.com/
If you are on Windows, which I also like, go here: http://windows.github.com/
If you are on Linux, the guys who made GitHub (the same guys who made Linux) have something special in store for you. It won't be as easy, but hey, if you're running Linux, you've already gotta be pretty techie: https://help.github....cles/set-up-git.
If you're Linux, you're kind of gonna have to learn from the site on what to do, but you can skip past this next GitHub application part.
Now, I'm not 100% sure about how the GitHub application works on PC, but I believe its very similar, if not completely the same. I have a secondhand PC at home, and so once I get back, I'll check it out for y'all.
Anyways, once we open GitHub (application), we should see a tab like this. If you don't click on it (it's the one with your username). Now go to your desired project and click "Clone to Computer".
It'll now ask you where you want it to be located locally on your computer. If there isn't already one, create a "GitHub" folder somewhere, or use the one that should be created by default in your user folder like me.
Now to add the code in. When you edit your code in Eclipse, it the "mcp" folder might have an "eclipse" folder in it, but that only has .class files, which are obfuscated (jumbled up so the only the computer can read properly) files. We want to only add the .java files (not jumbled up so you can read). The .java files are always located in the "src" folder. So go to Desktop/Mod Making/Forge [Minecraft Version]/forge/mcp/src/minecraft. There should be source folders in there that correspond to your package names.
Look for the one with your username. Now, we want to drag that into your GitHub project folder like this:
Now if we look back at our GitHub application, click on the "Repositories" tab, double click on your mod to open it, and click on the "Changes" tab (on the left side panel) and we can see this:
Now, follow these 4 simple steps whenever you want to send a new commit to GitHub:
Syncing will allow the online repository to update with the one on your computer.
Boom! You've set up GitHub! Whenever you need to make a new commit, simply follow the same steps with the folders and then in the application.
Now this next step is optional, but we need to completely switch gears and go back to the website to set up a ticket tracker. The ticket tracker will allow you to keep track of bugs and new features. You can also set up a wiki here if you want to help document your mod (I prefer using MediaWiki, which is the same service that Wikipedia uses. Check out shoutwiki.com (or wikia.com for easier hosting, but ads and simplified look) for free hosting, a sample one of the mods I'm working on @ paleocraft.shoutwiki.com)
The issue tracker is where you see "Issues". Here's a screenshot, and I highlighted the 3 main tabs (Code, Issue Tracker, and Wiki) that I use most on GitHub:
And that's it! You've set up GitHub, and I just got a VERY long tutorial out of the way!
Blocks are the premises of Minecraft. They're what makes up the Minecraft world. Nearly every mod that adds new content adds some type of block. Today, I'm gonna show you how to add a very basic block. I'm gonna do it the way that I like seeing it in other tutorials and show you a class, and then have an explanation of the code afterwards.
Creating a Basic Block
So we start off with adding the block into our TutorialMod.java:
package fisherman77.tutorialmod.common; //The package your mod is in
import net.minecraft.block.Block;
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.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
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;
import fisherman77.tutorialmod.common.blocks.BlockLimestone;
import fisherman77.tutorialmod.common.handlers.TutorialModServerPacketHandler;
import fisherman77.tutorialmod.common.handlers.TutorialModClientPacketHandler;
@NetworkMod(clientSideRequired=true,serverSideRequired=true, //Whether client side and server side are needed
clientPacketHandlerSpec = @SidedPacketHandler(channels = {"TutorialMod"}, packetHandler = TutorialModClientPacketHandler.class), //For clientside packet handling
serverPacketHandlerSpec = @SidedPacketHandler(channels = {"TutorialMod"}, packetHandler = TutorialModServerPacketHandler.class)) //For serverside packet handling
//MOD BASICS
@Mod(modid="TutorialMod",name="Tutorial Mod",version="Release")
public class TutorialMod {
@Instance("TutorialMod") //The instance, this is very important later on
public static TutorialMod instance = new TutorialMod();
@SidedProxy(clientSide = "fisherman77.tutorialmod.client.TutorialModClientProxy", serverSide = "fisherman77.tutorialmod.common.TutorialModCommonProxy") //Tells Forge the location of your proxies
public static TutorialModCommonProxy proxy;
//BLOCKS
public static Block Limestone;
@PreInit
public void PreInit(FMLPreInitializationEvent e){
//BLOCKS
Limestone = new BlockLimestone(3000).setUnlocalizedName("Limestone"); //3000 is its ID
}
@Init
public void InitTutorialMod(FMLInitializationEvent event){ //Your main initialization method
//BLOCKS (METHOD)
proxy.registerBlocks(); //Calls the registerBlocks method -- This wasn't here before, so don't skip over this!
//MULTIPLAYER ABILITY
NetworkRegistry.instance().registerGuiHandler(this, proxy); //Registers the class that deals with GUI data
}
}
Most of this class is really just copy and paste. What you really need to know is that the 3000 is the block's ID. Blocks can have IDs up to 4096 in Minecraft Forge. Above that, then you're looking at an item's ID.
TutorialModCommonProxy.java:
package fisherman77.tutorialmod.common;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class TutorialModCommonProxy implements IGuiHandler{ //THIS IS IMPORTANT, CANNOT BE A PROXY/GUI HANDLER WITHOUT THIS!!
public void registerRenderInformation() //Client side texture registering
{
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { //For GUI's
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { //For GUI's
return null;
}
public void registerTiles(){ //For registering TileEntities
}
public void registerBlocks(){ //For registering Blocks
//Limestone
GameRegistry.registerBlock(TutorialMod.Limestone, "Limestone");//Needed for all blocks
LanguageRegistry.addName(TutorialMod.Limestone, "Limestone Block");//In-game name
}
public void registerItems(){ //For registering Items
}
}
Here, we register and name the block. I chose to have the in-game name not be "Limestone" as it normally would, but "Limestone Block" for the sake of showing you what determines the in-game name, that a different in-game name doesn't effect the line before it, and that you can put spaces in the in-game name. That being said, please don't put "Block" or "Item" in your ingame name unless you need it.
Now, create a new package called "username.modname.common.blocks", so for me it would be "fisherman77.tutorialmod.common.blocks". Great, now create a new class called BlockLimestone. If you forgot how to create a package or a class please go back to one of the previous tutorials.
BlockLimestone.java:
package fisherman77.tutorialmod.common.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
public class BlockLimestone extends Block
{
public BlockLimestone(int par1)
{
super(par1, Material.rock); //You can set different materials, check them out!
}
public void registerIcons(IconRegister iconRegister)
{
blockIcon = iconRegister.registerIcon("tutorialmod:Limestone");//Telling Forge where our texture is
}
}
Material.rock sets the basic properties it's going to have, such as the sound it makes when you break and step on it, etc. There are many different materials though, so rather than just stick with the usual "Material.rock", see what other materials, such as "Material.wood" or "Material.glass" might fit the block you have in mind.
Lastly, we need to organize our textures. In your "Mod Making" folder create another folder titled "Ready-to-ship". This will be the folder where we package our mods for distribution. Inside that folder create another one with your mod's name, so mine would be "Tutorial Mod", and then inside that one create another folder with the version of that mod, so mine might be "0.1.0".
Inside this folder (yes, lots of folder creation today), create a new folder called "assets", and then another one titled whatever you put in the registerIcons() method. Mine was ("tutorialmod:Limestone"), so I would call my folder "tutorialmod" (lowercase does matter & spaces might too). Then, create another folder in that one called "textures", and then another in "textures" called "blocks", and FINALLY!!! You can place your texture file here. Make sure it is 16 pixels x 16 pixels, and then title it accordingly:
Mine was ("tutorialmod:Limestone"), so it would be "Limestone.png" (it MUST be a .png file).
Last part, copy that "assets" folder and paste it in "Forge [Version]/forge/mcp/eclipse/Minecraft/bin". Now click the white arrow in the green circle in the in-window toolbar up top, or if you can't find it yet, the go to Run>Run in the Eclipse Finder bar (that thing that's always at the top of stuff that has "File", "Edit", etc.)
You've now created your own custom block with custom texture.
Alright, great - we have a basic block. Now how do we acquire that block? Well, we could make it craftable, smeltable, in the creative inventory, droppable, or something else really crazy. Today, I'm gonna cover the two most basic of those, crafting and smelting.
Crafting/Smelting
This tutorial's really not that complicated and really short, and although I haven't shown you how to do basic items (coming up in a short time) yet, I'm gonna include them in this tutorial.
Crafting
So we're only gonna be working in the Common Proxy. So somewhere in our TutorialModCommonProxy, we have an area that looks kind of like this:
TutorialModCommonProxy.java:
and that would give me a crafting recipe for the item. Of course you would want to change the recipe, since a block/item shouldn't be in its own recipe. Still confused? Reread this 2 times, and if you're still confused, leave a reply.
Smelting
Smelting is along very similar lines, except now we can get experience for smelting!
Here is the extra line that we add for Smelting:
GameRegistry.addSmelting(TutorialMod.Limestone.blockID, new ItemStack(TutorialMod.Lime), 0.1F);
This makes it to where I can smelt a Limestone Block in the furnace and end up with a Lime. However, you can include vanilla blocks as well, so new ItemStack(TutorialMod.Lime) could just have easily been new ItemStack(Block.stone) or new ItemStack(Item.stick).
I could've even changed TutorialMod.Limestone.blockID to a vanilla block like Block.stone.blockID, or an item like TutorialMod.Lime.itemID or Item.stick.itemID.
The last part we need to cover is the 0.1F. This is how much experience is given to you once you take the product of the smelting out of the furnace. You can see a reference of experience rewarded for different recipes here - look under the "Exp" column.
0.1F in this line of code would equal 0.1 experience orb/point thingies, which happens to be the same as if I were to smelt cobblestone, sand, or netherrack.
That's about it for this tutorial. If you still have questions after reading it over twice, leave a reply.
Alright. Now I get to take you to the basic Item. Once you have figured out both blocks and items (and preferably crafting/smelting). You have gotten a good foundation to become a modder, and from here you can branch out into a "specialty" as I like to call 'em. Some people like doing dimensions (which I find very complex), others might just like to be an expert with blocks (look at mods like Buildcraft and Industrialcraft), some people really like mobs (me!), and there are many other things to "specialize" in.
You have come far young grasshopper, but there is still much to learn.
Creating a Basic Item
So creating a basic item isn't as hard as creating a basic block. That's a fact. I know, wipe that sweat from your brow and give a sigh of relief. Well, let's get started.
So we've got our basic TutorialMod.java file. Now, in a somewhat similar fashion as we added in our block to that class, let's add in our item. But remember, KEEP IT ORGANIZED! That is about 1/2 of the reason why I write tutorials, because my motto (when I don't feel lazy) is "neat code or no code". Anyways, you don't see the block's code there because its code got erased when I was being stupid last night and accidentally replaced it. Advice: Use GitHub and update your repository whenever you can!
TutorialMod.java:
package fisherman77.tutorialmod.common; //The package your mod is in
import net.minecraft.item.Item;
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.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
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;
import fisherman77.tutorialmod.common.handlers.TutorialModServerPacketHandler;
import fisherman77.tutorialmod.common.handlers.TutorialModClientPacketHandler;
import fisherman77.tutorialmod.common.items.ItemLime;
@NetworkMod(clientSideRequired=true,serverSideRequired=true, //Whether client side and server side are needed
clientPacketHandlerSpec = @SidedPacketHandler(channels = {"TutorialMod"}, packetHandler = TutorialModClientPacketHandler.class), //For clientside packet handling
serverPacketHandlerSpec = @SidedPacketHandler(channels = {"TutorialMod"}, packetHandler = TutorialModServerPacketHandler.class)) //For serverside packet handling
//MOD BASICS
@Mod(modid="TutorialMod",name="Tutorial Mod",version="Release")
public class TutorialMod {
@Instance("TutorialMod") //The instance, this is very important later on
public static TutorialMod instance = new TutorialMod();
@SidedProxy(clientSide = "fisherman77.tutorialmod.client.TutorialModClientProxy", serverSide = "fisherman77.tutorialmod.common.TutorialModCommonProxy") //Tells Forge the location of your proxies
public static TutorialModCommonProxy proxy;
//ITEMS
public static Item Lime;
@PreInit
public void PreInit(FMLPreInitializationEvent e){
//ITEMS
Lime = new ItemLime(5000).setUnlocalizedName("Lime");
}
@Init
public void InitTutorialMod(FMLInitializationEvent event){ //Your main initialization method
//BLOCKS (METHOD)
proxy.registerBlocks();
//ITEMS (METHOD)
proxy.registerItems(); //DON'T FORGET THIS, ADD IT IN AND THEN DELETE THIS REMINDER COMMENT
//MULTIPLAYER ABILITY
NetworkRegistry.instance().registerGuiHandler(this, proxy); //Registers the class that deals with GUI data
}
}
Alright, same as the block, mostly just copy and paste, but don't forget to add in that you call up that registerItems method in your Common Proxy.
Also, 5000 is the item's ID. Remember, blocks go up to 4096, so guess what? Items are from 4096 up. Yes, you can theoretically go to 10,000, but for your users' sake, don't be ridiculous. I'm sure they'll be overjoyed when they have to type "/give fisherman77 10576 64", not to mention how everyone eventually memorizes IDs they use a lot.
Now to our Common Proxy. I just included a crafting recipe for practice from our last tutorial no, if you want the real truth, this Lime item's code is copied from my Goblet item from my Zeuscraft mod and has the same crafting recipe (and I'm feeling lazy right now), so I figured why not. I know its kind of crazy that I write modding tutorials when I'm lazy.
TutorialModCommonProxy.java:
package fisherman77.tutorialmod.common;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import fisherman77.zeuscraft.common.Zeuscraft;
public class TutorialModCommonProxy implements IGuiHandler{ //THIS IS IMPORTANT, CANNOT BE A PROXY/GUI HANDLER WITHOUT THIS!!
public void registerRenderInformation() //Client side texture registering
{
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { //For GUI's
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { //For GUI's
return null;
}
public void registerTiles(){ //For registering TileEntities
}
public void registerBlocks(){ //For registering Blocks
}
public void registerItems(){ //For registering Items
//Lime
LanguageRegistry.addName(TutorialMod.Lime, "Lime");
GameRegistry.addRecipe(new ItemStack(TutorialMod.Lime), "M M", " M ", "MMM", Character.valueOf('M'), Block.planks);
}
}
LanguageRegistry.addName... added in the in-game name, which is in parentheses ("Lime"). That's really all you need to know except for the crafting recipe, which you already understand from the last tutorial.
Now for the place where all the future awesomeness of our lime will happen, along with the texture, the Item class.
Make sure that you create a new package called tutorialmod.common.items and then put it in this package for better organization!
The big thing you need to know here is about the texture ("registerIcons" method). According to what I've put inside the parentheses. My texture directory is going to look like this: assets/tutorialmod/items/Lime.png, and Lime.png is going to be 16x16 pixels big, just like every block/item picture (hint: mobs and GUIs are different).
I might've already said this in my block tutorial (again, lazy right now, not gonna look back), but you should be putting your texture folder together in a separate directory than the one below. I use a totally different folder inside my "Mod Making" folder for constructing mods. It's called "Ready-to-ship" since it's kind of like a packaging factory (packaging mods for shipment tutorial probably next). So the directory of my "assets" folder in "Ready-to-ship" would be Mod Making/Ready-to-ship/Tutorial Mod/1.0.0/
The 1.0.0 can be whatever version your mod is. This way I have 2 copies of my assets folder, which holds all my textures and sounds, and if when Eclipse deletes your copy of "assets" in its eclipse/Minecraft/bin folder, you can just copy and paste the one in the Ready-to-ship folder rather than banging your head on a wall.
Now I can put the assets folder in Mod Making/Forge [MC Version]/forge/mcp/eclipse/Minecraft/bin and I'm ready to go.
Boom. Basic Item. Leave a reply if you have a question or if something's wrong, but don't quote this entire tutorial, because that's ignant.
Now, you have a block, item, both, or a bunch of both, and want to distribute your mod. Easy, assuming you followed what I told you in the block and item tutorials, and have a Ready-to-ship folder. If you didn't, no prob, just follow along and create and insert new stuff where needed to match the tutorial.
Bigger note: I'm on a Mac, so this might not work for PC/Linux people, but it's likely it will. I have a PC somewhere, so I'll be able to make a PC-compatible addon to this later.
Packaging Your Mod for Distribution
First, we need to open up Terminal (Command Prompt on PC). Make sure that you have a folder structure like this: Mod Making/Ready-to-ship/Tutorial Mod/ and then a bunch of folders for different versions. In this tutorial, I'll just say my version is 1.0.0
Now in terminal do the same thing as we did before when you installed forge (the cd... thing) except this time DRAG THE FOLDER ICON OF YOUR "mcp" folder (located within the forge one). So like this (remember?) except this time, the "mcp" folder:
Before you continue, make sure you have tested your most recent code in Eclipse (by clicking the white button inside the green circle up top). If you have hit return/enter. Now type bash recompile.sh. Hit return/enter. Wait for that finish, and then type bash reobfuscate.sh. Now it should "Output" a bunch of classes. Once this is finished, go to the "reobf" folder (in the "mcp" folder). Open the "minecraft" folder, and you should see a folder with your username. Copy that folder to the clipboard (Command-C).
Now let's go back to your "Ready-to-ship" folder:
Inside your version's folder (in my case 1.0.0), you should already have the "assets" folder. Paste the reobfuscated folder (the one on your clipboard with your username) into the same directory of the "assets" folder ("Ready-to-ship/Tutorial Mod/1.0.0/).
Now open up TextWrangler, and create a new file called mcmod.info. It's contents should look something like this (replace someof the parts with your stuff):
Save it into the same directory as you did with the other two files (in my case "/1.0.0/".
Now back in Terminal we do "cd " followed by the folder directory for your version your packaging. So I would do
cd /Users/Buck/Desktop/Mod\ Making/Ready-to-ship/Tutorial\ Mod/1.0.0
Now you can just compress them all into a .zip (preferably using Yemu-zip for PC compatability), or you can use the following method, which I like better:
now type (in Terminal)
jar cf [1.6.2]TutorialMod1.0.0 assets fisherman77 mcmod.info
of course, replace TutorialMod with whatever your mods name is, and 1.0.0 with your version, but in that first clump of stuff after cf ([1.6.2]TutorialMod1.0.0) don't put any spaces. Then we put the spaces to show what we want in the .jar. Change "fisherman77" to whatever your username is (lowercase, since all packages are lowercase). Press return/enter.
Now there should be a file up top inside your version's folder (same place as assets, fisherman77, and mcmod.info) called [1.6.2]TutorialMod1.0.0 with no .jar extension. Edit the name, put spaces between things that need them, and put a .jar on the very end of the name. You should end up with a redistributable .jar file.
Now you can post that for download on a site like Dropbox or MediaFire, and give that link to whoever can DL, or post it on your mod's thread.
All should work for 1.6.4, with maybe some minor changes in method names in NPC. Let me know if you have problems.
Hello again. Looks like we're back with an update that changes a lot. So I figured I mine as well document what I learn as I go. This is gonna be pretty relaxed, so I might write up a big, extensive tutorial documenting and explaining everything, I might just copy and paste another tutorial or some code, or I might just put a link to something helpful. The catch is I'm gonna do my best to keep everything updated.
If you have any comments or questions (or requests, once we all get a little more comfortable in 1.6.2), please leave a reply. Also, I admire simo_415's way of doing things (as you can see from my tutorial list), so if you can, please leave a tutorial as a reply on this thread & I can link to it below:
First Steps:
Setting Up MCP & Forge
Minecraft Version: 1.6.4
Authors: Sprite99 (Original Author) & fisherman77
Setting Up Eclipse
Minecraft Version: 1.6.4
Authors: Sprite99 (Original Author) & fisherman77
Setting Up GitHub
Minecraft Version: all
Authors: fisherman77
Creating a Basic Mod
Minecraft Version: 1.6.4
Authors: DeverionX (Original Author, I think) & fisherman77
Packaging Your Mod for Distribution
Minecraft Version: 1.6.4
Authors: fisherman77
Blocks:
Creating a Basic Block
Minecraft Version: 1.6.4
Authors: fisherman77
Crafting and Smelting Recipes
Minecraft Version: 1.6.4
Authors: fisherman77
Items:
Creating a Basic Item
Minecraft Version: 1.6.4
Authors: fisherman77
Crafting and Smelting Recipes
Minecraft Version: 1.6.4
Authors: fisherman77
Mobs:
Creating a Basic NPC
Minecraft Version: 1.6.4
Authors: fisherman77
Creating a Custom Modeled Mob
Minecraft Version: 1.6.4
Authors: fisherman77
Forge.
Do you think you could make a full mob tutorial for 1.6.1?
Ya. I'll definitely do mobs, since they're my favorite & specialty, I just gotta figure them out
Thank you for the help. I think I might link to your tut instead for the block/item textures.
Tons of credit go out to Sprite99's Tutorials. He originally made this tutorial, and then I just changed the things that I thought should be different and added pictures for more visual instruction.
Setting Up MCP & Forge
First, download the recommended/latest version of the src download of Minecraft Forge from the forge website:http://files.minecraftforge.net.
**Note**: The "latest" version can be unstable, so download the "recommended" version for the latest Minecraft Version if possible.
Shown above is the Forge download screen as of 7 July 2013
After you download the MCP and forge .zips, extract them using 7-Zip or another program (will be done automatically by double clicking if you are on a Mac or Linux).
Next, create a folder on your desktop called "Mod Making". Create another new folder in the "Mod Making" folder and rename it "Forge [Minecraft Version]". Drag the forge in folder and
Now we are ready to start forge! Operating System specific instructions below:
Mac OSX
Open terminal (You can find terminal at /Applications/Utilities/Terminal.app, or you can use spotlight to find it. Navigate to the "forge" folder inside the "Forge [Minecraft Version]" folder Now type cd (make sure to include the space after) and drag the folder icon next to the title of the folder near the top of finder into the Terminal dialog (easier illustrated):
Now type in bash install.sh into Terminal.
Forge will now start to download and install the necessary files. It will then automatically decompile the Minecraft source code. This process can take between 15-20 minutes, and sometimes even longer, so be patient.
Linux/Unix
All you need to do to install forge on Linux systems is locate the "install.sh" file in the "/Desktop/Mod Making/Forge [Minecraft Version]/forge" folder. After you double click it, it will begin to execute a script which will download and install the necessary files. It will then automatically decompile the Minecraft source code. This process can take between 15-20 minutes, and sometimes even longer, so be patient.
Windows
All you need to do to install forge on Windows is locate the "install.bat" file in the "/Desktop/Mod Making/Forge [Minecraft Version]/forge" folder. After you double click it, it will begin to execute a script which will download and install the necessary files. It will then automatically decompile the Minecraft source code. This process can take between 15-20 minutes, and sometimes even longer, so be patient.
Setting Up Eclipse
First, download the latest version of Eclipse from the website, being sure to select the correct Operating System. Scroll down to the download"Eclipse IDE for Java Developers". The downloads are located at:
http://www.eclipse.org/downloads/
Now, open Eclipse. You will be prompted to select the workspace location. Select your "Desktop" directory and then type in "/Mod Making/Forge [Minecraft Version]/forge/mcp/eclipse".
Press "OK". You are now done setting up Eclipse!
In this tutorial, I'm going to show you how to make a simple Forge mod. This mod will not do anything right now, but it sets up to be able to do much more!
Creating a Basic Mod
Now we need to create a new package. A package is kind like a scaled-down folder that holds code in a Java project.
Now there isn't a set requirement for naming packages, but to help with organization, I like to follow this method (username.ModName.common):
Make sure that the package you just created is selected
Next, we need to learn to create a class. Classes are the basic .java files.
Now we need to name our class. In my tutorials I usually use "Tutorial Mod" as the name of my example mod, so the first class (I call it the main class or mainframe) should be TutorialMod.java (no spaces in names, please). So for example, Glacier Ice gets GlacierIce.java as the name for its main class. Then click "Finish".
Now copy and paste this code into your new TutorialMod.java:
You will have some initial errors, but we'll still be able to clean this up in a sec. I'll explain most of the class as we go through other tutorials that pertain to certain parts, but here are some basics:
TutorialModCommonProxy.java:
Now we need to create two more packages named "fisherman77.TutorialMod.client" and "fisherman77.TutorialMod.common.handlers".
Good job! Only 3 more classes to make in these new packages!
In "fisherman77.TutorialMod.client" make the "TutorialModClientProxy" class.
TutorialModClientProxy.java:
In "fisherman77.TutorialMod.common.handlers" create the new classes "TutorialModClientPacketHandler" and "TutorialModServerPacketHandler" & copy and paste this code: (Sorry, this is as much copy and paste that happens, but there are comments inside the code to help you understand)
TutorialModClientPacketHandler.java:
TutorialModServerPacketHandler.java:
Good! You're now good to go for nearly all of the other basic tutorial, such as blocks, items, mobs, GUIs, etc!
Setting up a GitHub project for your mod really helps teams all working on the same mod. In case something does happen to your mod files on your computer (and trust me, something probably will happen), then this is a good way to back them up. GitHub is free, and you can also connect with your users and have a ticket-tracker that allows them to tell you about their problems and ideas for the mod in an organized way.
Setting Up GitHub
First, you've gotta sign up for GitHub. GitHub is a full-on private enterprise and widely respected in the oding world, so don't be worried, you won't receive unrelated spam, just a lot of completely related emails about your current projects' activity (you can toggle them off).
Once you've created your account, we've gotta create a project. Click the icon in the top right corner of the page, where the exclamation mark I placed is.
Now, once you click that icon, a screen like this should pop up:
It's pretty self-explanatory, so follow this template (you can have a private repository, but it costs money). I actually prefer clicking on the checkbox "Initialize this repository with a README". Later you can edit the README to have copyright information so that people can't skip away with your code and make a totally new mod that peculiarly resembles yours (or at least they can, before they wind up in court for copyright infringement).
Now we should have a screen that looks somewhat like this:
Now we need to download the official GitHub application to our computer for ease-of-access.
If you are on a Mac, like me, go here: http://mac.github.com/
If you are on Windows, which I also like, go here: http://windows.github.com/
If you are on Linux, the guys who made GitHub (the same guys who made Linux) have something special in store for you. It won't be as easy, but hey, if you're running Linux, you've already gotta be pretty techie: https://help.github....cles/set-up-git.
If you're Linux, you're kind of gonna have to learn from the site on what to do, but you can skip past this next GitHub application part.
Now, I'm not 100% sure about how the GitHub application works on PC, but I believe its very similar, if not completely the same. I have a secondhand PC at home, and so once I get back, I'll check it out for y'all.
Anyways, once we open GitHub (application), we should see a tab like this. If you don't click on it (it's the one with your username). Now go to your desired project and click "Clone to Computer".
It'll now ask you where you want it to be located locally on your computer. If there isn't already one, create a "GitHub" folder somewhere, or use the one that should be created by default in your user folder like me.
Now to add the code in. When you edit your code in Eclipse, it the "mcp" folder might have an "eclipse" folder in it, but that only has .class files, which are obfuscated (jumbled up so the only the computer can read properly) files. We want to only add the .java files (not jumbled up so you can read). The .java files are always located in the "src" folder. So go to Desktop/Mod Making/Forge [Minecraft Version]/forge/mcp/src/minecraft. There should be source folders in there that correspond to your package names.
Look for the one with your username. Now, we want to drag that into your GitHub project folder like this:
Now if we look back at our GitHub application, click on the "Repositories" tab, double click on your mod to open it, and click on the "Changes" tab (on the left side panel) and we can see this:
Now, follow these 4 simple steps whenever you want to send a new commit to GitHub:
Syncing will allow the online repository to update with the one on your computer.
Boom! You've set up GitHub! Whenever you need to make a new commit, simply follow the same steps with the folders and then in the application.
Now this next step is optional, but we need to completely switch gears and go back to the website to set up a ticket tracker. The ticket tracker will allow you to keep track of bugs and new features. You can also set up a wiki here if you want to help document your mod (I prefer using MediaWiki, which is the same service that Wikipedia uses. Check out shoutwiki.com (or wikia.com for easier hosting, but ads and simplified look) for free hosting, a sample one of the mods I'm working on @ paleocraft.shoutwiki.com)
The issue tracker is where you see "Issues". Here's a screenshot, and I highlighted the 3 main tabs (Code, Issue Tracker, and Wiki) that I use most on GitHub:
And that's it! You've set up GitHub, and I just got a VERY long tutorial out of the way!
Creating a Basic Block
So we start off with adding the block into our TutorialMod.java:
Most of this class is really just copy and paste. What you really need to know is that the 3000 is the block's ID. Blocks can have IDs up to 4096 in Minecraft Forge. Above that, then you're looking at an item's ID.
TutorialModCommonProxy.java:
Here, we register and name the block. I chose to have the in-game name not be "Limestone" as it normally would, but "Limestone Block" for the sake of showing you what determines the in-game name, that a different in-game name doesn't effect the line before it, and that you can put spaces in the in-game name. That being said, please don't put "Block" or "Item" in your ingame name unless you need it.
Now, create a new package called "username.modname.common.blocks", so for me it would be "fisherman77.tutorialmod.common.blocks". Great, now create a new class called BlockLimestone. If you forgot how to create a package or a class please go back to one of the previous tutorials.
BlockLimestone.java:
Material.rock sets the basic properties it's going to have, such as the sound it makes when you break and step on it, etc. There are many different materials though, so rather than just stick with the usual "Material.rock", see what other materials, such as "Material.wood" or "Material.glass" might fit the block you have in mind.
Lastly, we need to organize our textures. In your "Mod Making" folder create another folder titled "Ready-to-ship". This will be the folder where we package our mods for distribution. Inside that folder create another one with your mod's name, so mine would be "Tutorial Mod", and then inside that one create another folder with the version of that mod, so mine might be "0.1.0".
Inside this folder (yes, lots of folder creation today), create a new folder called "assets", and then another one titled whatever you put in the registerIcons() method. Mine was ("tutorialmod:Limestone"), so I would call my folder "tutorialmod" (lowercase does matter & spaces might too). Then, create another folder in that one called "textures", and then another in "textures" called "blocks", and FINALLY!!! You can place your texture file here. Make sure it is 16 pixels x 16 pixels, and then title it accordingly:
Mine was ("tutorialmod:Limestone"), so it would be "Limestone.png" (it MUST be a .png file).
Last part, copy that "assets" folder and paste it in "Forge [Version]/forge/mcp/eclipse/Minecraft/bin". Now click the white arrow in the green circle in the in-window toolbar up top, or if you can't find it yet, the go to Run>Run in the Eclipse Finder bar (that thing that's always at the top of stuff that has "File", "Edit", etc.)
You've now created your own custom block with custom texture.
I was thinking Items, but sure!
If it seems like I'm skipping a little bit, that's because I want to get to my most favorite, mobs!
Crafting/Smelting
This tutorial's really not that complicated and really short, and although I haven't shown you how to do basic items (coming up in a short time) yet, I'm gonna include them in this tutorial.
Crafting
So we're only gonna be working in the Common Proxy. So somewhere in our TutorialModCommonProxy, we have an area that looks kind of like this:
TutorialModCommonProxy.java:
Well, I'm simply gonna plop another line in there. The other line should look something like this:
That recipe would come out something like this:
NOTE: The golden apple represents TutorialMod.Lime, which is a (not for too long - next tut) imaginary item that I made up.
Why did I include one of my own custom non-Vanilla items from my mod in the recipe? Because I can, and to show you that you can and how.
Now, the big catch is that I can use this same line of code for an item, say our old lime. I could just as easily go:
and that would give me a crafting recipe for the item. Of course you would want to change the recipe, since a block/item shouldn't be in its own recipe. Still confused? Reread this 2 times, and if you're still confused, leave a reply.
Smelting
Smelting is along very similar lines, except now we can get experience for smelting!
Here is the extra line that we add for Smelting:
This makes it to where I can smelt a Limestone Block in the furnace and end up with a Lime. However, you can include vanilla blocks as well, so new ItemStack(TutorialMod.Lime) could just have easily been new ItemStack(Block.stone) or new ItemStack(Item.stick).
I could've even changed TutorialMod.Limestone.blockID to a vanilla block like Block.stone.blockID, or an item like TutorialMod.Lime.itemID or Item.stick.itemID.
The last part we need to cover is the 0.1F. This is how much experience is given to you once you take the product of the smelting out of the furnace. You can see a reference of experience rewarded for different recipes here - look under the "Exp" column.
0.1F in this line of code would equal 0.1 experience orb/point thingies, which happens to be the same as if I were to smelt cobblestone, sand, or netherrack.
That's about it for this tutorial. If you still have questions after reading it over twice, leave a reply.
You have come far young grasshopper, but there is still much to learn.
Creating a Basic Item
So creating a basic item isn't as hard as creating a basic block. That's a fact. I know, wipe that sweat from your brow and give a sigh of relief. Well, let's get started.
So we've got our basic TutorialMod.java file. Now, in a somewhat similar fashion as we added in our block to that class, let's add in our item. But remember, KEEP IT ORGANIZED! That is about 1/2 of the reason why I write tutorials, because my motto (when I don't feel lazy) is "neat code or no code". Anyways, you don't see the block's code there because its code got erased when I was being stupid last night and accidentally replaced it. Advice: Use GitHub and update your repository whenever you can!
TutorialMod.java:
Alright, same as the block, mostly just copy and paste, but don't forget to add in that you call up that registerItems method in your Common Proxy.
Also, 5000 is the item's ID. Remember, blocks go up to 4096, so guess what? Items are from 4096 up. Yes, you can theoretically go to 10,000, but for your users' sake, don't be ridiculous. I'm sure they'll be overjoyed when they have to type "/give fisherman77 10576 64", not to mention how everyone eventually memorizes IDs they use a lot.
Now to our Common Proxy. I just included a crafting recipe
for practice from our last tutorialno, if you want the real truth, this Lime item's code is copied from my Goblet item from my Zeuscraft mod and has the same crafting recipe (and I'm feeling lazy right now), so I figured why not. I know its kind of crazy that I write modding tutorials when I'm lazy.TutorialModCommonProxy.java:
LanguageRegistry.addName... added in the in-game name, which is in parentheses ("Lime"). That's really all you need to know except for the crafting recipe, which you already understand from the last tutorial.
Now for the place where all the future awesomeness of our lime will happen, along with the texture, the Item class.
Make sure that you create a new package called tutorialmod.common.items and then put it in this package for better organization!
ItemLime.java:
The big thing you need to know here is about the texture ("registerIcons" method). According to what I've put inside the parentheses. My texture directory is going to look like this: assets/tutorialmod/items/Lime.png, and Lime.png is going to be 16x16 pixels big, just like every block/item picture (hint: mobs and GUIs are different).
I might've already said this in my block tutorial (again, lazy right now, not gonna look back), but you should be putting your texture folder together in a separate directory than the one below. I use a totally different folder inside my "Mod Making" folder for constructing mods. It's called "Ready-to-ship" since it's kind of like a packaging factory (packaging mods for shipment tutorial probably next). So the directory of my "assets" folder in "Ready-to-ship" would be Mod Making/Ready-to-ship/Tutorial Mod/1.0.0/
The 1.0.0 can be whatever version your mod is. This way I have 2 copies of my assets folder, which holds all my textures and sounds, and
ifwhen Eclipse deletes your copy of "assets" in its eclipse/Minecraft/bin folder, you can just copy and paste the one in the Ready-to-ship folder rather than banging your head on a wall.Now I can put the assets folder in Mod Making/Forge [MC Version]/forge/mcp/eclipse/Minecraft/bin and I'm ready to go.
Boom. Basic Item. Leave a reply if you have a question or if something's wrong, but don't quote this entire tutorial, because that's ignant.
Bigger note: I'm on a Mac, so this might not work for PC/Linux people, but it's likely it will. I have a PC somewhere, so I'll be able to make a PC-compatible addon to this later.
Packaging Your Mod for Distribution
First, we need to open up Terminal (Command Prompt on PC). Make sure that you have a folder structure like this: Mod Making/Ready-to-ship/Tutorial Mod/ and then a bunch of folders for different versions. In this tutorial, I'll just say my version is 1.0.0
Now in terminal do the same thing as we did before when you installed forge (the cd... thing) except this time DRAG THE FOLDER ICON OF YOUR "mcp" folder (located within the forge one). So like this (remember?) except this time, the "mcp" folder:
Before you continue, make sure you have tested your most recent code in Eclipse (by clicking the white button inside the green circle up top). If you have hit return/enter. Now type bash recompile.sh. Hit return/enter. Wait for that finish, and then type bash reobfuscate.sh. Now it should "Output" a bunch of classes. Once this is finished, go to the "reobf" folder (in the "mcp" folder). Open the "minecraft" folder, and you should see a folder with your username. Copy that folder to the clipboard (Command-C).
Now let's go back to your "Ready-to-ship" folder:
Inside your version's folder (in my case 1.0.0), you should already have the "assets" folder. Paste the reobfuscated folder (the one on your clipboard with your username) into the same directory of the "assets" folder ("Ready-to-ship/Tutorial Mod/1.0.0/).
Now open up TextWrangler, and create a new file called mcmod.info. It's contents should look something like this (replace someof the parts with your stuff):
Save it into the same directory as you did with the other two files (in my case "/1.0.0/".
Now back in Terminal we do "cd " followed by the folder directory for your version your packaging. So I would do
Now you can just compress them all into a .zip (preferably using Yemu-zip for PC compatability), or you can use the following method, which I like better:
now type (in Terminal)
of course, replace TutorialMod with whatever your mods name is, and 1.0.0 with your version, but in that first clump of stuff after cf ([1.6.2]TutorialMod1.0.0) don't put any spaces. Then we put the spaces to show what we want in the .jar. Change "fisherman77" to whatever your username is (lowercase, since all packages are lowercase). Press return/enter.
Now there should be a file up top inside your version's folder (same place as assets, fisherman77, and mcmod.info) called [1.6.2]TutorialMod1.0.0 with no .jar extension. Edit the name, put spaces between things that need them, and put a .jar on the very end of the name. You should end up with a redistributable .jar file.
Now you can post that for download on a site like Dropbox or MediaFire, and give that link to whoever can DL, or post it on your mod's thread.
Here is the code in my main class.
Here is a picture of what happened..
Can you find what the problem is? Thanks buddy.
You don't NEED to register items. take those lines out and see if it helps.
Could you please post your ItemCopperSword.java & ItemCopperHoe? And is it just the sword, or all of the tools?
ItemCopperHoe
EDIT - taking out register items doesnt help.