WELCOME TO GABE4356'S MODDING TUTORIALS! _________________________________________
Here i will be teaching you how to mod minecraft! this post will frequently be updated, adding more tutorials, more bug fixes, and being updated!
SETTING UP YOUR WORKSPACE
Video tutorial can be found here
First you must download eclipse from here
download MCP from here
and download modloader from here
now extract all of those folders
install modloader but DO delete MEDE-INF!!!!
drag all the .minecraft files into jars in MCP [the one with modloader installed]
drag server jar 1.5.2 into jars folder in MCP
launch decompile.bat in in MCP
open up eclipse
click File>Switch workspace>and chose eclipse in MCP
Eclipse will now restart, this is fine
your done!
To make a block first click on client>src>net.minecraft.src click File new class, name it mod_<your mod name> and copy and paste this code:
package net.minecraft.src;
public class mod_test extends BaseMod {
public static final Block test = new Block(161, Material.ground).setUnlocalizedName("testblock.png").setHardness(5).setCreativeTab(CreativeTabs.tabBlock);
public String getVersion()
{
return "1.5.2";
}
public void load()
{
ModLoader.registerBlock(test);
ModLoader.addName(test, "Test Block");
}
}
[spoiler]
[spoiler] BASIC ITEMS
put this code in your load method in your mod class:
ModLoader.addName(itest, "Item Test");
put this towards to the top of the mod class, near the other "public static final's"
public static final Item itest = new Item(5004).setCreativeTab(CreativeTabs.tabMaterials).setUnlocalizedName("itest.png");
[spoiler]
[spoiler] BIOMES
put this in towards the top of your mod_class
BiomeGenTest Test = new BiomeGenTest(23);
put this in your load method
ModLoader.addBiome(Test);
create a new class called BiomeGen<YourBiomeName> and paste this code
package net.minecraft.src;
public class BiomeGenTest extends BiomeGenBase {
protected BiomeGenTest(int par1)
{
super (par1);
this.theBiomeDecorator.treesPerChunk = -999;
this.theBiomeDecorator.flowersPerChunk = 4;
this.theBiomeDecorator.grassPerChunk = 1;
this.fillerBlock=(byte)Block.blockGold.blockID;
this.topBlock=(byte)Block.blockDiamond.blockID;
this.biomeName="Test Biome";
}
}
[spoiler]
[spoiler] BLOCK THAT GIVES OFF LIGHT
all you have to do is add this line of code to the public static final part of your block
.setLightValue(50)
[spoiler]
[spoiler] GRENADE
add this line of code to your mod_class
public static final Item grenade = new ItemGrenade(1037).setUnlocalizedName("grenade").setCreativeTab(CreativeTabs.tabCombat);
paste this in your load method
ModLoader.addName(grenade, "Grenade");
create a new class called ItemGrenade and paste this code
package net.minecraft.src;
public class ItemGrenade extends Item{
public ItemGrenade(int par1){
super(par1);
this.maxStackSize = 64; //maximum size in a stack
this.setUnlocalizedName("grenade"); //icon
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer){
if (!entityplayer.capabilities.isCreativeMode){
--itemstack.stackSize; //removes one when right clicked if not in creative
}
if (!world.isRemote){
world.spawnEntityInWorld(new EntityGrenade(world, entityplayer)); //spawns the grenade entity
}
return itemstack;
}
}
create a new class named EntityGrenade and paste this code
package net.minecraft.src;
public class EntityGrenade extends EntityThrowable{
public EntityGrenade(World par1World){
super(par1World);
}
public EntityGrenade(World par1World, EntityLiving par2EntityLiving){
super(par1World, par2EntityLiving);
}
public EntityGrenade(World par1World, double par2, double par4, double par6){
super(par1World, par2, par4, par6);
}
protected void onImpact(MovingObjectPosition par1MovingObjectPosition){
if (par1MovingObjectPosition.entityHit != null){
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
}
if (!this.worldObj.isRemote){
explode(); //explodes the grenade
}
if (!this.worldObj.isRemote){
this.setDead();
}
}
private void explode(){
if(!exploded){
exploded = true;
worldObj.createExplosion(this, posX, posY, posZ, 4.0F, true); //spawns explosion
}
}
boolean exploded;
}
[spoiler]
[spoiler] ORE GENERATION
so this is very simple, just paste this into your load method
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
Random randomGenerator = random;
int rarity = 30; //set the rarity of the ore
for (int i = 0; i < 10; i++)
{
int randPosX = chunkX + randomGenerator.nextInt(20);
int randPosY = random.nextInt(40);
int randPosZ = chunkZ + randomGenerator.nextInt(20);
(new WorldGenMinable(mod_test.oreTest.blockID, 8)).generate(world, random, randPosX, randPosY, randPosZ); //replace mod_<your mod name> and .<your block> instead of mod_test. and .oreTest
}
}
if you want to use your own block or item for crafting or any other purpose then you just do mod_<your mod name>.<your item/block name> instead of Block/Item.<item/Block name> for example:
mod_MoreBimesMod.computerchip});
[spoiler]
[spoiler]
HOW TO MAKE SMELTING RECIPIES
just replace the item names, with whatever you the name of your item or anything is.
ModLoader.addSmelting(Item.redstone.itemID, new ItemStack (Block.blockGold, 1), 1.0F);
[spoiler]
[spoiler]
FOOD
just replace it with the correct names
this goes up in the public static final area
public static final Item testFood = new ItemFood(5000,4,true).setUnlocalizedName("testFood").setCreativeTab(CreativeTabs.tabFood);
the unlocalized Name is the texture name, in "(5000,4,true)" the 4 means the amount of hearts it heals, in half hearts, so 20 would be the entire hunger bar as 0 is none.
put this in your load method
ModLoader.addName(testFood,"Test Thing");
sets the name of the item
[spoiler]
I am taking requests, so just comment on what i should add next, or vote on the poll!
_________________________________________
Here i will be teaching you how to mod minecraft! this post will frequently be updated, adding more tutorials, more bug fixes, and being updated!
SETTING UP YOUR WORKSPACE
Video tutorial can be found here
First you must download eclipse from here
download MCP from here
and download modloader from here
now extract all of those folders
install modloader but DO delete MEDE-INF!!!!
drag all the .minecraft files into jars in MCP [the one with modloader installed]
drag server jar 1.5.2 into jars folder in MCP
launch decompile.bat in in MCP
open up eclipse
click File>Switch workspace>and chose eclipse in MCP
Eclipse will now restart, this is fine
your done!
Modloader:
[spoiler]
code:
[spoler]
[spoiler]
BLOCKS
To make a block first click on client>src>net.minecraft.src
click File new class, name it mod_<your mod name>
and copy and paste this code:
package net.minecraft.src; public class mod_test extends BaseMod { public static final Block test = new Block(161, Material.ground).setUnlocalizedName("testblock.png").setHardness(5).setCreativeTab(CreativeTabs.tabBlock); public String getVersion() { return "1.5.2"; } public void load() { ModLoader.registerBlock(test); ModLoader.addName(test, "Test Block"); } }[spoiler]
[spoiler]
BASIC ITEMS
put this code in your load method in your mod class:
put this towards to the top of the mod class, near the other "public static final's"
public static final Item itest = new Item(5004).setCreativeTab(CreativeTabs.tabMaterials).setUnlocalizedName("itest.png");[spoiler]
[spoiler]
BIOMES
put this in towards the top of your mod_class
put this in your load method
create a new class called BiomeGen<YourBiomeName> and paste this code
package net.minecraft.src; public class BiomeGenTest extends BiomeGenBase { protected BiomeGenTest(int par1) { super (par1); this.theBiomeDecorator.treesPerChunk = -999; this.theBiomeDecorator.flowersPerChunk = 4; this.theBiomeDecorator.grassPerChunk = 1; this.fillerBlock=(byte)Block.blockGold.blockID; this.topBlock=(byte)Block.blockDiamond.blockID; this.biomeName="Test Biome"; } }[spoiler]
[spoiler]
BLOCK THAT GIVES OFF LIGHT
all you have to do is add this line of code to the public static final part of your block
[spoiler]
[spoiler]
GRENADE
add this line of code to your mod_class
public static final Item grenade = new ItemGrenade(1037).setUnlocalizedName("grenade").setCreativeTab(CreativeTabs.tabCombat);paste this in your load method
create a new class called ItemGrenade and paste this code
package net.minecraft.src; public class ItemGrenade extends Item{ public ItemGrenade(int par1){ super(par1); this.maxStackSize = 64; //maximum size in a stack this.setUnlocalizedName("grenade"); //icon } public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer){ if (!entityplayer.capabilities.isCreativeMode){ --itemstack.stackSize; //removes one when right clicked if not in creative } if (!world.isRemote){ world.spawnEntityInWorld(new EntityGrenade(world, entityplayer)); //spawns the grenade entity } return itemstack; } }create a new class named EntityGrenade and paste this code
package net.minecraft.src; public class EntityGrenade extends EntityThrowable{ public EntityGrenade(World par1World){ super(par1World); } public EntityGrenade(World par1World, EntityLiving par2EntityLiving){ super(par1World, par2EntityLiving); } public EntityGrenade(World par1World, double par2, double par4, double par6){ super(par1World, par2, par4, par6); } protected void onImpact(MovingObjectPosition par1MovingObjectPosition){ if (par1MovingObjectPosition.entityHit != null){ par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0); } if (!this.worldObj.isRemote){ explode(); //explodes the grenade } if (!this.worldObj.isRemote){ this.setDead(); } } private void explode(){ if(!exploded){ exploded = true; worldObj.createExplosion(this, posX, posY, posZ, 4.0F, true); //spawns explosion } } boolean exploded; }[spoiler]
[spoiler]
ORE GENERATION
so this is very simple, just paste this into your load method
public void generateSurface(World world, Random random, int chunkX, int chunkZ) { Random randomGenerator = random; int rarity = 30; //set the rarity of the ore for (int i = 0; i < 10; i++) { int randPosX = chunkX + randomGenerator.nextInt(20); int randPosY = random.nextInt(40); int randPosZ = chunkZ + randomGenerator.nextInt(20); (new WorldGenMinable(mod_test.oreTest.blockID, 8)).generate(world, random, randPosX, randPosY, randPosZ); //replace mod_<your mod name> and .<your block> instead of mod_test. and .oreTest } }hover over Random and click import
Your ore will now generate!!!
[spoiler]
[spoiler]
HOW TO MAKE CRAFTING RECIPIES
just replace the blocks to the blocks you want
ModLoader.addRecipe(new ItemStack(Block.oreDiamond, 1), new Object [] {"###", "#%#", "#*#", Character.valueOf('#'), Item.redstone, Character.valueOf('%'), Block.Test, Character.valueOf('*'),Block.blockRedstone});if you want to use your own block or item for crafting or any other purpose then you just do mod_<your mod name>.<your item/block name> instead of Block/Item.<item/Block name> for example:
[spoiler]
[spoiler]
HOW TO MAKE SMELTING RECIPIES
just replace the item names, with whatever you the name of your item or anything is.
[spoiler]
[spoiler]
FOOD
just replace it with the correct names
this goes up in the public static final area
public static final Item testFood = new ItemFood(5000,4,true).setUnlocalizedName("testFood").setCreativeTab(CreativeTabs.tabFood);the unlocalized Name is the texture name, in "(5000,4,true)" the 4 means the amount of hearts it heals, in half hearts, so 20 would be the entire hunger bar as 0 is none.
put this in your load method
sets the name of the item
[spoiler]
I am taking requests, so just comment on what i should add next, or vote on the poll!
MORE COMMING SOON!!!!! [really soon]