• 1

    posted a message on [SOLVED] Need help throwing entity where I am looking
    EDIT: I solved the problem, I didn't have sendsVelocityUpdates on in the init() section

    So I have a gun code which is supposed to fire an entity towards where I am looking at, but it doesn't work. I have tried using motionX/Y/Z and setVelocity but none of them have any effect on the bullet entity, it just falls onto the ground.

    Gun code:
    package com.jamesscn.jamesscnmod.item;

    import com.jamesscn.jamesscnmod.Main;
    import com.jamesscn.jamesscnmod.entity.EntityBullet;

    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.projectile.EntitySnowball;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;

    public class ItemGun extends Item{

    //Defines basics
    public ItemGun() {
    super();
    this.maxStackSize = 1;
    this.setMaxDamage(8);
    }

    //Called when right clicked
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
    if(par1ItemStack.getItemDamage() < 8){

    //If in survival, damage item and throw bullet
    if (!par3EntityPlayer.capabilities.isCreativeMode){
    par1ItemStack.damageItem(1, par3EntityPlayer);
    Fire(par2World, par3EntityPlayer);
    }

    //If in creative, don't damage item but throw the bullet
    if (par3EntityPlayer.capabilities.isCreativeMode){
    Fire(par2World, par3EntityPlayer);
    }
    }

    //If there are no bullets left in the gun, find and reload new ones!
    if(par1ItemStack.getItemDamage() == 8){
    if(!par3EntityPlayer.capabilities.isCreativeMode && par3EntityPlayer.inventory.hasItem(JItems.cartridge)){
    par3EntityPlayer.inventory.consumeInventoryItem(JItems.cartridge);
    par1ItemStack.setItemDamage(0);
    }

    //If in creative, don't consume bullets
    if (par3EntityPlayer.capabilities.isCreativeMode){
    Fire(par2World, par3EntityPlayer);
    }

    }

    return par1ItemStack;

    }

    public void Fire(World par1World, EntityPlayer par2EntityPlayer) {
    EntityBullet entityBullet = new EntityBullet(par1World);
    if (!par1World.isRemote){
    par1World.playSoundAtEntity(par2EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
    entityBullet.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY, par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
    par1World.spawnEntityInWorld(entityBullet);
    }
    }

    }



    Entity code:
    package com.jamesscn.jamesscnmod.entity;

    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.projectile.EntityThrowable;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.world.World;

    public class EntityBullet extends EntityThrowable{

    public EntityBullet(World par1World){
    super(par1World);
    }

    //Sets speed of the thrown bullet and gravity
    public void setVelocity(){

    //old throw code
    /*
    this.motionX *= 0.0D;
    this.motionY *= -0.0D;
    this.motionZ *= -0.0D;
    */

    this.setVelocity(10.0D, 0.0D, 0.0D);
    }

    //If bullet hits something, hurt it
    protected void onImpact(MovingObjectPosition par1MovingObjectPosition){
    if (par1MovingObjectPosition.entityHit != null){
    par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 10);
    }

    /*
    //If the bullet hits something, despawn the bullet
    if (!this.worldObj.isRemote){
    this.setDead();
    }
    */
    }
    }

    Posted in: Modification Development
  • 22

    posted a message on [1.6.2]ModLoader Tutorials
    Minecraft 1.6.2 Tutorials //forge & video tuts coming soon!!

    All code and links are being upgraded to 1.6.2

    ModLoader:


    Setting up your mod[Win/Linux] [1.6.2]

    Downloads:
    Java Eclipse - Optional
    Java JDK - Required
    Minecraft Server.jar - Required
    MCP - Required
    ModLoader - Required

    1.- Download all the files and place them in a folder for organization
    2.- Install Java JDK if you do not have it already
    3.- Unzip MCP to another folder
    4.-Force update minecraft
    5.-Install ModLoader like so:
    • Download the 1.6.2 modloader zip
    • Go to %appdata%/minecraft/versions/1.6.2/ and open 1.6.2.jar
    • Paste the contents of the modloader zip and delete META-INF
    6.- Copy Minecraft Server.jar to "jars" in MCP
    7.- Run decompile.bat [Windows] or decompile.sh [Linux] in your mcp folder (fetches .minecraft)
    8.- Run Java Eclipse and when it asks for the workspace directory, select the "eclipse" folder in MCP

    You're done setting up! now check the next tutorial for the main mod file

    Setting up your mod [Mac] [1.6.2]

    Downloads:
    Java Eclipse - Optional
    Java JDK - Required
    Minecraft Server.jar - Required
    MCP - Required
    ModLoader- Required

    1.- Download all the files and place them in a folder for organization
    2.- Unzip MCP to another folder
    3.- Force update minecraft
    4.- Install ModLoader like so:
    • Download the 1.6.2 modloader zip
    • Go to ~/Library/Application Support/minecraft/versions/1.6.2/ and extract 1.6.2.jar into a folder
    • Paste the contents of the modloader zip and delete META-INF in the extracted folder
    • Select all the items in the folder and zip them
    • When the zip is completed, change the suffix to .jar and replace the /1.6.2/1.6.2.jar
    • Delete the folder
    5.- Copy Minecraft Server.jar to "jars" in MCP
    6.- Open terminal and type: cd YourMCPFolderHere
    7.- Type: bash decompile.sh
    8.- Run Java Eclipse and when it asks for the workspace directory, select the "eclipse" folder in MCP


    Fix for recompile errors: [1.6.2]

    Open ChatMessageComponent.java and change line 256 to:

    var7.append(StatCollector.translateToLocalFormatted(this.field_111090_h, (Object[])var13));


    Then in eclipse if you get java build path problems go to Java Build Path > Libraries and replace the bad libraries with the libraries you have

    If you get the renderblocks error on line 4096 inside of the statement add

    return true;


    Special thanks to Poersch, culegooner and Roxane

    Compiling, Testing and Releasing your mod[Win/Linux] [1.6.2]

    Compiling:
    Run recompile.bat [Windows] or recompile.sh [Linux]

    Testing [Requires compiling first]:
    Run startclient.bat [Windows] or startclient.sh [Linux]

    Releasing [Requires compiling first]:
    Run reobfuscate.bat [Windows] or startclient.sh [Linux]
    Open the folder "reobf" in MCP and compress its contents into a .zip
    Share the .zip with the internet or with your friends!

    Compiling, Testing and Releasing your mod[Mac] [1.6.2]

    Compiling:
    Open terminal and type: cd YourMCPFolderHere
    type: bash recompile.sh

    Testing [Requires compiling first]:
    Open terminal and type: cd YourMCPFolderHere
    type: bash startclient.sh

    Releasing [Requires compiling first]:
    Open terminal and type: cd YourMCPFolderHere
    type: bash reobfuscate.sh
    Open the folder "reobf" in MCP and compress its contents into a .zip
    Share the .zip with the internet or with your friends!

    Creating your main mod file: [1.6.2]

    Open up client > src > net.minecraft.src in eclipse, right click the folder and select new > class and call the file mod_YourModNameHere (my one is mod_fun). Open it and copy and paste this into your file
    package net.minecraft.src;
    public class mod_YourModNameHere extends BaseMod{
    public void load(){
    
    }
    public String getVersion(){
    return "blah";
    }
    }


    Most of the code you will write will be here in this file, it registers your mod and all items, blocks, commands, biomes, dimensions, mobs, recipes, etc.

    Creating a block: [1.6.2]

    Now you have your mod_YourModNameHere class, let's make a block! note that you can test this by clicking the green play button above your code.

    public static final Block funBlock = new BlockFun(180, 0);


    Put this line before the public void load() but after the public class YourModNameHere extends BaseMod{

    You can change funBlock and BlockFun to custom names but remember them!
    This is telling us to create a block "funBlock", and use the class BlockFun as its template. The 180 in the brackets is its ID (make sure its not conflicting with another block ID and is under 256)

    Let's add a few attributes to it

    public static final Block funBlock = new BlockFun(180, 0).setHardness(1.0F).setResistance(5F);


    I added setHardness and SetResistance to it, setHardness is how hard it is to break (0.0F is by hand, 1.0F with a wood pick, 2.0F with a stone pick, etc.) and setResistance is how easily it's destroyed by explosions

    Now all we need is a texture!

    public static final Block funBlock = new BlockFun(180, 0).setHardness(1.0F).setResistance(5F).setUnlocalizedName("funblock").func_111022_d("funblock");


    This will add a custom texture to your block, to add a custom one, you have to go to /MCP/Jars/Versions/1.6.2/1.6.2.jar/assets/minecraft/textures/blocks/ and add a texture (has to be a .png of 16x16 pixels), and change the unlocalized name AND func to your custom texture without the .png extension.

    Now you need to register your block and create the BlockFun class for it.

    Create a new class in the same place where you made your mod_YourModNameHere class and name it BlockFun. Here will be the code for the block:

    package net.minecraft.src;
    import java.util.Random;
    public class BlockFun extends Block {
    
    public BlockFun(int par1, int i){
    super(par1, Material.rock);
    this.setCreativeTab(CreativeTabs.tabBlock);
    }
    
    public int quantityDropped(int par1){
    		 return (1);
    }
    
    public int idDropped(int par1, Random par2Random, int par3)
    {
    		 return mod_YourModNameHere.funBlock.blockID;
    }
    }


    The line
    this.setCreativeTab(CreativeTabs.tabBlock);
    places your block in the blocks section of the creative menu, so you can access it easily (it's usually at the bottom)

    The int quantityDropped is how many of the block do you want to drop when it's destroyed (note you can change this to an item like in redstone and lapiz ore)

    The int idDropped is which block or item to drop, in this case it will drop the fun block we created.

    Now all that's left is registering the block, insert this line in your mod_YourModNameHere class in the public void load section

    ModLoader.registerBlock(funBlock);


    You should now be able to test and play with your code, here is the full class for if you just want to copy and paste :P

    Mod_YourModNameHere
    package net.minecraft.src;
    public class mod_YourModNameHere extends BaseMod{
    public static final Block funBlock = new BlockFun(180, 0).setHardness(1.0F).setResistance(5F).setUnlocalizedName("funblock").func_111022_d("funblock");
    public void load(){
    ModLoader.registerBlock(funBlock);
    }
    public String getVersion(){
    return "blah";
    }
    }


    BlockFun.java
    package net.minecraft.src;
    import java.util.Random;
    public class BlockFun extends Block {
    
    public BlockFun(int par1, int i){
    super(par1, Material.rock);
    this.setCreativeTab(CreativeTabs.tabBlock);
    }
    
    public int quantityDropped(int par1){
    		 return (1);
    }
    
    public int idDropped(int par1, Random par2Random, int par3)
    {
    		 return mod_YourModNameHere.funBlock.blockID;
    }
    ]


    Creating an Item: [1.6.2]

    Unlike the block, creating a simple item only requires one line of code

    public static final Item ruby = new Item(1035);


    Place this under the line public class Mod_YourModNameHere extends BaseMod{ but above the public void load();

    This is telling the mod to create an item, in this case a ruby, and give it the id 1035 (Item ID's have to be bigger than 256).

    Let's add some attributes

    public static final Item ruby = new Item(1035).setUnlocalizedName("ruby").func_111206_d("ruby").setCreativeTab(CreativeTabs.tabMaterials);


    .setUnlocalizedName and func_111206_d are the icon, in this case it used the unused ruby texture by mojang. To create a custom one just place a new icon in the /textures/items/ folder in your minecraft.jar in "jars/bin" (icons have to be .png of 16x16 size).

    .setCreativeTab(CreativeTabs.tabMaterials) tells the code to place the item in the materials tab of the creative menu

    You can now play and test your item

    Adding a name and recipe to your item/block: [1.6.2]

    Write in your Mod_YourModNameHere class in the public void load

    ModLoader.addName(funBlock, "Block of Fun");


    The first word in the brackets, funBlock, is the code name of the block/item, and the second is the display name (make sure it has the quotation marks!).

    For a colour you would do this:

    ModLoader.addName(funBlock, EnumChatFormatting.BOLD + "Fun Block");


    Change bold to the colour you want.

    Special colours: Obfuscated (random changing numbers & letters), bold, underline, strikethrough and italic.

    Recipes:

    ModLoader.addRecipe(new ItemStack(funBlock, 27), new Object[]{"###", " # ", " # ", Character.valueOf('#'), Block.dirt});


    This makes a crafting recipe for the funblock, and gives you 27 of them when you make a T shape with dirt in a crafting table. To add more than one item needed to craft it repeat the line

    Character.valueOf('#'), Block.dirt


    with a different letter or symbol and a different block/item. To add an item instead start with Item.itemname instead of Block.blockname.

    ModLoader.addSmelting(Block.dirt.blockID, new ItemStack(funBlock, 5), 1.0F);


    This line will make it so when you smelt a block of dirt you get 5 blocks of fun, and give you 1.0F exp

    Adding textures [1.6.2 Method]:

    For a block you would have to add this function at the end:
    .func_111022_d("UnlocalizedName");

    and if it's an item you would add this instead:
    .func_111206_d("UnlocalizedName");

    like this:
    public static final Block funBlock = new BlockFun(180, 0).setHardness(1F).setResistance(5F).setUnlocalizedName("funblock").func_111022_d("funblock");

    public static final Item ruby = new Item(1035).setUnlocalizedName("ruby").setCreativeTab(CreativeTabs.tabMaterials).func_111206_d("ruby");


    Then place the textures in /mcp/jars/versions/1.6.2/1.6.2.jar/assets/minecraft/textures/blocks/ or /items/

    Now leaving the basics, here's some more complex code

    Crafting with dyes/metadata items: [1.6.2]

    Here I will make a fun block out of ink sacks, just add this line to your public void load:

    ModLoader.addRecipe(new ItemStack(funBlock, 1), new Object[]{" # ", "###", " # ", Character.valueOf('#'), new ItemStack(Item.dyePowder, 1, 0)});


    In the part:

    new ItemStack(Item.dyePowder, 1, 0)});


    The first item is the metadata item (multiple items with the same id), for example, coal and charcoal.
    The second int is the amount of items in a slot
    The third int is the type of dye, here is a list of dyes:

    0 - Ink Sack
    1 - Rose Red
    2 - Cactus Green
    3 - Cocoa Beans
    4 - Lapiz Lazuli
    5 - Purple Dye
    6 - Cyan Dye
    7 - Light Grey Dye
    8 - Grey Dye
    9 - Pink Dye
    10 - Lime Dye
    11 - Dandelion Yellow
    12 - Light Blue Dye
    13 - Magenta Dye
    14 - Orange Dye
    15 - Bone Meal

    Coal and charcoal are 0 for coal and 1 for charcoal

    Creating a biome: [1.6.2]

    Let's create a biome called diamondHills, add this to the void load:

    ModLoader.addBiome(BiomeGenBase.diamondHills);


    Now go into BiomeGenBase.java and place this below the latest biome (jungleHills)

    public static final BiomeGenBase diamondHills = (new BiomeGenDiamond(23)).setColor(2900485).setBiomeName("DiamondHills").func_76733_a(5470985).setTemperatureRainfall(2.0F, 0.0F).setMinMaxHeight(0.3F, 1.5F);


    Now to create the class BiomeGenDiamond:

    package net.minecraft.src;
    public class BiomeGenDiamond extends BiomeGenBase{
    
    public BiomeGenDiamond(int par1){
    super(par1);
    this.topBlock = (byte)Block.blockDiamond.blockID; //Block on top (usually grass)
    this.fillerBlock = (byte)Block.blockGold.blockID; //Block below (usually dirt)
    }
    }


    This creates some hills with diamonds on the top and gold below. Now create a new world and look for your biome! this is how mine came out:




    Creating a mob: [1.5.1 Only]

    Let's make some steves which act like normal animals and follow you when you hold diamonds, first place this with your imports (after package src.minecraft.net and before public class):

    import java.util.Map;


    Now in your void load section add:

    ModLoader.registerEntityID(EntitySteve.class, "Steve", 50); //registers our steve
    ModLoader.addSpawn("Steve", 5, 1, 1, EnumCreatureType.creature); //makes it spawn in daylight
    ModLoader.addLocalization("entity.Steve.name", "Steve"); //adds the name
    EntityList.entityEggs.put(Integer.valueOf(50), new EntityEggInfo(50, 894731, (new Color(16, 12, 5)).getRGB())); //adds egg (doesnt work)


    EnumCreatureType.creature is a passive mob
    EnumCreatureType.monster is a hostile mob
    EnumCreatureType.waterCreature is a passive water mob

    This registers your steve, and gives it the ID of 50. Now to render it:

    public void addRenderer(Map var1){
    var1.put(EntitySteve.class, new RenderLiving(new ModelBiped(),.5f));
    }


    If you want to change the shape of the mob, change ModelBiped to another model, like ModelQuadruped for a cow/sheep/pig, ModelSlime, ModelSilverfish, etc.

    now create an EntitySteve class:

    package net.minecraft.src;
    public class EntitySteve extends EntityMob{
    
    public EntitySteve(World world){
    super(world);
    this.texture = "/mob/char.png"; //texture of the mob
    this.moveSpeed = 0.3F; //speed of the mob
    
    this.tasks.addTask(0, new EntityAISwimming(this)); //tells it to swim
    	 this.tasks.addTask(1, new EntityAIPanic(this, 0.38F)); //tells it to panic
    	 this.tasks.addTask(2, new EntityAITempt(this, 0.25F, Item.diamond.itemID, false)); //tells it to follow diamonds
    	 this.tasks.addTask(3, new EntityAIWander(this, 0.2F)); //tells it to wander around
    	 this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); //tells it to look at player
    	 this.tasks.addTask(5, new EntityAILookIdle(this)); //tells it to not do anything
    }
    
    public int func_82193_c(Entity par1Entity){
    return 4;
    }
    
    public int getMaxHealth(){
    return 20; //its health in half hearts
    }
    
    protected boolean isAIEnabled(){
    return true; //enables the AI
    }
    
    protected int getDropItemId(){
    return Block.cobblestone.blockID; //drops 1 cobblestone
    }
    }


    When killed a steve will drop cobblestone every time. If you would like to change the texture change /mob/char.png to the mob you desire.

    Now to make your steves spawn in the wild go to BiomeGenBase.java and add this code inside protected BiomeGenBase(int par1):

    this.spawnableCreatureList.add(new SpawnListEntry(EntitySteve.class, 8, 4, 8));


    The first 8 is the entity class
    The second 4 is the minimum amount of steves in a group
    The third 8 is the maximum amount of steves in a group

    Steves should now spawn in all biomes

    Creating a command: [1.6.2]

    Let's make a simple command which heals the player instantly

    Add this above your void load() with your blocks and items:

    public static final ICommand heal = new CommandHeal();


    Then place this inside your load

    ModLoader.addCommand(heal);


    Now create a class called CommandHeal and place this:

    package net.minecraft.src;
    public class CommandHeal extends CommandBase{
    public String getCommandName(){
    return "heal"; //set command name
    }
    public int func_82362_a(){
    return 0;
    }
    public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr){
    EntityPlayer var3 = getCommandSenderAsPlayer(par1ICommandSender);
    var3.heal(20); //sets the players health to 20 half hearts (10 hearts)
    }
    public String getCommandUsage(ICommandSender var1) {
    return "/heal";
    }
    }



    Now test your code by typing /heal and you will have full health

    Simple Grenade: [1.6.2] [No render]

    Let's make a grenade :D

    Add this to your items:

    public static final Item grenade = new ItemGrenade(1037).setCreativeTab(CreativeTabs.tabTools);


    Now to create the ItemGrenade class:

    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;
    }
    
    }


    Now we just need the EntityGrenade class:

    package net.minecraft.src;
    public class EntityGrenade extends EntityThrowable{
    public EntityGrenade(World par1World){
    super(par1World);
    }
    
    public EntityGrenade(World par1World, EntityPlayer entityplayer){
    super(par1World, entityplayer);
    }
    
    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;
    
    }



    Now just make a grenade icon and try it out!

    Creating a world type: [1.6.2]

    Add this to your items and blocks:

    public static final WorldType Tundra = new WorldTypeTundra(3, "Tundra");


    Basiclly we're going to make a world filled with snow.

    Make a WorldTypeTundra class:

    package net.minecraft.src;
    public class WorldTypeTundra extends WorldType{
    
    public WorldTypeTundra(int par1, String par2Str){
    super(par1, par2Str);
    }
    public String getTranslateName(){
    return "Tundra"; //name to display
    }
    public WorldChunkManager getChunkManager(World var1){
    return new WorldChunkManagerHell(BiomeGenBase.icePlains, 0.5F, 0.5F); //sets the entire world into ice plains
    }
    }


    Simple Jetpack: [1.6.2]

    Let's create a jetpack! when you right click, you fly.

    place this with our items and blocks:

    public static final Item jetpack = new ItemJetpack(1034).setUnlocalizedName("jetpack").setCreativeTab(CreativeTabs.tabTools);


    And now creating the ItemJetpack Class

    package net.minecraft.src;
    public class ItemJetpack extends Item{
    public ItemJetpack(int par1){
    super(par1);
    this.maxStackSize = 1;
    this.setCreativeTab(CreativeTabs.tabTools);
    }
    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer){
    entityplayer.motionY += 1; //fling the player up in the air
    entityplayer.fallDistance = (float) entityplayer.motionY; //Thanks _cyentw_!
    return itemstack;
    }
    }


    Special thanks to _cyentw_ with code

    Adding item description: [1.5.2 Only]

    So, you're wondering how to add an item description to an object with colours? Here's how:

    public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List){
    par3List.add(EnumChatFormatting.BOLD + "Out of this world!");
    }


    Add this to your ItemName.java. You can add various lines and change the colour by changing EnumChatFormatting.COLOUR

    Multi-Textured Block [1.6.2]

    We will make a multi-textured block, using custom textures. Make and register the block, mine is the Mineral Block:

    public static final Block mineralBlock = new BlockMineral(182, 0).setHardness(3.0F).setResistance(3.0F).setUnlocalizedName("mineral");


    Here is the BlockMineral.java:

    package net.minecraft.src;
    import java.util.Random;
    public class BlockMineral extends Block {
    
    public BlockMineral(int par1, int i){
    super(par1, Material.rock);
    this.setCreativeTab(CreativeTabs.tabBlock);
    }
    
    public int quantityDropped(int par1){
    		 return (1);
    }
    
    public int idDropped(int par1, Random par2Random, int par3){
    return mod_fun.mineralBlock.blockID;
    }
    
    public Icon getIcon(int par1, int par2){
    }
    
    public void registerIcons(IconRegister par1IconRegister){
    }
    
    }


    Now for each extra side you plan on making add a var icon before the public BlockClassName(). I am going to use bottom, top and front custom sides

    private Icon bottom;
    private Icon top;
    private Icon front;


    Now we need to get the sides to place them in and the textures: inside the getIcon void you have to place which texture goes where, for example:

    return par1 == 0 ? this.bottom : this.blockIcon;


    Basiclly it says that if the side is 0 (bottom) then add the texture bottom, and if it's anything else add the default texture

    0 = bottom
    1 = top
    2 = north
    3 = south
    4 = west
    5 = east

    The code to add 2 textures to a block is

    return par1 == 0 ? this.bottom : (par1 == 1 ? this.top : this.blockIcon);


    And 3 is

    return par1 == 0 ? this.bottom : (par1 == 1 ? this.top : (par1 == 2 ? this.front : this.blockIcon));


    Keep on repeating the pattern for more sides. Now to define the texture, in the registerIcons void you would add this:

    this.blockIcon = par1IconRegister.registerIcon("mineral_other"); //all undefined textures
    this.top = par1IconRegister.registerIcon("mineral_top"); //top texture
    this.bottom = par1IconRegister.registerIcon("mineral_bottom"); //bottom texture
    this.front = par1IconRegister.registerIcon("mineral_front"); //front texture


    It's the same as setUnlocalizedName but instead it gets the textures for various sides. Here is the full BlockMineral.java:


    package net.minecraft.src;
    import java.util.Random;
    public class BlockMineral extends Block {
    
    private Icon bottom;
    private Icon top;
    private Icon front;
    
    public BlockMineral(int par1, int i){
    super(par1, Material.rock);
    this.setCreativeTab(CreativeTabs.tabBlock);
    }
    
    public int quantityDropped(int par1){
    		 return (1);
    }
    
    public int idDropped(int par1, Random par2Random, int par3){
    return mod_fun.mineralBlock.blockID;
    }
    
    public Icon getIcon(int par1, int par2)
    {
    	 return par1 == 0 ? this.bottom : (par1 == 1 ? this.top : (par1 == 2 ? this.front : this.blockIcon));
    }
    
    public void registerIcons(IconRegister par1IconRegister){
    this.blockIcon = par1IconRegister.registerIcon("mineral_other");
    this.top = par1IconRegister.registerIcon("mineral_top");
    this.bottom = par1IconRegister.registerIcon("mineral_bottom");
    this.front = par1IconRegister.registerIcon("mineral_front");
    }
    
    }


    How to make a gun [1.6.2]:

    First we need to make a gun item then a cartridge item, like so:

    public static final Item gun = new ItemGun(1038).setUnlocalizedName("gun");


    public static final Item cartridge = new ItemCartridge(1039).setUnlocalizedName("cartridge");


    Now we need to make an ItemGun class, an ItemCartridge class and an EntityBullet class, here is the ItemGun:

    package net.minecraft.src;
    import java.util.List;
    import java.util.Random;
    public class ItemGun extends Item{
    public ItemGun(int par1){
    super(par1);
    this.maxStackSize = 1;
    this.setMaxDamage(30);
    }
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
    EntityBullet bullet = new EntityBullet(par2World, par3EntityPlayer);
    if(par1ItemStack.getItemDamage() < 29){
    
    if (!par3EntityPlayer.capabilities.isCreativeMode){
    par1ItemStack.damageItem(1, par3EntityPlayer);
    if (!par2World.isRemote){
    	 par2World.spawnEntityInWorld(bullet);
    }
    }
    	
    if (par3EntityPlayer.capabilities.isCreativeMode){
    if (!par2World.isRemote){
    	 par2World.spawnEntityInWorld(bullet);
    }
    }
    }
    
    if(par1ItemStack.getItemDamage() == 29){
    if(!par3EntityPlayer.capabilities.isCreativeMode && par3EntityPlayer.inventory.hasItem(mod_fun.cartridge.itemID)){
    par3EntityPlayer.inventory.consumeInventoryItem(mod_fun.cartridge.itemID);
    par1ItemStack.setItemDamage(0);
    }
    
    if (par3EntityPlayer.capabilities.isCreativeMode){
    if (!par2World.isRemote){
    	 par2World.spawnEntityInWorld(bullet);
    }
    }
    }
    
    	 return par1ItemStack;
    }
    }


    ItemCartridge.java:

    package net.minecraft.src;
    public class ItemCartridge extends Item{
    public ItemCartridge(int par1){
    		 super(par1);
    		 this.maxStackSize = 4; //how many in a full stack
    }
    }


    EntityBullet.java:

    package net.minecraft.src;
    public class EntityBullet extends EntityThrowable{
    public EntityBullet(World par1World){
    super(par1World);
    }
    
    public EntityBullet(World par1World, EntityPlayer par3EntityPlayer){
    	 super(par1World, par3EntityPlayer);
    }
    
    public EntityBullet(World par1World, double par2, double par4, double par6){
    	 super(par1World, par2, par4, par6);
    }
    public void setVelocity(){
    	 this.motionX *= 0.0D;
    	 this.motionY *= -0.0D; //Sets the gravity
    	 this.motionZ *= -0.0D;
    }
    protected void onImpact(MovingObjectPosition par1MovingObjectPosition){
    	 if (par1MovingObjectPosition.entityHit != null){
    		 par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 5); //causes 5 damage points to whatever it hits
    	 }
    	
    	 if (!this.worldObj.isRemote){
    		 this.setDead(); //despawns the bullet after hitting something
    	 }
    }
    }


    When you fire the gun it will damage the gun and consume a cartridge to repair the gun.

    Adding food: [1.6.2]

    To add food to minecraft just place this with your blocks and items:

    public static final Item omelette = new ItemFood(1100, 8, 0.75F, false).setUnlocalizedName("omelette");


    The first number is the ID
    The second number is how many half chicken bones your food fills (4 chicken bones)
    The third float is the saturation, or the time before you get hungry again (make sure it's between 0 and 1)
    The fourth boolean is whether or not you can feed it to wolves

    To add potion effects just add

    .setPotionEffect(Potion.hunger.id, 45, 0, 0.5F)


    MAKE SURE IT IS THE FIRST THING AFTER ItemFood(int, int, float, boolean), otherwise you will get a compilation problem

    The first number is the potion ID
    The second number is the duration in seconds of the effect
    The third number is the amplifier
    The fourth float is the probability, 0 being never and 1 being always

    And to let your food be eaten even when your not hungry add

    .setAlwaysEdible()


    Generating a structure: [1.6.2]

    Here I show you how to spawn a pile of dirt with a diamond block on top, we need to define our structure first:

    WorldGenDirtPile dirtPile = new WorldGenDirtPile();


    Place it with your items and block (Don't put public static final before it!)

    Now below the public void load add the void generateSurface:

    public void generateSurface(World world, Random random, int i, int j){
    for(int l = 0; l < 10; l++){
    int randPosX = i + random.nextInt(16); //Only one structure can spawn within 16 blocks horizontally
    int randPosY = random.nextInt(80); //Only one structure can spawn within 80 blocks vertically
    int randPosZ = j + random.nextInt(16); //Only one structure can spawn within 16 blocks horizontally
    dirtPile.generate(world, random, randPosX, randPosY, randPosZ); //spawn the structure if possible
    }
    }


    The 10 in the for statement is how rare your structure is, I set it to 10 so it can be found easily, the ints randPosX, Y and Z are how close the structures are allowed to spawn, and dirtPile.generate tells it to spawn one if conditions are met.

    Now for our WorldGenDirtPile.java:

    package net.minecraft.src;
    import java.util.Random;
    public class WorldGenDirtPile extends WorldGenerator{
    
    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5){
    	
    	 //if the origin is air and the block below is grass, spawn the following:
    	 if (par1World.isAirBlock(par3, par4, par5) && par1World.getBlockId(par3, par4 - 1, par5) == Block.grass.blockID){
    	
    	 par1World.setBlock(par3, par4, par5, Block.dirt.blockID); //spawn block of dirt at origin
    		 par1World.setBlock(par3, par4 + 1, par5, Block.dirt.blockID); //spawn block of dirt at origin but 1 higher
    		 par1World.setBlock(par3, par4 + 2, par5, Block.dirt.blockID); //spawn block of dirt at origin but 2 higher
    		 par1World.setBlock(par3, par4 + 3, par5, Block.dirt.blockID); //spawn block of dirt at origin but 3 higher
    		 par1World.setBlock(par3, par4 + 4, par5, Block.dirt.blockID); //spawn block of dirt at origin but 4 higher
    		 par1World.setBlock(par3, par4 + 5, par5, Block.dirt.blockID); //spawn block of dirt at origin but 5 higher
    		 par1World.setBlock(par3, par4 + 6, par5, Block.dirt.blockID); //spawn block of dirt at origin but 6 higher
    		 par1World.setBlock(par3, par4 + 7, par5, Block.dirt.blockID); //spawn block of dirt at origin but 7 higher
    		 par1World.setBlock(par3, par4 + 8, par5, Block.blockDiamond.blockID); //spawn block of diamond at origin but 8 higher
    	
    	 }
    			
    	 return true;
    }
    }


    The line:

    if (par1World.isAirBlock(par3, par4, par5) && par1World.getBlockId(par3, par4 - 1, par5) == Block.grass.blockID){


    is saying that if the origin is air and the block below the origin is grass, spawn the structure, and

    par1World.setBlock(par3, par4 + 2, par5, Block.dirt.blockID);


    is saying place a block of dirt at the origin's X coord, Y coord + 2 and Z coord. To make it air you would do

    par1World.setBlockToAir(par3, par4, par5);


    Now test your mod and you should be able to find these in places with grass

    Making your structure spawn in a specific biome: [1.6.2]

    This is a continuation to the last tutorial. If you want to spawn it in a certain biome, instead of adding these two codes in the public void load:

    WorldGenDirtPile dirtPile = new WorldGenDirtPile();


    public void generateSurface(World world, Random random, int i, int j){
    for(int l = 0; l < 10; l++){
    int randPosX = i + random.nextInt(16); //Only one structure can spawn within 16 blocks horizontally
    int randPosY = random.nextInt(80); //Only one structure can spawn within 80 blocks vertically
    int randPosZ = j + random.nextInt(16); //Only one structure can spawn within 16 blocks horizontally
    dirtPile.generate(world, random, randPosX, randPosY, randPosZ); //spawn the structure if possible
    }


    Add this in the BiomeGen file of the biome you want it to spawn in:

    public void decorate(World world, Random random, int i, int j, int k){
    	 super.decorate(world, random, i, k);
    	 WorldGenDirtPile dirtPile = new WorldGenDirtPile(); //structure to spawn
    	 for(int l = 0; l < 10; l++){
    int randPosX = i + random.nextInt(16); //Only one structure can spawn within 16 blocks horizontally
    int randPosY = random.nextInt(80); //Only one structure can spawn within 80 blocks vertically
    int randPosZ = k + random.nextInt(16); //Only one structure can spawn within 16 blocks horizontally
    dirtPile.generate(world, random, randPosX, randPosY, randPosZ); //spawn the structure if possible
    	 }
    }


    Adding chests to structure: [1.5.2 Only]

    We are going to modify the last code by adding a few lines.

    Add this before public boolean generate

    private final WeightedRandomChestContent[] chestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 3, 3), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 20, 3, 3)};;


    This defines the items in the chest. Right now there are two items, diamonds and gold. To add more items keep on adding this:

    new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 3, 3)


    The first item is the item to spawn
    The second int is the amount of damage on an item (used in tools and armour)
    The third int is the minimum amount in a chest
    The fourth int is the maximum amount in a chest
    The fifth int is the super (leave this to 3)

    Now add this below:

    private final int items = 2;


    This says that only two slots can be taken. You can use a random to make it vary

    Now inside the boolean generate add this:

    par1World.setBlock(par3, par4 + 8, par5, Block.chest.blockID, 0, 2);
    TileEntityChest chest = (TileEntityChest)par1World.getBlockTileEntity(par3, par4 + 8, par5);
    WeightedRandomChestContent.generateChestContents(par2Random, this.chestContents, chest, this.items);


    The first line tells it to spawn the chest 8 blocks above the origin, the second line tells the code there's a chest 8 blocks above the origin and the third line tells it to fill the chest with the items

    Here is the full code:


    package net.minecraft.src;
    import java.util.Random;
    public class WorldGenDirtPile extends WorldGenerator{
    
    private final WeightedRandomChestContent[] chestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 3, 3), new WeightedRandomChestContent(Item.pickaxeIron.itemID, 50, 1, 1, 3)};;
    private final int items = 2;
    
    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5){
    	
    	 //if the origin is air and the block below is grass, spawn the following:
    	 if (par1World.isAirBlock(par3, par4, par5) && par1World.getBlockId(par3, par4 - 1, par5) == Block.grass.blockID){
    	
    	 par1World.setBlock(par3, par4, par5, Block.dirt.blockID); //spawn block of dirt at origin
    		 par1World.setBlock(par3, par4 + 1, par5, Block.dirt.blockID); //spawn block of dirt at origin but 1 higher
    		 par1World.setBlock(par3, par4 + 2, par5, Block.dirt.blockID); //spawn block of dirt at origin but 2 higher
    		 par1World.setBlock(par3, par4 + 3, par5, Block.dirt.blockID); //spawn block of dirt at origin but 3 higher
    		 par1World.setBlock(par3, par4 + 4, par5, Block.dirt.blockID); //spawn block of dirt at origin but 4 higher
    		 par1World.setBlock(par3, par4 + 5, par5, Block.dirt.blockID); //spawn block of dirt at origin but 5 higher
    		 par1World.setBlock(par3, par4 + 6, par5, Block.dirt.blockID); //spawn block of dirt at origin but 6 higher
    		 par1World.setBlock(par3, par4 + 7, par5, Block.dirt.blockID); //spawn block of dirt at origin but 7 higher
    		 par1World.setBlock(par3, par4 + 8, par5, Block.chest.blockID, 0, 2);
    		 TileEntityChest chest = (TileEntityChest)par1World.getBlockTileEntity(par3, par4 + 8, par5);
    		 WeightedRandomChestContent.generateChestContents(par2Random, this.chestContents, chest, this.items);
    	 }
    			
    	 return true;
    }
    }


    Multiple block drops: [1.6.2]

    To add multiple block drops, add this code to your BlockName.java:

    public int idDropped(int par1, Random par2Random, int par3){
    	 return mod_fun.funBlock.blockID;
    }
    
    public int idDropped2(int par1, Random par2Random, int par3){
    	 return mod_fun.mineralBlock.blockID;
    }
    
    public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7){
    	 if (!par1World.isRemote){
    		 int var8 = this.quantityDroppedWithBonus(par7, par1World.rand);
    		 for (int var9 = 0; var9 < var8; ++var9)
    		 {
    			 if (par1World.rand.nextFloat() <= par6)
    			 {
    				 int var10 = this.idDropped2(par5, par1World.rand, par7);
    				 int var11 = this.idDropped(par5, par1World.rand, par7);
    				 if (var10 > 0)
    				 {
    					 this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5)));
    					 this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var11, 1, this.damageDropped(par5)));
    				 }
    			 }
    		 }
    	 }
    }


    Making an ore: [1.6.2]

    First make the block:

    public static final Block oreRuby = new BlockRubyOre(183, 0).setHardness(3.0F).setResistance(3.0F).setUnlocalizedName("oreRuby").setCreativeTab(CreativeTabs.tabBlock);


    and the BlockRubyOre class:

    package net.minecraft.src;
    import java.util.Random;
    public class BlockRubyOre extends Block{
    public BlockRubyOre(int par1, int i){
    super(par1, Material.iron);
    }
    
    public int quantityDropped(int par1){
    	 return (1);
    }
    
    public int idDropped(int par1, Random par2Random, int par3){
    	 return mod_fun.ruby.itemID;
    }
    
    }


    Now spawn our block in the world:

    public void generateSurface(World world, Random random, int i, int j){
    for(int k = 0; k < 7; k++){
    int randPosX = i + random.nextInt(16);
    int randPosY = random.nextInt(48);
    int randPosZ = j + random.nextInt(16);
    (new WorldGenMinable(oreRuby.blockID, 8)).generate(world, random, randPosX, randPosY, randPosZ);
    }
    }


    Change k < 7 to the amount of veins per chunk (e.g. k < 10). Do not change the randPosX and randPosZ ints otherwise there will be chunk problems. You can change randPosY, which is the maximum height your veins can spawn at, in this case 48. The part (oreRuby.blockID, 8) is the ore and the maximum amount of blocks in a vein.

    You should be able to find your block in the overworld below level 48.

    Spawning ore in the nether: [1.6.2]

    First create the generateNether void (below the public void getVersion):

    public void generateNether(World world, Random random, int i, int j){
    for(int k = 0; k < 14; k++){
    int randPosX = i + random.nextInt(16);
    int randPosY = random.nextInt(128);
    int randPosZ = j + random.nextInt(16);
    new NetherGenMinable(oreRuby.blockID, 16).generate(world, random, randPosX, randPosY, randPosZ);
    }
    }


    The line:

    for(int k = 0; k < 14; k++)


    Tells it to spawn the ore 14 times in a chunk, then the line:

    new NetherGenMinable(oreRuby.blockID, 16).generate(world, random, randPosX, randPosY, randPosZ);


    Tells it to spawn ruby ore in a max ore size of 16. Now let's create the NetherGenMinable class:

    package net.minecraft.src;
    import java.util.Random;
    public class NetherGenMinable extends WorldGenerator {
    private int minableBlockId;
    private int numberOfBlocks;
    
    public NetherGenMinable(int par1, int par2) {
    this.minableBlockId = par1;
    this.numberOfBlocks = par2;
    }
    
    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) {
    float var6 = par2Random.nextFloat() * (float)Math.PI;
    double var7 = (double)((float)(par3 + 8) + MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F);
    double var9 = (double)((float)(par3 + 8) - MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F);
    double var11 = (double)((float)(par5 + 8) + MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F);
    double var13 = (double)((float)(par5 + 8) - MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F);
    double var15 = (double)(par4 + par2Random.nextInt(3) - 2);
    double var17 = (double)(par4 + par2Random.nextInt(3) - 2);
    for (int var19 = 0; var19 <= this.numberOfBlocks; ++var19) {
    double var20 = var7 + (var9 - var7) * (double)var19 / (double)this.numberOfBlocks;
    double var22 = var15 + (var17 - var15) * (double)var19 / (double)this.numberOfBlocks;
    double var24 = var11 + (var13 - var11) * (double)var19 / (double)this.numberOfBlocks;
    double var26 = par2Random.nextDouble() * (double)this.numberOfBlocks / 16.0D;
    double var28 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D;
    double var30 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D;
    int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
    int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
    int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
    int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
    int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
    int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
    for (int var38 = var32; var38 <= var35; ++var38) {
    double var39 = ((double)var38 + 0.5D - var20) / (var28 / 2.0D);
    if (var39 * var39 < 1.0D) {
    	 for (int var41 = var33; var41 <= var36; ++var41) {
    	 double var42 = ((double)var41 + 0.5D - var22) / (var30 / 2.0D);
    	 if (var39 * var39 + var42 * var42 < 1.0D) {
    	 for (int var44 = var34; var44 <= var37; ++var44) {
    	 double var45 = ((double)var44 + 0.5D - var24) / (var28 / 2.0D);
    	 if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && par1World.getBlockId(var38, var41, var44) == Block.netherrack.blockID) {
    		 par1World.setBlock(var38, var41, var44, this.minableBlockId);
    		 }
    	 }
    	 }
    	 }
    	 }
    }
    }
    return true;
    }
    }


    Your ore should now spawn in the nether.


    Making Armour [1.6.2]:

    Make these four items (helmet, chestplate, leggings and boots):

    public static final Item helmetRuby = new ItemArmorRuby(1200, EnumArmorRuby.RUBY, ModLoader.addArmor("ruby"), 0).setUnlocalizedName("helmetRuby").setCreativeTab(CreativeTabs.tabCombat);
    public static final Item chestplateRuby = new ItemArmorRuby(1201, EnumArmorRuby.RUBY, ModLoader.addArmor("ruby"), 1).setUnlocalizedName("chestplateRuby").setCreativeTab(CreativeTabs.tabCombat);
    public static final Item leggingsRuby = new ItemArmorRuby(1202, EnumArmorRuby.RUBY, ModLoader.addArmor("ruby"), 2).setUnlocalizedName("leggingsRuby").setCreativeTab(CreativeTabs.tabCombat);
    public static final Item bootsRuby = new ItemArmorRuby(1203, EnumArmorRuby.RUBY, ModLoader.addArmor("ruby"), 3).setUnlocalizedName("bootsRuby").setCreativeTab(CreativeTabs.tabCombat);


    And now the ItemArmorRuby class:

    package net.minecraft.src;
    
    public class ItemArmorRuby extends ItemArmor{
    
    private static final int maxDamageArray[] = {11, 16, 15, 13};
    public final int armorType;
    public final int damageReduceAmount;
    public final int renderIndex;
    private final EnumArmorRuby material;
    
    public ItemArmorRuby(int par1, EnumArmorRuby mat, int par2, int par3)
    {
    	 super(par1, EnumArmorMaterial.IRON, par2, par3);
    	 material = mat;
    	 armorType = par3;
    	 renderIndex = par2;
    	 damageReduceAmount = mat.getDamageReductionAmount(par3);
    	 setMaxDamage(mat.func_40576_a(par3));
    	 maxStackSize = 1;
    }
    
    public int getItemEnchantability()
    {
    	 return material.getEnchantability();
    }
    
    static int[] getMaxDamageArray()
    {
    	 return maxDamageArray;
    }
    
    }


    and the EnumArmorRuby class:

    package net.minecraft.src;
    
    public enum EnumArmorRuby{
    RUBY("RUBY", 20, 10, new int[] {2, 7, 5, 3}, 9);
    
    private int maxDamageFactor;
    private int damageReductionAmountArray[];
    private int enchantability;
    
    
    private EnumArmorRuby(String par1String, int par1, int par2, int par3[], int par4){
    	 maxDamageFactor = par2;
    	 damageReductionAmountArray = par3;
    	 enchantability = par4;
    }
    
    public int func_40576_a(int i){
    	 return ItemArmor.getMaxDamageArray()[i] * maxDamageFactor;
    }
    	 public int getDamageReductionAmount(int i){
    	 return damageReductionAmountArray[i];
    }
    
    public int getEnchantability(){
    	 return enchantability;
    }
    }


    The line:

    RUBY("RUBY", 20, new int[] {2, 7, 5, 3}, 9);


    The first string is the name,
    The second int is the maximum damage factor, 33 being diamond and 5 being leather.
    The third array is the amount of half armour icons each piece of armour fills. The total should be less than twenty.
    The fourth int is its enchantability, iron being 9 and gold being 25.

    For the textures of the armour you would have to make the armour_layer_1.png and armour_layer_2.png and place them in /mcp/jars/versions/1.6.2/1.6.2.jar/assets/minecraft/textures/models/armor/

    Now test and run your armour.

    Changing your helmet into a visor:

    This is a continuation of the last tutorial, it shows you how to make your helmet into a visor, like a pumpkin adds its blur.

    Open the class GuiIngame and find the line this.renderPumpkinBlur, add this below the if statement it's in:

    	 if (this.mc.gameSettings.thirdPersonView == 0 && var9 != null && var9.itemID == mod_fun.helmetRuby.itemID){
    		 this.renderVisor(var6, var7);
    	 }


    And add this void anywhere within the class:

    private void renderVisor(int par1, int par2){
    	 GL11.glDisable(GL11.GL_DEPTH_TEST);
    	 GL11.glDepthMask(false);
    	 GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    	 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    	 GL11.glDisable(GL11.GL_ALPHA_TEST);
    	 this.mc.renderEngine.bindTexture("%blur%/misc/visor.png");
    	 Tessellator var3 = Tessellator.instance;
    	 var3.startDrawingQuads();
    	 var3.addVertexWithUV(0.0D, (double)par2, -90.0D, 0.0D, 1.0D);
    	 var3.addVertexWithUV((double)par1, (double)par2, -90.0D, 1.0D, 1.0D);
    	 var3.addVertexWithUV((double)par1, 0.0D, -90.0D, 1.0D, 0.0D);
    	 var3.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
    	 var3.draw();
    	 GL11.glDepthMask(true);
    	 GL11.glEnable(GL11.GL_DEPTH_TEST);
    	 GL11.glEnable(GL11.GL_ALPHA_TEST);
    	 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }


    Now to make the blur of the visor go to your /jars/ folder, and inside the minecraft.jar go into the misc folder and add your visor.png file. Make sure your visor.png is 256*256 pixels big and transparent (otherwise you wouldn't be able to see through it)

    Once you place your helmet on you should see the blur

    Making Tools: [1.6.2]

    Let's make a full set of tools with our rubies, first add these items:

    public static final Item hoeRuby = new ItemHoeRuby(1204, EnumToolRuby.RUBY).setUnlocalizedName("hoeRuby");
    public static final Item spadeRuby = new ItemSpadeRuby(1205, EnumToolRuby.RUBY).setUnlocalizedName("spadeRuby");
    public static final Item swordRuby = new ItemSwordRuby(1206, EnumToolRuby.RUBY).setUnlocalizedName("swordRuby");
    public static final Item pickaxeRuby = new ItemPickaxeRuby(1207, EnumToolRuby.RUBY).setUnlocalizedName("pickaxeRuby");
    public static final Item axeRuby = new ItemAxeRuby(1208, EnumToolRuby.RUBY).setUnlocalizedName("axeRuby");


    Here is the ItemToolRuby class (for pickaxe, axe and shovel):

    package net.minecraft.src;
    public class ItemToolRuby extends Item{
    
    private Block[] blocksEffectiveAgainst;
    protected float efficiencyOnProperMaterial = 4.0F;
    private int damageVsEntity;
    protected EnumToolRuby toolMaterial;
    protected ItemToolRuby(int par1, int par2, EnumToolRuby par3EnumToolMaterial, Block[] par4ArrayOfBlock){
    	 super(par1);
    	 this.toolMaterial = par3EnumToolMaterial;
    	 this.blocksEffectiveAgainst = par4ArrayOfBlock;
    	 this.maxStackSize = 1;
    	 this.setMaxDamage(par3EnumToolMaterial.getMaxUses());
    	 this.efficiencyOnProperMaterial = par3EnumToolMaterial.getEfficiencyOnProperMaterial();
    	 this.damageVsEntity = par2 + par3EnumToolMaterial.getDamageVsEntity();
    	 this.setCreativeTab(CreativeTabs.tabTools);
    }
    public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block){
    	 for (int var3 = 0; var3 < this.blocksEffectiveAgainst.length; ++var3){
    		 if (this.blocksEffectiveAgainst[var3] == par2Block){
    			 return this.efficiencyOnProperMaterial;
    		 }
    	 }
    	 return 1.0F;
    }
    public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving){
    	 par1ItemStack.damageItem(2, par3EntityLiving);
    	 return true;
    }
    public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving){
    	 if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D){
    		 par1ItemStack.damageItem(1, par7EntityLiving);
    	 }
    	 return true;
    }
    public int getDamageVsEntity(Entity par1Entity){
    	 return this.damageVsEntity;
    }
    public boolean isFull3D(){
    	 return true;
    }
    public int getItemEnchantability(){
    	 return this.toolMaterial.getEnchantability();
    }
    public String getToolMaterialName(){
    	 return this.toolMaterial.toString();
    }
    }


    Now the EnumToolRuby class:

    package net.minecraft.src;
    public enum EnumToolRuby{
    RUBY(3, 800, 8.0F, 10, 15);
    
    private final int harvestLevel;
    private final int maxUses;
    private final float efficiencyOnProperMaterial;
    private final int damageVsEntity;
    private final int enchantability;
    private EnumToolRuby(int par3, int par4, float par5, int par6, int par7){
    	 this.harvestLevel = par3;
    	 this.maxUses = par4;
    	 this.efficiencyOnProperMaterial = par5;
    	 this.damageVsEntity = par6;
    	 this.enchantability = par7;
    }
    public int getMaxUses(){
    	 return this.maxUses;
    }
    
    public float getEfficiencyOnProperMaterial(){
    	 return this.efficiencyOnProperMaterial;
    }
    public int getDamageVsEntity(){
    	 return this.damageVsEntity;
    }
    public int getHarvestLevel(){
    	 return this.harvestLevel;
    }
    
    public int getEnchantability(){
    	 return this.enchantability;
    }
    }


    Here are the individual codes for each of my tools:

    Pickaxe:

    package net.minecraft.src;
    public class ItemPickaxeRuby extends ItemToolRuby{
    
    private static Block[] blocksEffectiveAgainst = new Block[] {Block.cobblestone, Block.stoneDoubleSlab, Block.stoneSingleSlab, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockIron, 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, Block.railActivator};
    protected ItemPickaxeRuby(int par1, EnumToolRuby par2EnumToolMaterial){
    	 super(par1, 2, par2EnumToolMaterial, blocksEffectiveAgainst);
    }
    public boolean canHarvestBlock(Block par1Block){
    	 return par1Block == Block.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (par1Block != Block.blockDiamond && par1Block != Block.oreDiamond ? (par1Block != Block.oreEmerald && par1Block != Block.blockEmerald ? (par1Block != Block.blockGold && par1Block != Block.oreGold ? (par1Block != Block.blockIron && par1Block != Block.oreIron ? (par1Block != Block.blockLapis && par1Block != Block.oreLapis ? (par1Block != Block.oreRedstone && par1Block != Block.oreRedstoneGlowing ? (par1Block.blockMaterial == Material.rock ? true : (par1Block.blockMaterial == Material.iron ? true : par1Block.blockMaterial == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2);
    }
    public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block){
    	 return par2Block != null && (par2Block.blockMaterial == Material.iron || par2Block.blockMaterial == Material.anvil || par2Block.blockMaterial == Material.rock) ? this.efficiencyOnProperMaterial : super.getStrVsBlock(par1ItemStack, par2Block);
    }
    }


    Axe:

    package net.minecraft.src;
    public class ItemAxeRuby extends ItemToolRuby{
    
    private static Block[] blocksEffectiveAgainst = new Block[] {Block.planks, Block.bookShelf, Block.wood, Block.chest, Block.stoneDoubleSlab, Block.stoneSingleSlab, Block.pumpkin, Block.pumpkinLantern};
    protected ItemAxeRuby(int par1, EnumToolRuby par2EnumToolMaterial){
    	 super(par1, 3, par2EnumToolMaterial, blocksEffectiveAgainst);
    }
    public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block){
    	 return par2Block != null && (par2Block.blockMaterial == Material.wood || par2Block.blockMaterial == Material.plants || par2Block.blockMaterial == Material.vine) ? this.efficiencyOnProperMaterial : super.getStrVsBlock(par1ItemStack, par2Block);
    }
    }


    Sword:

    package net.minecraft.src;
    public class ItemSwordRuby extends Item{
    private int weaponDamage;
    private final EnumToolRuby toolRuby;
    public ItemSwordRuby(int par1, EnumToolRuby par2EnumToolRuby){
    	 super(par1);
    	 this.toolRuby = par2EnumToolRuby;
    	 this.maxStackSize = 1;
    	 this.setMaxDamage(par2EnumToolRuby.getMaxUses());
    	 this.setCreativeTab(CreativeTabs.tabCombat);
    	 this.weaponDamage = 4 + par2EnumToolRuby.getDamageVsEntity();
    }
    public int func_82803_g(){
    	 return this.toolRuby.getDamageVsEntity();
    }
    public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block){
    	 if (par2Block.blockID == Block.web.blockID){
    		 return 15.0F;
    	 } else {
    		 Material var3 = par2Block.blockMaterial;
    		 return var3 != Material.plants && var3 != Material.vine && var3 != Material.coral && var3 != Material.leaves && var3 != Material.pumpkin ? 1.0F : 1.5F;
    	 }
    }
    public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving){
    	 par1ItemStack.damageItem(1, par3EntityLiving);
    	 return true;
    }
    public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving){
    	 if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D){
    		 par1ItemStack.damageItem(2, par7EntityLiving);
    	 }
    	 return true;
    }
    public int getDamageVsEntity(Entity par1Entity){
    	 return this.weaponDamage;
    }
    public boolean isFull3D(){
    	 return true;
    }
    public EnumAction getItemUseAction(ItemStack par1ItemStack){
    	 return EnumAction.block;
    }
    
    public int getMaxItemUseDuration(ItemStack par1ItemStack){
    	 return 72000;
    }
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
    	 par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    	 return par1ItemStack;
    }
    public boolean canHarvestBlock(Block par1Block){
    	 return par1Block.blockID == Block.web.blockID;
    }
    public int getItemEnchantability(){
    	 return this.toolRuby.getEnchantability();
    }
    public String getToolRubyName(){
    	 return this.toolRuby.toString();
    }
    }


    Shovel:

    package net.minecraft.src;
    public class ItemSpadeRuby extends ItemToolRuby{
    
    private static Block[] blocksEffectiveAgainst = new Block[] {Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium};
    public ItemSpadeRuby(int par1, EnumToolRuby par2EnumToolMaterial){
    	 super(par1, 1, par2EnumToolMaterial, blocksEffectiveAgainst);
    }
    public boolean canHarvestBlock(Block par1Block){
    	 return par1Block == Block.snow ? true : par1Block == Block.blockSnow;
    }
    }


    Hoe:

    package net.minecraft.src;
    public class ItemHoeRuby extends Item{
    protected EnumToolRuby theToolMaterial;
    public ItemHoeRuby(int par1, EnumToolRuby par2EnumToolRuby){
    	 super(par1);
    	 this.theToolMaterial = par2EnumToolRuby;
    	 this.maxStackSize = 1;
    	 this.setMaxDamage(par2EnumToolRuby.getMaxUses());
    	 this.setCreativeTab(CreativeTabs.tabTools);
    }
    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10){
    	 if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)){
    		 return false;
    	 } else {
    		 int var11 = par3World.getBlockId(par4, par5, par6);
    		 int var12 = par3World.getBlockId(par4, par5 + 1, par6);
    		 if ((par7 == 0 || var12 != 0 || var11 != Block.grass.blockID) && var11 != Block.dirt.blockID){
    			 return false;
    		 } else {
    			 Block var13 = Block.tilledField;
    			 par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), var13.stepSound.getStepSound(), (var13.stepSound.getVolume() + 1.0F) / 2.0F, var13.stepSound.getPitch() * 0.8F);
    			 if (par3World.isRemote){
    				 return true;
    			 } else {
    				 par3World.setBlock(par4, par5, par6, var13.blockID);
    				 par1ItemStack.damageItem(1, par2EntityPlayer);
    				 return true;
    			 }
    		 }
    	 }
    }
    public boolean isFull3D(){
    	 return true;
    }
    public String func_77842_f(){
    	 return this.theToolMaterial.toString();
    }
    }


    You now have a full set of tools (they will appear in the tools tab except for the sword, which is in the combat tab)

    Adding a superflat preset: [1.6.2]

    Go to the file GuiFlatPresets.java and scroll down to the very bottom, and in the static with the presets add this:

    addPreset("Peak", Block.grass.blockID, BiomeGenBase.extremeHills, Arrays.asList(new String[] {"stronghold", "mineshaft", "dungeon"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Block.grass.blockID), new FlatLayerInfo(10, Block.dirt.blockID), new FlatLayerInfo(244, Block.stone.blockID), new FlatLayerInfo(1, Block.bedrock.blockID)});


    The string "Peak" is the name of the preset
    Block.grass.blockID is the item/block icon to display
    BiomeGenBase.extremeHills is the biome to make it

    Inside the array, you can write the structures you want to spawn, like "village", "decoration" or "dungeon".

    The line FlatLayerInfo(1, Block.grass.blockID) tells it to spawn 1 layer high of grass, above what follows.

    You should end up with 1 layer of grass on top of 10 layers of dirt, on top of 244 layers of stone on top of 1 layer of bedrock.

    Adding Block Metadata (sub-blocks): [1.6.2]

    First let's make the block and register it:

    public static final Block chalk = new BlockChalk(188).setHardness(1.0F).setResistance(1.0F);


    ModLoader.registerBlock(chalk);


    But wait, before you make the BlockChalk class, add this at the very bottom of your code after public string getVersion:

    static{
    Item.itemsList[chalk.blockID] = (new ItemMultiTextureTile(chalk.blockID - 256, chalk, BlockChalk.chalkType)).setUnlocalizedName("chalk");
    }


    This should define the textures for each sub-block

    Now add the BlockChalk class:

    package net.minecraft.src;
    
    import java.util.List;
    
    public class BlockChalk extends Block{
    
    public static final String[] chalkType = new String[] {"white", "moss", "hard"};
    public static final String[] chalkTextureTypes = new String[] {"chalk", "chalk_moss", "chalk_hard"};
    private Icon[] iconArray;
    
    public BlockChalk(int par1){
    	 super(par1, Material.rock);
    	 this.setCreativeTab(CreativeTabs.tabDecorations);
    }
    
    public Icon getIcon(int par1, int par2){
    	 if (par2 < 0 || par2 >= this.iconArray.length){
    		 par2 = 0;
    	 }
    
    	 return this.iconArray[par2];
    }
    
    public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List){
    	 par3List.add(new ItemStack(par1, 1, 0));
    	 par3List.add(new ItemStack(par1, 1, 1));
    	 par3List.add(new ItemStack(par1, 1, 2));
    }
    
    public void registerIcons(IconRegister par1IconRegister){
    	 this.iconArray = new Icon[chalkTextureTypes.length];
    	 for (int var2 = 0; var2 < this.iconArray.length; ++var2){
    		 this.iconArray[var2] = par1IconRegister.registerIcon(chalkTextureTypes[var2]);
    	 }
    }
    }


    The list chalkType defines each block
    The list chalkTextureTypes defines the textures (write in the unlocalized name for each block)

    For each sub block you want to add, add the name and texture in the lists and add another of these lines in the getSubBlocks

    par3List.add(new ItemStack(par1, 1, 2));


    Just change the third number to 3 and so on.

    Creating an instantly spawning structure: [1.6.2]

    We are going to make an insta-house, which spawns a house with one click. First let's create the insta-house block:

    public static final Block instaHouse = new BlockInstaHouse(189).setHardness(1.0F).setResistance(1.0F).setUnlocalizedName("instaHouse").setCreativeTab(CreativeTabs.tabDecorations);


    ModLoader.registerBlock(instaHouse);


    Then define the structure (goes with items and blocks):

    public static final InstaHouse instaHouseGen = new InstaHouse();


    Then add this void below public void getVersion:

    public static void generateInstaHouse(World world, Random random, int par2, int par3, int par4){
    instaHouseGen.generate(world, random, par2, par3, par4);
    }


    Now let's create the BlockInstaHouse class:

    package net.minecraft.src;
    import java.util.Random;
    public class BlockInstaHouse extends Block{
    
    public BlockInstaHouse(int par1){
    super(par1, Material.wood);
    }
    
    public int quantityDropped(int par1){
    	 return (1);
    }
    
    public int idDropped(int par1, Random par2Random, int par3){
    	 return mod_fun.instaHouse.blockID;
    }
    
    public void onBlockClicked(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer){
    mod_fun.generateInstaHouse(world, null, par2, par3, par4);
    }
    }


    The void:

    public void onBlockClicked(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer){
    mod_fun.generateInstaHouse(world, null, par2, par3, par4);
    }


    Tells it to spawn the structure when hit in survival or adventure mode. If you want to make it spawn with a right click instead, use the void

    public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9){
    mod_fun.generateInstaHouse(world, null, par2, par3, par4);
    return true;
    }


    Now the InstaHouse class:

    package net.minecraft.src;
    import java.util.Random;
    public class InstaHouse extends WorldGenerator{
    
    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5){
    	
    	 if(par1World.getBlockId(par3, par4, par5) == mod_fun.instaHouse.blockID){
    	
    	 par1World.setBlock(par3, par4, par5, Block.cobblestone.blockID);
    	 par1World.setBlock(par3, par4, par5 + 1, Block.cobblestone.blockID);
    	 par1World.setBlock(par3, par4, par5 - 1, Block.cobblestone.blockID);
    	 par1World.setBlock(par3 + 1, par4, par5 + 1, Block.cobblestone.blockID);
    	 par1World.setBlock(par3 - 1, par4, par5 + 1, Block.cobblestone.blockID);
    	 par1World.setBlock(par3 - 1, par4, par5 - 1, Block.cobblestone.blockID);
    	 par1World.setBlock(par3 + 1, par4, par5 - 1, Block.cobblestone.blockID);
    	 par1World.setBlock(par3 + 1, par4, par5, Block.cobblestone.blockID);
    	 par1World.setBlock(par3 - 1, par4, par5, Block.cobblestone.blockID); //
    	 par1World.setBlock(par3, par4 + 1, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3, par4 + 1, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 1, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3 - 1, par4 + 1, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3 - 1, par4 + 1, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 1, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 1, par5, Block.planks.blockID); //
    	 par1World.setBlock(par3, par4 + 2, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3, par4 + 2, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 2, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3 - 1, par4 + 2, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3 - 1, par4 + 2, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 2, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 2, par5, Block.planks.blockID); //
    	 par1World.setBlock(par3, par4 + 3, par5, Block.planks.blockID);
    	 par1World.setBlock(par3, par4 + 3, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3, par4 + 3, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 3, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3 - 1, par4 + 3, par5 + 1, Block.planks.blockID);
    	 par1World.setBlock(par3 - 1, par4 + 3, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 3, par5 - 1, Block.planks.blockID);
    	 par1World.setBlock(par3 + 1, par4 + 3, par5, Block.planks.blockID);
    	 par1World.setBlock(par3 - 1, par4 + 3, par5, Block.planks.blockID);
    	
    	 }
    	
    	 return true;
    }
    }


    This tells it where to place the blocks. You should have a small 3 x 4 x 3 house made of wood with a cobble floor. You are now able to spawn your structure. Here is a photo of the finished result:




    Upcoming Tutorials: Craftable Mobs, Custom Slabs, Textures that change over time, Custom furnace

    Recent updates: Gun code and armour code completed and updated and new tutorial: Adding textures

    Note: Risugami hasn't updated ModLoader to 1.6.4 yet, so please don't ask me to update this to 1.6.4 until ModLoader has been updated by Risugami.
    Posted in: Mapping and Modding Tutorials
  • 1

    posted a message on [1.6.2]ModLoader Tutorials
    Quote from elijahwasson

    The method func_111022_d(String) is undefined for the type Block


    please help


    You shouldn't have any errors at all, The only causes I can think of is that you are using a different version or forge. Try using
    .setBlockTextureName("r"); 

    instead. If you still get the error, I'm afraid I can't help you
    Posted in: Mapping and Modding Tutorials
  • 1

    posted a message on [1.6.2]ModLoader Tutorials
    Quote from SirPigman

    Hello!

    I have a problem when I try to use the .setPotionEffect. Eclipse marks it as an error and it says "The method setPotionEffect(String) in the type Item is not applicable for the arguments (int, int, int, float)" Here's my code for the item:
     public static final Item baconGolden = new ItemFood(9002, 10, 1.5F, true).setCreativeTab(CreativeTabs.tabFood).setPotionEffect(Potion.waterBreathing.id, 180, 0, 1.0F).setUnlocalizedName("goldenbacon"); 
    Help please?


    It's a general minecraft error, I'll add it to the tutorial:

    The .setPotionEffect must be straight after the ItemFood(), like so:

    public static final Item baconGolden = new ItemFood(9002, 10, 1.5F, true).setPotionEffect(Potion.waterBreathing.id, 180, 0, 1.0F).setCreativeTab(CreativeTabs.tabFood).setUnlocalizedName("goldenbacon");


    Instead of

    public static final Item baconGolden = new ItemFood(9002, 10, 1.5F, true).setCreativeTab(CreativeTabs.tabFood).setPotionEffect(Potion.waterBreathing.id, 180, 0, 1.0F).setUnlocalizedName("goldenbacon");
    Posted in: Mapping and Modding Tutorials
  • To post a comment, please or register a new account.