on what tutorials to do next I will provide my source through a download link
I will try to do as many tutorials as fast as possible so please be patient!
that can be found below!!
Okay lets get started!
Ranks:
= Easy
=Medium
=Hard
TUTORIALS:
Block
Item
Ore Generation
Recipes
Smelting Recipes
How to add Meta Data To Crafting Recipes
How to make a block drop itemDamage blocks/items
Advanced block
Adding blocks to creative inventory enum
Enum Tool material + Tools
New Liquid
Modding Tips & Tricks
Shape Less Recipes
TUTORIALS COMING SOON:
Block Manipulation
New Bow
New Projectiles
Multi-Textured Block
Redstone Powered Block
Advanced Item
Structure Generate
Enum Armour
Block Methods
Food
Human Mob
Custom Mob
Entity Block
Advanced Item
Spawning Blocks With Items
Spawning Entitys With Items
Crops
Trees
Generation
Reeds
Flowers
Throwable Item
Explosive Block
Explosive Item
Custom Furnace
Techne Modeling
Liquid Color
Lets Get Started!
BLOCK
BlockNameHere:
package net.minecraft.src;
public class BlockNameHere extends Block
{
protected BlockNameHere(int par1, int par2)
{
super(par1, par2, Material.ground);
}
}
mod_NameHere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Block Namehere = new BlockNamehere(BLOCKID, 0).setHardness(1.0F).setResistance(6000.0F).setLightValue(1.0F).setBlockName("Namehere");
public mod_Namehere()
{
ModLoader.registerBlock(Namehere);
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Namehere.png");
ModLoader.addName(Namehere, "Nameingamehere");
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object[]{ "###", "###", "###", Character.valueOf('#'), Item.redstone});
}
public String Version()
{
return "1.2.5";
}
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
Under Standing The Code
Block:
-Where it says Namehere replace with your block name
super(par1, par2, Material.ground);
Where it says Material.ground, you can change that to any material, eg Material.Iron can only be broken with an iron pick
Mod_:
-Where it says "Namehere" replace with your block name
-Where it says "mod_Namehere" replace with your mod_ name(EG: mod_Bench)
-Where it says "BlOCKID" replace with the block id (160+)
.setHardness(1.0F) is how hard the block is to break, or how long it takes to break
.setResistance(6000.0F) is how resistant it is to tnt.
.setLightValue(1.0F) is how much light it emits, if you dont want any remove that line of code, DO NOT PUT THE LIGHT VALUE HIGHER THAN 2! it will crash your MC
.setBlockName("Namehere") can be anything, this is just what it is called when defining, doesnt matter what the name is here.
ModLoader.registerBlock(Namehere); this registers the block
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Namehere.png"); This adds an over ride texture, the texture has to be 16x16 if you want to put the textures in a folder you do "/Namehere/Namhere.png" instead.
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object[]{ "###", "###", "###", Character.valueOf('#'), Item.redstone});
This adds a new recipe in game.
"(Namehere, 1)" Namehere is what block/item you want to craft, If its an block/item that is already in-game than it would beItem.diamond(EG) and Block.dirt(EG), if its an new block/item in your mod_ file it would just be the name, Bench(EG)
"###", "###", "###" is where you define the crafting recipe, it goes from top to bottom so
"###",
"###",
"###",
Character.valueOf('#'), Item.redstone This is where you define what is it being crafted out of.
If you wanted it to be crafted out of two or more things your code will be like this:
you can use any number or symbol to define the crafting, doesnt have to be "#" or "X"
ITEM
package net.minecraft.src;
import java.util.Random;
public class ItemNamehere extends Item
{
public ItemNamehere (int i)
{
super(i);
maxStackSize = 64;
}
}
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static final Item Namehere = new Item(30000).setItemName("Namehere");
public mod_Namehere()
{
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehere.png");
ModLoader.addName(Namehere, "Namehere");
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object[] {
"XPX", "PSP", "XPX", Character.valueOf('P'), Item.porkCooked, Character.valueOf('X'), Item.redstone, Character.valueOf('S'), Item.swordStone
});
}
public String Version()
{
return "1.2.5";
}
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
Under Standing The Code
Item:
-Where it says "Namhere" Replace with the name of your item
-Where it says "maxStackSize = 64;" change 64 to the stack size you want(no higher than 64)
Mod_:
-Where it says "mod_Namehere" replace "Namehere" with your mod_ file name
-Where it says "Namhere" Replace with the name of your item
ORE/BLOCK GENERATION
**IMPORTANT**
PUT THIS CODE INTO YOUR MOD_ FILE!
ALSO ADD THIS LINE OF CODE UNDER "package net.minecraft.src;"
import java.util.Random;
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for (int i=0; i < 20; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(64);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(Namehere.blockID, 20)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
Under Standing The Code
-Where it says "Namehere" replace with your block name
-If you want it to be an item repalce "blockID" with "shiftedIndex"
(int i=0; i < 20; i++) this "20" here represents how rare your ore/block is. DONT THE OTHER 16S
int randPosY = rand.nextInt(64); This "64" represents how high your ore/block will spawn, diamond is 16. If you set it to 256 it will not spawn ontop of the surface!
(new WorldGenMinable(Namehere.blockID, 20)) the "20" is how big the max vein size can be
Finished Code:
package net.minecraft.src;
import java.util.Random;
public class mod_Namehere extends BaseMod
{
public static Block Namehere = new BlockNamehere
(BLOCKID, 0).setHardness(1.0F).setResistance
(6000.0F).setLightValue(1.0F).setBlockName("Namehere");
public mod_Namehere()
{
ModLoader.registerBlock(Namehere);
Namehere.blockIndexInTexture =
ModLoader.addOverride("/terrain.png", "/Namehere.png");
ModLoader.addName(Namehere, "Nameingamehere");
ModLoader.addRecipe(new ItemStack(Namehere, 1),
new Object[]{ "###", "###", "###", Character.valueOf('#'),
Item.redstone});
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for (int i=0; i < 16; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(256);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(CrystalBlock.blockID, 20)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
public String Version()
{
return "1.2.5";
}
@Override
public String getVersion() {
// TODO Auto-generated method stub
return null;
}
@Override
public void load() {
// TODO Auto-generated method stub
}
}
RECIPES
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object[]{ "###", "###", "###", Character.valueOf('#'), Item.redstone});
Under Standing The Code
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object[]{ "###", "###", "###", Character.valueOf('#'), Item.redstone});
This adds a new recipe in game.
"(Namehere, 1)" Namehere is what block/item you want to craft, If its an block/item that is already in-game than it would beItem.diamond(EG) and Block.dirt(EG), if its an new block/item in your mod_ file it would just be the name, Bench(EG)
"###", "###", "###" is where you define the crafting recipe, it goes from top to bottom so
"###",
"###",
"###",
Character.valueOf('#'), Item.redstone This is where you define what is it being crafted out of.
If you wanted it to be crafted out of two or more things your code will be like this:
you can use any number or symbol to define the crafting, doesnt have to be "#" or "X"
SMELTING RECIPES
ModLoader.addSmelting(mod_Namehere.Namehere.shiftedIndex, new ItemStack(mod_Namehere.Namehere2, 1));
For a block:
ModLoader.addSmelting(mod_Namehere.Namehere.blockID, new ItemStack(mod_Namehere.Namehere2, 1));
Under Standing The Code
Change "Namehere" to your block/item name
"mod_Namehere.Namehere.shiftedIndex" item you want smelted
"mod_Namehere.Namehere" item you want to come out when smelted
"1" how many will come out when smelted
META DATA IN RECIPES
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object[] { "###", "X#X", "XXX", Character.valueOf('#'), (new ItemStack(Item.dyePowder, 4, 4)), Character.valueOf('X'), Item.coal });
Under Standing The Code
Change "Namehere" to your block/item name
I used "Item.dyePowder, 4, 4" as an example, this is lapis. you can do this with planks and other meta data blocks/items. If its a block change Item.dyePowder to Block.planks(EG)
if you want to create a meta data block/item instead of using it in a recipe than replace
(Item.dyePowder, 1, 4)
the "1", is how many is crafted like a normal recipe and the "4" behind it is the meta data integer. For a list of the meta data integers go to google and search "Minecraft Data Values"
HOW TO MAKE A BLOCK DROP ITEMDAMAGE ITEMS/BLOCKS
To make a block drop a itemDamge item/block is fairly simple!
Lets say you want your block to drop lapis when it breaks, than you would add this.
public int idDropped(int par1, Random par2Random, int par3)
{
return Item.dyePowder.shiftedIndex;
}
but that will only drop dyePowder which by default is an inc sac.
So than you would have to add this piece of code!
Under Standing The Code
Rename "mod_Namhere" with your mod_ file name
Rename Namehere.blockID to your block name(eg - mod_Tutorial.CoolBlock.blockID)
Okay now for the real code!
0 : 4;
this piece of code tells the game what piece of itemDamage to drop.
To find a full list of data values go to (http://www.minecraft...iki/Data_values)
Now scroll down to the "Dyes" section and you will find all the dyes
Now if you wanted to make your block drop bonemeal you would change
0 : 4;
to
0 : 15;
basically don't touch the "0" and replace the "4" to the itemdamge #
ADVANCED BLOCK
Booster Block
public BlockNamehere(int i, int j)
{
super(i, j, Material.ground);
slipperiness = 1.5F;
}
Under Standing The Code
Change 1.5F in
slipperiness = 1.5F;
to how fast you want to go!
So
slipperiness = 5.5F;
will just launch you
Bounce Block
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 2.0;
}
Under Standing The Code
Spawn Entity On Broken
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5)
{
if (!par1World.isRemote)
{
EntitySilverfish entitysilverfish = new EntitySilverfish(par1World);
entitysilverfish.setLocationAndAngles((double)par2 + 0.5D, par3, (double)par4 + 0.5D, 0.0F, 0.0F);
par1World.spawnEntityInWorld(entitysilverfish);
entitysilverfish.spawnExplosionParticle();
}
super.onBlockDestroyedByPlayer(par1World, par2, par3, par4, par5);
}
Under Standing The Code
Change
EntitySilverFish
to what ever entity you want, look at all the entity classes.
public class mod_CarbonOre extends BaseMod
{
public static final Item shovelCarbon = (new CarbonItemSpade(128, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonspade.png")).setItemName("shovelCarbon");
public static final Item pickaxeCarbon = (new CarbonItemPickaxe(129, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonpickaxe.png")).setItemName("pickaxeCarbon");
public static final Item axeCarbon = (new CarbonItemAxe(130, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonaxe.png")).setItemName("hatchetCarbon");
public static final Item swordCarbon = (new CarbonItemSword(131, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonsword.png")).setItemName("swordCarbon");
public static final Item hoeCarbon = (new CarbonItemHoe(132, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonhoe.png")).setItemName("hoeCarbon");
package net.minecraft.src;
import java.util.Random;
public class mod_CarbonOre extends BaseMod
{
public static final Item shovelCarbon = (new CarbonItemSpade(128, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonspade.png")).setItemName("shovelCarbon");
public static final Item pickaxeCarbon = (new CarbonItemPickaxe(129, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonpickaxe.png")).setItemName("pickaxeCarbon");
public static final Item axeCarbon = (new CarbonItemAxe(130, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonaxe.png")).setItemName("hatchetCarbon");
public static final Item swordCarbon = (new CarbonItemSword(131, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonsword.png")).setItemName("swordCarbon");
public static final Item hoeCarbon = (new CarbonItemHoe(132, CarbonOreEnumToolMaterial.CARBON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CarbonDeposit/Carbonhoe.png")).setItemName("hoeCarbon");
public void load()
{
ModLoader.addName(shovelCarbon, "Carbon Shovel");
ModLoader.addName(pickaxeCarbon, "Carbon Pickaxe");
ModLoader.addName(axeCarbon, "Carbon Axe");
ModLoader.addName(swordCarbon, "Carbon Sword");
ModLoader.addName(hoeCarbon, "Carbon Hoe");
ModLoader.addRecipe(new ItemStack(pickaxeCarbon), new Object[] {"XXX", " # ", " # ", Character.valueOf('X'), CarbonIngot, Character.valueOf('#'), Item.stick});
ModLoader.addRecipe(new ItemStack(shovelCarbon), new Object[] {"X", "#", "#", Character.valueOf('X'), CarbonIngot, Character.valueOf('#'), Item.stick});
ModLoader.addRecipe(new ItemStack(axeCarbon), new Object[] {"XX", "X#", " #", Character.valueOf('X'), CarbonIngot, Character.valueOf('#'), Item.stick});
ModLoader.addRecipe(new ItemStack(hoeCarbon), new Object[] {"XX", " #", " #", Character.valueOf('X'), CarbonIngot, Character.valueOf('#'), Item.stick});
ModLoader.addRecipe(new ItemStack(swordCarbon), new Object[] {"X", "X", "#", Character.valueOf('X'), CarbonIngot, Character.valueOf('#'), Item.stick});
public String getVersion()
{
return "1.2.5";
}
}
CarbonItemTool
package net.minecraft.src;
import java.util.Arrays;
public class CarbonItemTool extends Item
{
private Block blocksEffectiveAgainst[];
public float efficiencyOnProperMaterial;
public int damageVsEntity;
protected CarbonOreEnumToolMaterial toolMaterial;
protected CarbonItemTool(int i, int j, CarbonOreEnumToolMaterial enumtoolmaterial, Block ablock[])
{
super(i);
efficiencyOnProperMaterial = 4F;
toolMaterial = enumtoolmaterial;
blocksEffectiveAgainst = ablock;
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
efficiencyOnProperMaterial = enumtoolmaterial.getEfficiencyOnProperMaterial();
damageVsEntity = j + enumtoolmaterial.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack itemstack, Block block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
return true;
}
public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
{
itemstack.damageItem(1, entityliving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
[
CarbonOreEnumToolMaterial
package net.minecraft.src;
public enum CarbonOreEnumToolMaterial
{
CARBON("CARBON", 5, 2, 2000, 7F, 3, 9);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private static final CarbonOreEnumToolMaterial allToolMaterials[];
private CarbonOreEnumToolMaterial(String s, int i, int j, int k, float f, int l, int i1)
{
harvestLevel = j;
maxUses = k;
efficiencyOnProperMaterial = f;
damageVsEntity = l;
enchantability = i1;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
static
{
allToolMaterials = (new CarbonOreEnumToolMaterial[] {
CARBON
});
}
}
Under Standing The Code
Rename "CARBON" to your ores tool name(COPPER, TIN, etc)
now for the actual items.
CarbonItemSword
package net.minecraft.src;
public class CarbonItemSword extends Item
{
private int weaponDamage;
private final CarbonOreEnumToolMaterial toolMaterial;
public CarbonItemSword(int par1, CarbonOreEnumToolMaterial enumToolMaterial)
{
super(par1);
toolMaterial = enumToolMaterial;
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
weaponDamage = 4 + enumToolMaterial.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 0x11940;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
CarbonItemPickaxe
package net.minecraft.src;
public class CarbonItemPickaxe extends CarbonItemTool
{
private static Block blocksEffectiveAgainst[];
protected CarbonItemPickaxe(int par1, CarbonOreEnumToolMaterial enumToolMaterial)
{
super(par1, 2, enumToolMaterial, blocksEffectiveAgainst);
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
if (par1Block == Block.obsidian)
{
return toolMaterial.getHarvestLevel() == 3;
}
if (par1Block == Block.blockDiamond || par1Block == Block.oreDiamond)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block == Block.blockGold || par1Block == Block.oreGold)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block == Block.blockSteel || par1Block == Block.oreIron)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if (par1Block == Block.blockLapis || par1Block == Block.oreLapis)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if (par1Block == Block.oreRedstone || par1Block == Block.oreRedstoneGlowing)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block.blockMaterial == Material.rock)
{
return true;
}
return par1Block.blockMaterial == Material.iron;
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
if (par2Block != null && (par2Block.blockMaterial == Material.iron || par2Block.blockMaterial == Material.rock))
{
return efficiencyOnProperMaterial;
}
else
{
return super.getStrVsBlock(par1ItemStack, par2Block);
}
}
static
{
blocksEffectiveAgainst = (new Block[]
{
Block.cobblestone, Block.stairDouble, Block.stairSingle, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockSteel, Block.oreCoal, Block.blockGold,
Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail,
Block.railDetector, Block.railPowered
});
}
}
package net.minecraft.src;
public class CarbonItemHoe extends Item
{
public CarbonItemHoe(int par1, CarbonOreEnumToolMaterial enumToolMaterial)
{
super(par1);
maxStackSize = 1;
setMaxDamage(enumToolMaterial.getMaxUses());
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS !
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
int j = par3World.getBlockId(par4, par5 + 1, par6);
if (par7 != 0 && j == 0 && i == Block.grass.blockID || i == Block.dirt.blockID)
{
Block block = Block.tilledField;
par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (par3World.isRemote)
{
return true;
}
else
{
par3World.setBlockWithNotify(par4, par5, par6, block.blockID);
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
else
{
return false;
}
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
}
CarbonItemSpade
package net.minecraft.src;
public class CarbonItemSpade extends CarbonItemTool
{
private static Block blocksEffectiveAgainst[];
public CarbonItemSpade(int par1, CarbonOreEnumToolMaterial enumToolMaterial)
{
super(par1, 1, enumToolMaterial, blocksEffectiveAgainst);
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
if (par1Block == Block.snow)
{
return true;
}
return par1Block == Block.blockSnow;
}
static
{
blocksEffectiveAgainst = (new Block[]
{
Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium
});
}
}
Under Standing The Code
Just rename Carbon to your ores name or to your liking(Tin, Copper, etc)
you can add blocks that the tools are efficient against(only axes, pickaxes and spades)
just add "Block.diamondOre" or your mods blocks or existing blocks.
NEW LIQUID
mod_***
package net.minecraft.src;
public class mod_Fluid extends BaseMod
{
public static final Block FluidMoving;
public static final Block FluidStill;
public mod_Fluid()
{
ModLoader.RegisterBlock(FluidMoving);
ModLoader.RegisterBlock(FluidStill);
ModLoader.AddName(FluidMoving, "Fluid Flowing");
ModLoader.AddName(FluidStill, "Fluid Still");
}
public String Version()
{
return "1.2.5";
}
public String getVersion()
{
return null;
}
public void load()
{
}
static
{
FluidMoving = (new FluidFlowing(152, Material.water)).setHardness(100F).setLightOpacity(3).setBlockName("fluidflow").disableStats().setRequiresSelfNotify();
FluidStill = (new FluidStationary(153, Material.water)).setHardness(100F).setLightOpacity(3).setBlockName("fluidstill").disableStats().setRequiresSelfNotify();
}
}
FluidFlowing
package net.minecraft.src;
import java.util.Random;
public class FluidFlowing extends BlockFluid
{
int numAdjacentSources;
boolean isOptimalFlowDirection[];
int flowCost[];
protected FluidFlowing(int par1, Material par2Material)
{
super(par1, par2Material);
numAdjacentSources = 0;
isOptimalFlowDirection = new boolean[4];
flowCost = new int[4];
}
private void updateFlow(World par1World, int par2, int par3, int par4)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
par1World.setBlockAndMetadata(par2, par3, par4, blockID + 1, i);
par1World.markBlocksDirty(par2, par3, par4, par2, par3, par4);
par1World.markBlockNeedsUpdate(par2, par3, par4);
}
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return blockMaterial != Material.lava;
}
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
int i = getFlowDecay(par1World, par2, par3, par4);
byte byte0 = 1;
if (blockMaterial == Material.lava && !par1World.worldProvider.isHellWorld)
{
byte0 = 2;
}
boolean flag = true;
if (i > 0)
{
int j = -100;
numAdjacentSources = 0;
j = getSmallestFlowDecay(par1World, par2 - 1, par3, par4, j);
j = getSmallestFlowDecay(par1World, par2 + 1, par3, par4, j);
j = getSmallestFlowDecay(par1World, par2, par3, par4 - 1, j);
j = getSmallestFlowDecay(par1World, par2, par3, par4 + 1, j);
int k = j + byte0;
if (k >= 8 || j < 0)
{
k = -1;
}
if (getFlowDecay(par1World, par2, par3 + 1, par4) >= 0)
{
int i1 = getFlowDecay(par1World, par2, par3 + 1, par4);
if (i1 >= 8)
{
k = i1;
}
else
{
k = i1 + 8;
}
}
if (numAdjacentSources >= 2 && blockMaterial == Material.water)
{
if (par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid())
{
k = 0;
}
else if (par1World.getBlockMaterial(par2, par3 - 1, par4) == blockMaterial && par1World.getBlockMetadata(par2, par3, par4) == 0)
{
k = 0;
}
}
if (blockMaterial == Material.lava && i < 8 && k < 8 && k > i && par5Random.nextInt(4) != 0)
{
k = i;
flag = false;
}
if (k != i)
{
i = k;
if (i < 0)
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
else
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate());
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, blockID);
}
}
else if (flag)
{
updateFlow(par1World, par2, par3, par4);
}
}
else
{
updateFlow(par1World, par2, par3, par4);
}
if (liquidCanDisplaceBlock(par1World, par2, par3 - 1, par4))
{
if (blockMaterial == Material.lava && par1World.getBlockMaterial(par2, par3 - 1, par4) == Material.water)
{
par1World.setBlockWithNotify(par2, par3 - 1, par4, Block.stone.blockID);
triggerLavaMixEffects(par1World, par2, par3 - 1, par4);
return;
}
if (i >= 8)
{
par1World.setBlockAndMetadataWithNotify(par2, par3 - 1, par4, blockID, i);
}
else
{
par1World.setBlockAndMetadataWithNotify(par2, par3 - 1, par4, blockID, i + 8);
}
}
else if (i >= 0 && (i == 0 || blockBlocksFlow(par1World, par2, par3 - 1, par4)))
{
boolean aflag[] = getOptimalFlowDirections(par1World, par2, par3, par4);
int l = i + byte0;
if (i >= 8)
{
l = 1;
}
if (l >= 8)
{
return;
}
if (aflag[0])
{
flowIntoBlock(par1World, par2 - 1, par3, par4, l);
}
if (aflag[1])
{
flowIntoBlock(par1World, par2 + 1, par3, par4, l);
}
if (aflag[2])
{
flowIntoBlock(par1World, par2, par3, par4 - 1, l);
}
if (aflag[3])
{
flowIntoBlock(par1World, par2, par3, par4 + 1, l);
}
}
}
private void flowIntoBlock(World par1World, int par2, int par3, int par4, int par5)
{
if (liquidCanDisplaceBlock(par1World, par2, par3, par4))
{
int i = par1World.getBlockId(par2, par3, par4);
if (i > 0)
{
if (blockMaterial == Material.lava)
{
triggerLavaMixEffects(par1World, par2, par3, par4);
}
else
{
Block.blocksList[i].dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
}
}
par1World.setBlockAndMetadataWithNotify(par2, par3, par4, blockID, par5);
}
}
private int calculateFlowCost(World par1World, int par2, int par3, int par4, int par5, int par6)
{
int i = 1000;
for (int j = 0; j < 4; j++)
{
if (j == 0 && par6 == 1 || j == 1 && par6 == 0 || j == 2 && par6 == 3 || j == 3 && par6 == 2)
{
continue;
}
int k = par2;
int l = par3;
int i1 = par4;
if (j == 0)
{
k--;
}
if (j == 1)
{
k++;
}
if (j == 2)
{
i1--;
}
if (j == 3)
{
i1++;
}
if (blockBlocksFlow(par1World, k, l, i1) || par1World.getBlockMaterial(k, l, i1) == blockMaterial && par1World.getBlockMetadata(k, l, i1) == 0)
{
continue;
}
if (!blockBlocksFlow(par1World, k, l - 1, i1))
{
return par5;
}
if (par5 >= 4)
{
continue;
}
int j1 = calculateFlowCost(par1World, k, l, i1, par5 + 1, j);
if (j1 < i)
{
i = j1;
}
}
return i;
}
private boolean[] getOptimalFlowDirections(World par1World, int par2, int par3, int par4)
{
for (int i = 0; i < 4; i++)
{
flowCost[i] = 1000;
int k = par2;
int j1 = par3;
int k1 = par4;
if (i == 0)
{
k--;
}
if (i == 1)
{
k++;
}
if (i == 2)
{
k1--;
}
if (i == 3)
{
k1++;
}
if (blockBlocksFlow(par1World, k, j1, k1) || par1World.getBlockMaterial(k, j1, k1) == blockMaterial && par1World.getBlockMetadata(k, j1, k1) == 0)
{
continue;
}
if (!blockBlocksFlow(par1World, k, j1 - 1, k1))
{
flowCost[i] = 0;
}
else
{
flowCost[i] = calculateFlowCost(par1World, k, j1, k1, 1, i);
}
}
int j = flowCost[0];
for (int l = 1; l < 4; l++)
{
if (flowCost[l] < j)
{
j = flowCost[l];
}
}
for (int i1 = 0; i1 < 4; i1++)
{
isOptimalFlowDirection[i1] = flowCost[i1] == j;
}
return isOptimalFlowDirection;
}
private boolean blockBlocksFlow(World par1World, int par2, int par3, int par4)
{
int i = par1World.getBlockId(par2, par3, par4);
if (i == Block.doorWood.blockID || i == Block.doorSteel.blockID || i == Block.signPost.blockID || i == Block.ladder.blockID || i == Block.reed.blockID)
{
return true;
}
if (i == 0)
{
return false;
}
Material material = Block.blocksList[i].blockMaterial;
if (material == Material.portal)
{
return true;
}
return material.blocksMovement();
}
protected int getSmallestFlowDecay(World par1World, int par2, int par3, int par4, int par5)
{
int i = getFlowDecay(par1World, par2, par3, par4);
if (i < 0)
{
return par5;
}
if (i == 0)
{
numAdjacentSources++;
}
if (i >= 8)
{
i = 0;
}
return par5 >= 0 && i >= par5 ? par5 : i;
}
private boolean liquidCanDisplaceBlock(World par1World, int par2, int par3, int par4)
{
Material material = par1World.getBlockMaterial(par2, par3, par4);
if (material == blockMaterial)
{
return false;
}
if (material == Material.lava)
{
return false;
}
else
{
return !blockBlocksFlow(par1World, par2, par3, par4);
}
}
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
super.onBlockAdded(par1World, par2, par3, par4);
if (par1World.getBlockId(par2, par3, par4) == blockID)
{
par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate());
}
}
}
FluidStationary
package net.minecraft.src;
import java.util.Random;
public class FluidStationary extends BlockFluid
{
protected FluidStationary(int par1, Material par2Material)
{
super(par1, par2Material);
setTickRandomly(false);
if (par2Material == Material.lava)
{
setTickRandomly(true);
}
}
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return blockMaterial != Material.lava;
}
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
if (par1World.getBlockId(par2, par3, par4) == blockID)
{
setNotStationary(par1World, par2, par3, par4);
}
}
private void setNotStationary(World par1World, int par2, int par3, int par4)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
par1World.editingBlocks = true;
par1World.setBlockAndMetadata(par2, par3, par4, blockID - 1, i);
par1World.markBlocksDirty(par2, par3, par4, par2, par3, par4);
par1World.scheduleBlockUpdate(par2, par3, par4, blockID - 1, tickRate());
par1World.editingBlocks = false;
}
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (blockMaterial == Material.lava)
{
int i = par5Random.nextInt(3);
for (int j = 0; j < i; j++)
{
par2 += par5Random.nextInt(3) - 1;
par3++;
par4 += par5Random.nextInt(3) - 1;
int l = par1World.getBlockId(par2, par3, par4);
if (l == 0)
{
if (isFlammable(par1World, par2 - 1, par3, par4) || isFlammable(par1World, par2 + 1, par3, par4) || isFlammable(par1World, par2, par3, par4 - 1) || isFlammable(par1World, par2, par3, par4 + 1) || isFlammable(par1World, par2, par3 - 1, par4) || isFlammable(par1World, par2, par3 + 1, par4))
{
par1World.setBlockWithNotify(par2, par3, par4, Block.fire.blockID);
return;
}
continue;
}
if (Block.blocksList[l].blockMaterial.blocksMovement())
{
return;
}
}
if (i == 0)
{
int k = par2;
int i1 = par4;
for (int j1 = 0; j1 < 3; j1++)
{
par2 = (k + par5Random.nextInt(3)) - 1;
par4 = (i1 + par5Random.nextInt(3)) - 1;
if (par1World.isAirBlock(par2, par3 + 1, par4) && isFlammable(par1World, par2, par3, par4))
{
par1World.setBlockWithNotify(par2, par3 + 1, par4, Block.fire.blockID);
}
}
}
}
}
private boolean isFlammable(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMaterial(par2, par3, par4).getCanBurn();
}
}
Under Standing The Code
just rename "Fluid" to your liking, "PinkwaterStationary" or something
SHAPELESS RECIPES
ModLoader.addShapelessRecipe(new ItemStack(Block.stone, 1), new Object[]{Item.redstone, Block.dirt});
Under Standing The Code
Just change Block.stone to whatever you want to be produced(Item or block)
Changed Item.redstone & Block.dirt to whatever you want to be in your recipe(Item or block)
MODDING TIPS & TRICKS
TIP & TRICK 1 =
If you can not find a tutorial on something, try looking in classes that may contain what you are looking for. Example, if you want a block that you can walk through and not collide with look into the BlockReed.class file or BlockWeb.class. You get the point hopefully.
TIP & TRICK 2 =
When following tutorials, do not worry about errors until you have fully completed and coded each of the classes required. Example, when making enum tool material + tools, you will get errors in your Mod_ file because the items havnt yet been made, but once you make the items you will get no error.
TIP & TRICK 3 = If you do not understand a tutorial, post a comment or message the creater to ask for help
More tutorials are underway! SO be patient and wait for the owl to deliver them! Please Click the green arrow that is located around the bottom right of the thread!
Please comment if you have any questions or errors! or if you want to bump the thread!
Thanks for reading and hoped this helped!
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
This is cool, I love the thread name & your growable ores mod, so those helped
A word of advice: add some new, different material! Since all you have here can be found on pretty much every other tut thread, make something different pretty much anything from your "Coming Soon" list will do!
This is cool, I love the thread name & your growable ores mod, so those helped
A word of advice: add some new, different material! Since all you have here can be found on pretty much every other tut thread, make something different pretty much anything from your "Coming Soon" list will do!
The Meaning of Life, the Universe, and Everything.
Join Date:
12/27/2010
Posts:
675
Minecraft:
smokedogg
Member Details
So ive had my mod since may 2011 never had ore gen problem till 1.2. Followed your tut. it works a little only 2 of my 16 ores generate I have no problems with my nether generation only the regular world heres the paste bin not sure what im doing wrong
WARNING: IF YOU SEE "
I will try to do as many tutorials as fast as possible so please be patient!
ModLoader.registerBlock(Namehere); this registers the block
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Namehere.png"); This adds an over ride texture, the texture has to be 16x16 if you want to put the textures in a folder you do "/Namehere/Namhere.png" instead.
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object[]{ "###", "###", "###", Character.valueOf('#'), Item.redstone});
This adds a new recipe in game.
"(Namehere, 1)" Namehere is what block/item you want to craft, If its an block/item that is already in-game than it would beItem.diamond(EG) and Block.dirt(EG), if its an new block/item in your mod_ file it would just be the name, Bench(EG)
"###", "###", "###" is where you define the crafting recipe, it goes from top to bottom so
"###",
"###",
"###",
mod_Namehere
-Where it says "Namhere" Replace with the name of your item
-Where it says "maxStackSize = 64;" change 64 to the stack size you want(no higher than 64)
Under Standing The Code
-Where it says "Namehere" replace with your block name
-If you want it to be an item repalce "blockID" with "shiftedIndex"
(int i=0; i < 20; i++) this "20" here represents how rare your ore/block is. DONT THE OTHER 16S
int randPosY = rand.nextInt(64); This "64" represents how high your ore/block will spawn, diamond is 16. If you set it to 256 it will not spawn ontop of the surface!
(new WorldGenMinable(Namehere.blockID, 20)) the "20" is how big the max vein size can be
Finished Code:
RECIPES
Under Standing The Code
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object[]{ "###", "###", "###", Character.valueOf('#'), Item.redstone});
This adds a new recipe in game.
"(Namehere, 1)" Namehere is what block/item you want to craft, If its an block/item that is already in-game than it would beItem.diamond(EG) and Block.dirt(EG), if its an new block/item in your mod_ file it would just be the name, Bench(EG)
"###", "###", "###" is where you define the crafting recipe, it goes from top to bottom so
"###",
"###",
"###",
Character.valueOf('#'), Item.redstone This is where you define what is it being crafted out of.
If you wanted it to be crafted out of two or more things your code will be like this:
you can use any number or symbol to define the crafting, doesnt have to be "#" or "X"
For a block:
Under Standing The Code
Change "Namehere" to your block/item name
"mod_Namehere.Namehere.shiftedIndex" item you want smelted
"mod_Namehere.Namehere" item you want to come out when smelted
"1" how many will come out when smelted
META DATA IN RECIPES
Under Standing The Code
Change "Namehere" to your block/item name
I used "Item.dyePowder, 4, 4" as an example, this is lapis. you can do this with planks and other meta data blocks/items. If its a block change Item.dyePowder to Block.planks(EG)
if you want to create a meta data block/item instead of using it in a recipe than replace
the "1", is how many is crafted like a normal recipe and the "4" behind it is the meta data integer. For a list of the meta data integers go to google and search "Minecraft Data Values"
To make a block drop a itemDamge item/block is fairly simple!
Lets say you want your block to drop lapis when it breaks, than you would add this.
but that will only drop dyePowder which by default is an inc sac.
So than you would have to add this piece of code!
Under Standing The Code
Rename "mod_Namhere" with your mod_ file name
Rename Namehere.blockID to your block name(eg - mod_Tutorial.CoolBlock.blockID)
Okay now for the real code!
this piece of code tells the game what piece of itemDamage to drop.
To find a full list of data values go to (http://www.minecraft...iki/Data_values)
Now scroll down to the "Dyes" section and you will find all the dyes
Now if you wanted to make your block drop bonemeal you would change
to
basically don't touch the "0" and replace the "4" to the itemdamge #
TIP & TRICK 2 =
More tutorials are underway! SO be patient and wait for the owl to deliver them! Please Click the green arrow that is located around the bottom right of the thread!
Please comment if you have any questions or errors! or if you want to bump the thread!
Thanks for reading and hoped this helped!
FORUM MODERATORS:
http://www.minecraftforum.net/topic/1271059-125-mominecraft-mod/
And Enum tools
I like little green buttons
Dual wielding.
Creating new inventory slots.
creating new movement animations.
AI coding.
good
i could try
i did add those, i havent made the tut yet though
thank you, and i actually dont know how to do doors :$
okay i will
A word of advice: add some new, different material! Since all you have here can be found on pretty much every other tut thread, make something different pretty much anything from your "Coming Soon" list will do!
(click the link)
okay thanks
http://pastebin.com/Nr5xur5d
any help is much appreciated