Minecraft / Blogs

How To Make A Minecraft Mod (no.2 [adding a new block with a custom texture])

  • 8
  • 4
  • comment11
  • playlist_add
  • share
  • more_horiz
avatar fox_news
Level 59 : Grandmaster Programmer
205
How To Make A Minecraft Mod

(no.2 [Adding a new block with custom texture])

THIS IS NOT THE SUPPORT PAGE! DO NOT COMMENT HERE IF YOU HAVE ANY QUESTIONS OR YOU NEED HELP!

SUPPORT PAGE

requirements:
completed tutorial no.1
Paint.net

today i will show you how to make a new block in mincraft. you can make the block texture how ever you want it. for me i will be using my face:

when you make your block texture, make sure it is 16x16!

ok lets start!

TUTORIAL:

1.open eclipse and make sure that your work space is in your MCP folder and is selected on the eclipse folder in the MCP folder
2.create a new class called mod_MyNewBlock
3.fix your class so it looks like mine:

package net.minecraft.src;

public abstract class mod_MyNewBlock extends BaseMod
{
public mod_MyNewBlock()
{
}
public void load()
{
}
public String getVersion()
{
return "Fox_news mod Tutorial no.2";
}
static
{

}

}

4.ok now we are going to tell ModLoader to add a new block:
add this above public mod_MyNewBlock()

public static final Block newBlock;

5.in the public void load() add this

ModLoader.addName(newBlock, "Tutorial Block by fox_news");
ModLoader.registerBlock(newBlock);
newblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/foxface.png");
ModLoader.addRecipe(new ItemStack(newBlock, 4), new Object[]
{
"XXX", "XFX", "XXX", 'X', Item.ingotIron, 'F', Item.painting
});

*NOTE*: where you see "/foxface.png" , if you made a different texture with a different name make sure you change "/foxface.png" to "/what ever you named your texture.png"

5:2. in the static add this

newblock = (new BlockNew(175, Material.ground)).setBlockName("newblock").setStepSound(Block.soundMetalFootstep);

6.save the class and create another class called BlockNew

7.fix your class so it looks like mine:

package net.minecraft.src;

import java.util.ArrayList;

public class BlockNew extends Block
{
public BlockNew(int i, Material material)
{
super(i, material);
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
setLightOpacity(5);
}
public boolean renderAsNormalBlock()
{
return true;
}
public boolean isOpaqueCube()
{
return true;
}
}

8.save both files and go back to your MCP folder
9.open the jar folder
10.click on bin
11.right click on minecraft.jar
12.click open archive
13.if you didn't already, make a block texture or you can use the one above
14.drag the block texture called foxface.png (or what ever you called your texture) into the minecraft.jar
15.go back to your MCP folder and run recompile.bat
if you get any errors then you did somthing wrong, go back and check if everything is spelled right
16. run startclient.bat and use the crafting recipe to get your new block
17. go back to the MCP folder and go to the conf folder
18. open cleint.txt
19. press CTRL + A and delete everything there
20. save cleint.txt
21. go back to the MCP folder and run reobfuscate.bat
22. once that finishes go back to your MCP folder and open the reobf folder
23. open the minecraft folder
24. now what you see is your new mod ready for distrebution! on your desktop create a zip folder (name it what ever you want)
25. take those class files from the minecraft folder, drag and drop them into that zip folder you just made
26. you can now add them to your minecraft client or upload them to a website
27. CONGRATS! you just finished the new block tutorial!
Tags

11 replies

1
11/18/2012 2:03 am
Level 18 : Journeyman Warrior
logansepicgaming
So say I want to make a block named "Refined Obsidian"
Do I replace all of the "myNewBlock"s with "Refined Obsidian", or just "Tutorial Block by Fox_news"
sorry, i am not good at all with mods
1
12/02/2012 5:49 am
Level 23 : Expert Dragonborn
NewSuperMario
Emhh.... I think that you should replace all with "Refined Obsidian" . Not "Tutorial Block by Fox_news" because then your block will be named "Turorial Block by Fox_news" , right?

(I'm not 100% sure, but I'm like 75% sure it would work...)
1
10/09/2012 8:37 pm
Level 1 : New Miner
creat0r
i did everything you did but when i start client it says unable to load mod, and then minecraft crashes. what do i need to do?
1
10/10/2012 5:41 pm
Level 59 : Grandmaster Programmer
fox_news
give me error report
1
05/24/2012 3:43 pm
Level 59 : Grandmaster Programmer
fox_news
X = iron ingot F= painting
XXX
XFX
XXX
1
05/24/2012 10:17 am
Level 1 : New Miner
jelminecrafter
i took your recepi you used in this tutbut wath is the recepi?:D
1
05/17/2012 4:29 pm
Level 1 : New Miner
Clutch Llama
I get an error on "public static final Block newBlock" saying "The blank final field newBlock may not have been initialized". Did i do something wrong?
1
05/18/2012 4:58 pm
Level 59 : Grandmaster Programmer
fox_news
it depends on your code. please post your code on the support page so i can look at it
1
05/18/2012 9:10 pm
Level 1 : New Miner
Clutch Llama
I managed to figure it out but thank you anyways :)
1
12/06/2012 5:52 pm
Level 32 : Artisan Nerd
virhonestum
How did u fixed it?
1
05/18/2012 10:23 pm
Level 59 : Grandmaster Programmer
fox_news
good job

Planet Minecraft

Browse

Site

© 2010 - 2019
planetminecraft.com

Welcome