This post is being discontinued. Click Here if you still want to learn about coding from MCE626. This is a full tutorial only on forge.
Hi, I'm MCE626 from YouTube. I make mods and I'm the owner of "MCE626's Server." Since I make mods, I felt like helping other people with their modding problems. Now, I didn't feel like making a whole tutorial, because it would be a lot of stuff to do, and it would be kinda hard to update, so I'm just doing some short tips and tricks. Now I'm assuming you have your main mod class and blocks and stuff, so there won't be too much of whole class files in this. There'll just be some little parts and stuff you can add to your mod. You don't need to give me credit if you use one of my tips coding parts, but you can give a special thanks to me in your mod if you want.
*If you have a problem, I encourage you to visit my Forum website, and post there, instead of on this post. Posting your errors and stuff kinda makes this a little messy, but you can if you want to. And i check that more than this post...*
Forge ModLoader 1.6
Coming soon! - Custom Tree
Colored Names of Items or Blocks
Under the "private static void languageRegisters() {}" Type this -
LanguageRegistry.addName(Block or item name, "\u00A74 In-game name ");
The "/u00A7" is the code that Minecraft reads for coloring names.
The "4" after the "/u00A7" is what color/format the text will be. In this case, "4" is dark red.
Colors/Formats
0 - Black
1 - Dark Blue
2 - Dark Green
3 - Dark Aqua/Cyan
4 - Dark Red
5 - Purple
6 - Gold/Dark Yellow
7 - Gray
8 - Dark Gray
9 - Blue
a - Green
b - Aqua/Cyan
c - Red
d - Light Purple/Pink
e - Yellow
f -White
Format Code -
k - "Magic"
l - Bold
m - Strikethrough
n - Underline
o - Italic
r - Reset
If you want some text to be a different color than the first text, but still want it on the same line, type this -
LanguageRegistry.addName(Block or item name, "\u00A74 In-game name " + "/u00A7b Other Colored Text");
The "b" in this case is Cyan/Aqua. It's on the same line as the red "In-game name", just a different color.
If you don't want the tool tip to be colored, just take out the "\u00A74"
Extended Tool Tips for Items (With Colors too)
This is in the item's class file (Example: ItemSlimeEye.java)
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean i)
{
list.add("\u00A72Green!");
}
The "\u00A72" is the code that Minecraft reads for coloring names.
The "2" after the "\u00A7" is what color/format the text will be. In this case, "2" is green.
If you don't want the tool tip to be colored, just take out the "\u00A72".
Colors/Formats
0 - Black
1 - Dark Blue
2 - Dark Green
3 - Dark Aqua/Cyan
4 - Dark Red
5 - Purple
6 - Gold/Dark Yellow
7 - Gray
8 - Dark Gray
9 - Blue
a - Green
b - Aqua/Cyan
c - Red
d - Light Purple/Pink
e - Yellow
f -White
Format Code -
k - "Magic"
l - Bold
m - Strikethrough
n - Underline
o - Italic
r - Reset
This code would be good for logs, the top and the bottom would be the same, and all the sides would be the same.
Adding Custom Creative Tab
In the "public void preInit(FMLPreInitializationEvent event) {}" Type this -
public static CreativeTabs TabName = new CreativeTabs("Tab Name") {
public ItemStack getIconItemStack() {
return new ItemStack(Icon, 1, 0);
}
};
TabName is obviously what the creative tab name will be called. Icon is what the picture will be for your creative tab. You can use a block or item from your mod. If you are going to use a block or item from normal Minecraft, you have to do "Block.BlockName" or "Item.ItemName".
Then in the "private static void languageRegisters() {}" section, type this -
Again, the TabName is what the name of the tab will be called.
Making a Block do Multiple Drops This is in the Block's class file
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3,
int par4, int par5) {
if(!par1World.isRemote){
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3,
par4, new ItemStack(Item.flint, 1, 0)));
}
}
Change the "1" in "New ItemStack(Item.flint, 1, 0)));") to make the block drop more than one flint.
Be sure to put the "!" in front of the "par1Word.isRemote)" otherwise the block will drop some item that you can't pick up. It's that glitchy can't pick this item up thing...
*If you put (Note the "new ItemStack(this.BlockID, 1, 0)));"
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3,
par4, new ItemStack(this.BlockID, 1, 0)));
it will drop 2 of the block. So setting that one to a 2 will then drop 3 of the block. Setting it to 10, will drop 11 of the block, etc.
Remove a Recipe without Editing a "Bass Class"
This pretty much makes your mod able to load in the "mods" folder, if you need to remove a recipe.
Now this is to remove a vanilla recipe, and I'm sure it'll work with removing a recipe from a different mod.
This is the code that does the action. This doesn't go in the load method or anything in the main class. This is it's own method.
Now, "mod_MoreBlocks" is my mod, so you'd have to change that.
If your wondering why my mod removes the stick recipe, it's because I wanted to have colored sticks. (Birch tick, pine stick, etc.) I also had to put in the normal stick recipe back though my mod, since to get a normal stick (in my mod) you can only use oak planks. (In vanilla, it's any planks)
You can put more than one, just add it under the other one you put!
Custom Slabs (Stackable, and Flammable)
So, you want to make a slab. Then here's the code! (Uses config code to make a config file!)
public static BlockHalfSlab BlockTUTSlab;
public static BlockHalfSlab BlockTUTDoubleSlab;
int BlockTUTSlabid;
int BlockTUTDoubleSlabid;
And bam! You got a flammable, stackable slab! (Flammable if you made it for wood that is...)
If you don't want it to burn up remove this code in the slab's class file -
setBurnProperties(this.blockID, 5, 20);
Config Generation
So for this, you have to create your blocks in the code a little differently, maybe you already have made them like this, but for blocks, you need to set them up as this (not in pre init or anything, just under the "modid" stuff) -
public static Block TestBlock;
int TestBlockid;
The "int" thing will be used in the config part.
You cannot set the "int" thing to the same name as the public static. You don't have to put "id" at the end, it can be something else, i just put "id" so i know it's the id, and what ever you set the "int" as, is going to be the id.
Now, the config goes in the "PreInit" method. You may or may not have it, but here's how to set that up -
So, the "TestBlockid" was that "int" thing you put above it. That "int" statement is connected to the "public static Block TestBlock"
The "Block IDs" in the "config.get" is the overall name for what ever your making. I do, "Blocks" and "Items" and i did most recently for my mod "Tools". For me, i added 201 tools, and i didn't feel like adding them into the "Items" section for the config...
The "Test Block ID" will be the name it shows. It's for that specific block, and not an overall name. If you do copy and paste this to add another block, it is important to rename this, or it will overwrite the first block when trying to craft it.
"500" is the block's ID. Since this is a config, people can change the id of the block or item, if it's running into another mod.
".getInt()" you need. Not really sure what it does, but you need it.
Then to make the block and it properties, set it up like this (For 1.6.1, the constructors or what ever this is called also go in the "PreInit" below the "config.save"-
TestBlock = new TestBlock(TestBlocktid, Material.ground)
.setUnlocalizedName("Test").setHardness(2F).setResistance(2F)
.setLightValue(0).setStepSound(Block.soundStoneFootstep)
.setCreativeTab(CreativeTabs.tabBlock);
So, first off this goes in the PreInit statement for 1.6, under the "config.save()"
The "TestBlockid" is where the id used to go, if you didn't have a config. Now since the "TestBlockid" is in the config code and has an id of 500, the block's id will be 500, but people can change it if it's running into another mod.
To change the of of the block, in "hard code" just go to the config part and change "500" to what ever.
Items are relatively the same.
public static Item TestItem;
int TestItemid;
So the config goes (Under the block config part, or above it)-
TestItem = new TestItem(TestItemid)
.setUnlocalizedName("TestItem").setMaxStackSize(64)
.setCreativeTab(CreativeTabs.tabMaterials);
So it's "TestItemid" now, and this has a "setMaxStackSize"
If you want to make armor or tools or something else and "blocks" or "items" is to big of a topic, just in the config code part, change from "Item IDs" or "Block IDs" to "Tools" or "Armor" or what ever, and it will show up in a new list in the config file.
Now if you remove a item/block or change the id, and the game crashes or isn't loading something right, sometimes you have to go and delete the config in in mcp. (forge/mcp/jars/config)Don't worry, it'll make a new one once you play again in eclipse.
Now here's what the config will look like (Or somewhat to it, depending if you went straight from this, or change this to your own stuff) -
Textures for Blocks and Items (Not Multitextured blocks)
So first thing is you need to go to the "minecraft" folder in "src" in forge. Make a new folder called "assets" then in that, make a new one called what your modid name is. No uppercase letters are applied, but "_" are allowed. (Not sure about "-")
In that, i made another folder called "textures" then "blocks" and "items"
The code for the block, goes in the block's class file (If it has one of it's own)
public void registerIcons(IconRegister reg)
{
this.blockIcon = reg.registerIcon("ModID:TextureName");
}
If your block is like a fence, and uses the birch wood, and doesn't have it's own class, put this code in the main class -
So this is that block constructor thing in the main file. The "TestBlock = new BlockFence(id...blah blah"
SomeFence = new BlockFence(ID, "planks_birch", Material.wood);
The "SomeFence" is your block. "new BlockFence" is what class the block is going to use. "ID" is the ID number of your block. "planks_birch" will give this fence a birch colored block. To make that a pine or jungle, type "planks_jungle" or "planks_spruce"
You can do more than the woods, like stone or dirt. Just replace the "plank_" with "stone" or "dirt" or "bedrock" or what ever.
I haven't found out yet how to do the diamond block texture or iron or gold, etc. This includes the ore textures.
For torches, (And redstone ones) put this code after the "RedstoneGoldTorch = new ModTorch(id...)" but before the ";" -
.func_111022_d("ModID:TextureName")
Now for items.
It's pretty much the same code as the block, but one thing has been changed from it. This goes in your block class file (If it has one)
public void registerIcons(IconRegister reg) {
this.itemIcon = reg.registerIcon("ModID:ITextureName");
}
Now for tools that don't have their own class. It uses the vanilla class
In that "Tool = new ToolPickaxe(id)" thing, put this before the ";" -
.func_111206_d("ModID:TextureName")
That's it! That's all.
ModLoader 1.5.2
Custom Achievements (Still for 1.5.2)
Under the "public class Base extends BaseMod { }", put this code in -
public static final Achievement achievementDirt = new Achievement(5000,
"achievementDirt", 0, 15, Block.dirt, null).setIndependent()
.registerAchievement();
"Achievement" is the vanilla minecraft class file for achievements. "5000" is the achievement ID. "achievementDirt" is setting the name, not the in game name. "0, 15" is where it will show up on the achievement page. "Block.dirt" is the achievement pictures or image on the icon in the achievement page. "null" is where a different achievement name goes, if it's based off of another one. Since this is a stand alone achievement, and does not require, or based off another achievement, we set it to "null"
".setIndependent()" is making it where it's on it's own, and you can get it at anytime. Kinda like the open inventory achievement.
".registerAchievement" registers the achievement
After that, put this code in the "public void load() { }" -
ModLoader.addAchievementDesc(achievementDirt, "Dirt",
"Pick up some dirt...");
".addAchievementDesc" is adding the achievement description. The in game name and the text under it.
The first one ("Dirt") is the name.
The second one("Pick up some dirt...") is the description of the achievement.
Once that has been added, put this in. (This is it's own method, it does not go in the load method.) -
public void onItemPickup(EntityPlayer entityplayer, ItemStack itemstack) {
if (itemstack.itemID == Block.dirt.blockID) {
entityplayer.addStat(achievementDirt, 1);
}
}
"onItemPickup" means it'll give you the achievement for picking up an item.
"Block.dirt.blockID" is what that item you pick up in order to get the achievement
"entityplayer.addStat(achievementDirt, 1)" is adding the achievement. The "achievementDirt" is what achievement it's adding and the "1" is pretty much saying it's the first one added from the mod...I'm not entirely sure what it does, but i know if you have more than one achievement, you can't go out of order, they have to be counting up....
Done!!
But wait! There's other ones too!
Like:
- Taking from crafting
- Setting "special"
Dependent on another achievement (Still item pickup)
So, again in the "Base extends BasMod{ }" thing, put this in! (Based off of achievement from above) -
public static final Achievement achievementSeed = new Achievement(5001,
"achievementSeed", 0, 20, Item.seeds, achievementDirt)
.registerAchievement();
"achievementSeed" is what it's called. "5001" is the ID. "0, 20" is where it'll be on the achievement page. "Iten.seeds" in the picture, and "achievementDirt" mean it's linked to that achievement.
Then, put this in your "load" method -
ModLoader.addAchievementDesc(achievementSeed, "Seeds",
"Pick up some seeds...");
"achievementSeed" is the name, "Seeds" is the in game name, and "Pick up some seeds..." is the description of the achievement.
Then in that "public void onItemPickup" method, put -
if (itemstack.itemID == Item.seeds.itemID) {
entityplayer.addStat(achievementSeed, 2);
}
"Item.seeds.itemID" is what the achievement uses for you to get the achievement.
"achievementSeed" is the name, and "2" is the 2nd one added....i think...
One more! This one is set to "Special!" (Has cool border around achievement) and taking from crafting
Again, put this in the "Base extends BaseMod { }" -
public static final Achievement achievementEnderChest = new Achievement(
5002, "achievementEnderChest", 0, 25, Block.enderChest, null)
.setIndependent().setSpecial().registerAchievement();
So i think you know by now that "5002" is the ID, the "achievementEnderChest" is the name, "0, 25" is where's it's located, "BlockenderChest" is the icon picture, "null" means it's not dependent on another achievement.
".setIndependent" means it's on its own.
".setSpecial" mean it has a cool border around the achievemnt. (Take a look at the last vanilla mc achievement, "The End" with the enderdragon egg. It has a wavy or spiky border.)
Then put this in the "load" method -
ModLoader.addAchievementDesc(achievementEnderChest, "Magical Chest",
"Craft an Ender Chest");
I think you know what the parameters are now.
Then for taking from crafting, put this in (under the "load" method) -
public void takenFromCrafting(EntityPlayer entityplayer,
ItemStack itemstack, IInventory iinventory) {
if (itemstack.itemID == Block.enderChest.blockID) {
entityplayer.addStat(achievementEnderChest, 3);
}
}
"Block.enderChest.blockID" is the block you have to craft to get this achievement.
Notice how there's a "3" instead of "2" or "1". If it's 1, 2, or 4, it'll crash...
Anyone want me to add how to remove a recipe without editing a bass class? (for forge)
Considering the fact, do you know how to edit a mob without editing the bass class? Such as making it tameable, updating the AI and other things, becuase I've been trying to figure it out for hours on end and still nothing. Please help!!!!!
Considering the fact, do you know how to edit a mob without editing the bass class? Such as making it tameable, updating the AI and other things, becuase I've been trying to figure it out for hours on end and still nothing. Please help!!!!!
i don't know if that is possible...i mean, i've never even thought of that! Sounds like a challenge, but it seems like it could be done... i haven't seen anything about this, but if i do, i'll let you know!
Almost got the tree fixed! It keeps spawning in every biome where there's dirt, but i got a custom biome with that only tree, so i might do a biome for forge...i should have the modloader achievement one up sometime this week
Why modloader? You shouldnt teach people to use modloader, forge is all what is needed, modloader is not.
Well, some people don't feel like doing forge, because it's more confusing, or something... and modloader is a good thing to start off when your new to coding. I agree that all we need is forge, and forge is way better. There are probably other reasons why people still code with modloader, and they may eventually go to forge...
HOW DO YOU SETUP WITH MODLOADER 1.6.1, THIS IS CRAZY!!
there are errors still, but you go to %appdata%, go to .minecrat, copy the "versions" folder then go to ur mcp folder, then paste the "versions" fodler there. After that, install modloader into the jar. Then do "decompile.bat" that's what i did
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThis post is being discontinued. Click Here if you still want to learn about coding from MCE626. This is a full tutorial only on forge.
Hi, I'm MCE626 from YouTube. I make mods and I'm the owner of "MCE626's Server." Since I make mods, I felt like helping other people with their modding problems. Now, I didn't feel like making a whole tutorial, because it would be a lot of stuff to do, and it would be kinda hard to update, so I'm just doing some short tips and tricks. Now I'm assuming you have your main mod class and blocks and stuff, so there won't be too much of whole class files in this. There'll just be some little parts and stuff you can add to your mod. You don't need to give me credit if you use one of my tips coding parts, but you can give a special thanks to me in your mod if you want.
*If you have a problem, I encourage you to visit my Forum website, and post there, instead of on this post. Posting your errors and stuff kinda makes this a little messy, but you can if you want to. And i check that more than this post...*
Forge ModLoader 1.6
Coming soon! - Custom Tree
Colored Names of Items or Blocks
Under the "private static void languageRegisters() {}" Type this -
The "/u00A7" is the code that Minecraft reads for coloring names.
The "4" after the "/u00A7" is what color/format the text will be. In this case, "4" is dark red.
Colors/Formats
0 - Black
1 - Dark Blue
2 - Dark Green
3 - Dark Aqua/Cyan
4 - Dark Red
5 - Purple
6 - Gold/Dark Yellow
7 - Gray
8 - Dark Gray
9 - Blue
a - Green
b - Aqua/Cyan
c - Red
d - Light Purple/Pink
e - Yellow
f - White
Format Code -
k - "Magic"
l - Bold
m -
Strikethroughn - Underline
o - Italic
r - Reset
If you want some text to be a different color than the first text, but still want it on the same line, type this -
The "b" in this case is Cyan/Aqua. It's on the same line as the red "In-game name", just a different color.
If you don't want the tool tip to be colored, just take out the "\u00A74"
Extended Tool Tips for Items (With Colors too)
This is in the item's class file (Example: ItemSlimeEye.java)
@SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean i) { list.add("\u00A72Green!"); }The "\u00A72" is the code that Minecraft reads for coloring names.
The "2" after the "\u00A7" is what color/format the text will be. In this case, "2" is green.
If you don't want the tool tip to be colored, just take out the "\u00A72".
Colors/Formats
0 - Black
1 - Dark Blue
2 - Dark Green
3 - Dark Aqua/Cyan
4 - Dark Red
5 - Purple
6 - Gold/Dark Yellow
7 - Gray
8 - Dark Gray
9 - Blue
a - Green
b - Aqua/Cyan
c - Red
d - Light Purple/Pink
e - Yellow
f - White
Format Code -
k - "Magic"
l - Bold
m -
Strikethroughn - Underline
o - Italic
r - Reset
Multi-Textured Blocks
In the block class, type this -
@SideOnly(Side.CLIENT) private Icon field_94393_a; @SideOnly(Side.CLIENT) private Icon field_94392_b; public Icon getIcon(int par1, int par2) { return par1 == 0 ? this.field_94392_b : (par1 == 1 ? this.field_94393_a : this.blockIcon); } public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("mod_Mod Name:Block Side");//Side this.field_94393_a = par1IconRegister.registerIcon("mod_Mod Name:Block Top");//Top this.field_94392_b = par1IconRegister.registerIcon("mod_Mod Name:Block Bottom");//Bottom }This code would be good for logs, the top and the bottom would be the same, and all the sides would be the same.
Adding Custom Creative Tab
In the "public void preInit(FMLPreInitializationEvent event) {}" Type this -
public static CreativeTabs TabName = new CreativeTabs("Tab Name") { public ItemStack getIconItemStack() { return new ItemStack(Icon, 1, 0); } };TabName is obviously what the creative tab name will be called.
Icon is what the picture will be for your creative tab. You can use a block or item from your mod. If you are going to use a block or item from normal Minecraft, you have to do "Block.BlockName" or "Item.ItemName".
Then in the "private static void languageRegisters() {}" section, type this -
Again, the TabName is what the name of the tab will be called.
Making a Block do Multiple Drops
This is in the Block's class file
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) { if(!par1World.isRemote){ par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3, par4, new ItemStack(Item.flint, 1, 0))); } }Change the "1" in "New ItemStack(Item.flint, 1, 0)));") to make the block drop more than one flint.
Be sure to put the "!" in front of the "par1Word.isRemote)" otherwise the block will drop some item that you can't pick up. It's that glitchy can't pick this item up thing...
*If you put (Note the "new ItemStack(this.BlockID, 1, 0)));"
it will drop 2 of the block. So setting that one to a 2 will then drop 3 of the block. Setting it to 10, will drop 11 of the block, etc.
Remove a Recipe without Editing a "Bass Class"
This pretty much makes your mod able to load in the "mods" folder, if you need to remove a recipe.
Now this is to remove a vanilla recipe, and I'm sure it'll work with removing a recipe from a different mod.
This is the code that does the action. This doesn't go in the load method or anything in the main class. This is it's own method.
private static void RemoveRecipe(ItemStack resultItem) { ItemStack recipeResult = null; ArrayList recipes = (ArrayList) CraftingManager.getInstance() .getRecipeList(); for (int scan = 0; scan < recipes.size(); scan++) { IRecipe tmpRecipe = (IRecipe) recipes.get(scan); recipeResult = tmpRecipe.getRecipeOutput(); if (recipeResult != null) { if (recipeResult.itemID == resultItem.itemID && recipeResult.getItemDamage() == resultItem .getItemDamage()) { System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult); recipes.remove(scan); scan--; } } } }Then in the "preInt" method, put this -
The parts you change are -
"mod_YouMod"
"Item/Block.What you want to remove" (Example: Item.woodenpickaxe (or) Block.chest)
Here is one, removing the stick recipe.
Then put this code in your CommonProxy class
public void removeRecipe(ItemStack itemStack) { }Now, "mod_MoreBlocks" is my mod, so you'd have to change that.
If your wondering why my mod removes the stick recipe, it's because I wanted to have colored sticks. (Birch tick, pine stick, etc.) I also had to put in the normal stick recipe back though my mod, since to get a normal stick (in my mod) you can only use oak planks. (In vanilla, it's any planks)
You can put more than one, just add it under the other one you put!
Custom Slabs (Stackable, and Flammable)
So, you want to make a slab. Then here's the code! (Uses config code to make a config file!)
Then in the @PreInt (For config) -
BlockTUTSlabid = config.get("Block IDS", "TUT Slab ID", 514) .getInt(); BlockTUTDoubleSlabid = config.get("Block IDS", "TUT Double Slab ID", 515).getInt();Then in the load method -
BlockTUTDoubleSlab = (BlockHalfSlab) (new BlockTUTSlab( BlockTUTDoubleSlabid, true)).setHardness(1.6F) .setResistance(7.5F).setStepSound(Block.soundWoodFootstep) .setUnlocalizedName("TUTSlab"); BlockTUTSlab = (BlockHalfSlab) (new BlockTUTSlab( BlockTUTSlabid, false)).setHardness(1.6F) .setResistance(7.5F).setStepSound(Block.soundWoodFootstep) .setUnlocalizedName("TUTSlab") .setCreativeTab(this.CreativeTabOfYours);Then make a new class called "BlockTUTSlab" or what ever you named your slab
in that class, put this code in -
public static final String[] woodType = { "TUT" }; public BlockWillowSlab(int par1, boolean par2) { super(par1, par2, Material.wood); setBurnProperties(this.blockID, 5, 20); useNeighborBrightness[this.blockID] = true; } public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("mod_YouMod:TextureName"); } public int idDropped(int par1, Random par2Random, int par3) { return mod_YouMod.BlockTUTSlab.blockID; } public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { if (par1World.getBlockId(par2, par3 - 1, par4) == mod_YouMod.BlockTUTSlab.blockID) { par1World.setBlock(par2, par3, par4, 0); par1World.setBlock(par2, par3 - 1, par4, mod_YouMod.BlockTUTDoubleSlab.blockID); } if (par1World.getBlockId(par2, par3 + 1, par4) == mod_YouMod.BlockTUTSlab.blockID) { par1World.setBlock(par2, par3, par4, 0); par1World.setBlock(par2, par3 + 1, par4, mod_YouMod.BlockTUTDoubleSlab.blockID); } } protected ItemStack createStackedBlock(int par1) { return new ItemStack(mod_YouMod.BlockTUTSlab.blockID, 2, par1 & 7); } public String getFullSlabName(int par1) { if ((par1 < 0) || (par1 >= woodType.length)) { par1 = 0; } return super.getUnlocalizedName() + "." + woodType[par1]; } public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { if (par1 != mod_YouMod.BlockTUTDoubleSlab.blockID) { par3List.add(new ItemStack(par1, 1, 0)); } }Make sure this class "extends BlockHalfSlab"
and change the stuff in ur code to ur stuff
Then back in the main class, put this is -
Then -
You don't want the double slab to show up in the creative tab, so that's why we didn't even give it a name.
Then in the PostInit put this (This code i think helps the stacking) -
{ Item.itemsList[BlockTUTSlab.blockID] = (new ItemSlab( BlockTUTSlab.blockID - 256, (BlockHalfSlab) BlockTUTSlab, (BlockHalfSlab) BlockTUTDoubleSlab, false)); }And bam! You got a flammable, stackable slab! (Flammable if you made it for wood that is...)
If you don't want it to burn up remove this code in the slab's class file -
Config Generation
So for this, you have to create your blocks in the code a little differently, maybe you already have made them like this, but for blocks, you need to set them up as this (not in pre init or anything, just under the "modid" stuff) -
The "int" thing will be used in the config part.
You cannot set the "int" thing to the same name as the public static. You don't have to put "id" at the end, it can be something else, i just put "id" so i know it's the id, and what ever you set the "int" as, is going to be the id.
Now, the config goes in the "PreInit" method. You may or may not have it, but here's how to set that up -
@PreInit private void preInit(FMLPreInitializationEvent event) { }Now, with in the {} of the preinit, set up your config code like this -
Ok we got the block set up and config, now to add the code into the config.
Between the "config.load" and "config.save" put this for your block -
TestBlockid = config.get("Block IDs", "Test Block ID", 500).getInt();So, the "TestBlockid" was that "int" thing you put above it. That "int" statement is connected to the "public static Block TestBlock"
The "Block IDs" in the "config.get" is the overall name for what ever your making. I do, "Blocks" and "Items" and i did most recently for my mod "Tools". For me, i added 201 tools, and i didn't feel like adding them into the "Items" section for the config...
The "Test Block ID" will be the name it shows. It's for that specific block, and not an overall name. If you do copy and paste this to add another block, it is important to rename this, or it will overwrite the first block when trying to craft it.
"500" is the block's ID. Since this is a config, people can change the id of the block or item, if it's running into another mod.
".getInt()" you need. Not really sure what it does, but you need it.
Then to make the block and it properties, set it up like this (For 1.6.1, the constructors or what ever this is called also go in the "PreInit" below the "config.save"-
TestBlock = new TestBlock(TestBlocktid, Material.ground) .setUnlocalizedName("Test").setHardness(2F).setResistance(2F) .setLightValue(0).setStepSound(Block.soundStoneFootstep) .setCreativeTab(CreativeTabs.tabBlock);So, first off this goes in the PreInit statement for 1.6, under the "config.save()"
The "TestBlockid" is where the id used to go, if you didn't have a config. Now since the "TestBlockid" is in the config code and has an id of 500, the block's id will be 500, but people can change it if it's running into another mod.
To change the of of the block, in "hard code" just go to the config part and change "500" to what ever.
Items are relatively the same.
So the config goes (Under the block config part, or above it)-
TestItemd = config.get("Item IDs", "Test Item ID", 5000).getInt();Now this time, it's "Item IDs" and "5000".
So when building the item -
TestItem = new TestItem(TestItemid) .setUnlocalizedName("TestItem").setMaxStackSize(64) .setCreativeTab(CreativeTabs.tabMaterials);So it's "TestItemid" now, and this has a "setMaxStackSize"
If you want to make armor or tools or something else and "blocks" or "items" is to big of a topic, just in the config code part, change from "Item IDs" or "Block IDs" to "Tools" or "Armor" or what ever, and it will show up in a new list in the config file.
Now if you remove a item/block or change the id, and the game crashes or isn't loading something right, sometimes you have to go and delete the config in in mcp. (forge/mcp/jars/config)Don't worry, it'll make a new one once you play again in eclipse.
Now here's what the config will look like (Or somewhat to it, depending if you went straight from this, or change this to your own stuff) -
# Configuration file #################### # block ids #################### "block ids" { I:"Test Block ID"=500 } #################### # item ids #################### "item ids" { I:"Test Item ID"=5000 }Now, the config goes in order by the name, not id
So if you have a block named "Test Block" and "Lava Wood" the "Lava Wood" will come first since L is before T.
If you added another group, it will show as -
#################### # sword ids #################### "sword ids" { I:"What ever sword"=5001 }That's it!
Textures for Blocks and Items (Not Multitextured blocks)
In that, i made another folder called "textures" then "blocks" and "items"
The code for the block, goes in the block's class file (If it has one of it's own)
public void registerIcons(IconRegister reg) { this.blockIcon = reg.registerIcon("ModID:TextureName"); }If your block is like a fence, and uses the birch wood, and doesn't have it's own class, put this code in the main class -
So this is that block constructor thing in the main file. The "TestBlock = new BlockFence(id...blah blah"
The "SomeFence" is your block. "new BlockFence" is what class the block is going to use. "ID" is the ID number of your block. "planks_birch" will give this fence a birch colored block. To make that a pine or jungle, type "planks_jungle" or "planks_spruce"
You can do more than the woods, like stone or dirt. Just replace the "plank_" with "stone" or "dirt" or "bedrock" or what ever.
I haven't found out yet how to do the diamond block texture or iron or gold, etc. This includes the ore textures.
For torches, (And redstone ones) put this code after the "RedstoneGoldTorch = new ModTorch(id...)" but before the ";" -
.func_111022_d("ModID:TextureName")Now for items.
It's pretty much the same code as the block, but one thing has been changed from it. This goes in your block class file (If it has one)
public void registerIcons(IconRegister reg) { this.itemIcon = reg.registerIcon("ModID:ITextureName"); }Now for tools that don't have their own class. It uses the vanilla class
In that "Tool = new ToolPickaxe(id)" thing, put this before the ";" -
.func_111206_d("ModID:TextureName")That's it! That's all.
ModLoader 1.5.2
Custom Achievements (Still for 1.5.2)
Under the "public class Base extends BaseMod { }", put this code in -
The "achievementDirt" is the achievement name.
"Achievement(5000,
"achievementDirt", 0, 15, Block.dirt, null)"
"Achievement" is the vanilla minecraft class file for achievements. "5000" is the achievement ID. "achievementDirt" is setting the name, not the in game name. "0, 15" is where it will show up on the achievement page. "Block.dirt" is the achievement pictures or image on the icon in the achievement page. "null" is where a different achievement name goes, if it's based off of another one. Since this is a stand alone achievement, and does not require, or based off another achievement, we set it to "null"
".setIndependent()" is making it where it's on it's own, and you can get it at anytime. Kinda like the open inventory achievement.
".registerAchievement" registers the achievement
After that, put this code in the "public void load() { }" -
".addAchievementDesc" is adding the achievement description. The in game name and the text under it.
The first one ("Dirt") is the name.
The second one("Pick up some dirt...") is the description of the achievement.
Once that has been added, put this in. (This is it's own method, it does not go in the load method.) -
public void onItemPickup(EntityPlayer entityplayer, ItemStack itemstack) { if (itemstack.itemID == Block.dirt.blockID) { entityplayer.addStat(achievementDirt, 1); } }"onItemPickup" means it'll give you the achievement for picking up an item.
"Block.dirt.blockID" is what that item you pick up in order to get the achievement
"entityplayer.addStat(achievementDirt, 1)" is adding the achievement. The "achievementDirt" is what achievement it's adding and the "1" is pretty much saying it's the first one added from the mod...I'm not entirely sure what it does, but i know if you have more than one achievement, you can't go out of order, they have to be counting up....
Done!!
But wait! There's other ones too!
Like:
- Taking from crafting
- Setting "special"
Dependent on another achievement (Still item pickup)
So, again in the "Base extends BasMod{ }" thing, put this in! (Based off of achievement from above) -
"achievementSeed" is what it's called. "5001" is the ID. "0, 20" is where it'll be on the achievement page. "Iten.seeds" in the picture, and "achievementDirt" mean it's linked to that achievement.
Then, put this in your "load" method -
"achievementSeed" is the name, "Seeds" is the in game name, and "Pick up some seeds..." is the description of the achievement.
Then in that "public void onItemPickup" method, put -
if (itemstack.itemID == Item.seeds.itemID) { entityplayer.addStat(achievementSeed, 2); }"Item.seeds.itemID" is what the achievement uses for you to get the achievement.
"achievementSeed" is the name, and "2" is the 2nd one added....i think...
One more! This one is set to "Special!" (Has cool border around achievement) and taking from crafting
Again, put this in the "Base extends BaseMod { }" -
So i think you know by now that "5002" is the ID, the "achievementEnderChest" is the name, "0, 25" is where's it's located, "BlockenderChest" is the icon picture, "null" means it's not dependent on another achievement.
".setIndependent" means it's on its own.
".setSpecial" mean it has a cool border around the achievemnt. (Take a look at the last vanilla mc achievement, "The End" with the enderdragon egg. It has a wavy or spiky border.)
Then put this in the "load" method -
I think you know what the parameters are now.
Then for taking from crafting, put this in (under the "load" method) -
public void takenFromCrafting(EntityPlayer entityplayer, ItemStack itemstack, IInventory iinventory) { if (itemstack.itemID == Block.enderChest.blockID) { entityplayer.addStat(achievementEnderChest, 3); } }"Block.enderChest.blockID" is the block you have to craft to get this achievement.
Notice how there's a "3" instead of "2" or "1". If it's 1, 2, or 4, it'll crash...
That's all!
More Tips and Tricks to come!
Made by: MCE626
[represent]
Help modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
Find out how I generate....coolAlias...world structure generation and rotation tool...
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumthanks! i will add more, i gotta go back to modloader at some point...i might do that on the other computer...
Help modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI will, i'm still workin out the little bugs...
Help modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
Considering the fact, do you know how to edit a mob without editing the bass class? Such as making it tameable, updating the AI and other things, becuase I've been trying to figure it out for hours on end and still nothing. Please help!!!!!
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumi don't know if that is possible...i mean, i've never even thought of that! Sounds like a challenge, but it seems like it could be done... i haven't seen anything about this, but if i do, i'll let you know!
Help modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWell, some people don't feel like doing forge, because it's more confusing, or something... and modloader is a good thing to start off when your new to coding. I agree that all we need is forge, and forge is way better. There are probably other reasons why people still code with modloader, and they may eventually go to forge...
Help modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumedit: i will get the tree and the achievement added very soon!
Help modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHelp modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumthere are errors still, but you go to %appdata%, go to .minecrat, copy the "versions" folder then go to ur mcp folder, then paste the "versions" fodler there. After that, install modloader into the jar. Then do "decompile.bat" that's what i did
Help modders out by contributing to the Forge Ore Dictionary List! http://mce626.wix.com/odnlist