Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[ModLoader with MC 1.1] How to Make a Mod Tutorials


  • Please log in to reply
112 replies to this topic

#101

kevers
    kevers

    Tree Puncher

  • Members
  • 13 posts

Posted 02 April 2012 - 09:45 PM

ok so im trying to make a natuarly generated block i dont have any errors but it doesnt show in a new world

package net.minecraft.src;
import java.util.Random;



public class mod_Tutorial extends BaseMod
{
public static final Block TutorialBlock = new TutBlock(150, 0).setBlockName("TutBlock").setHardness(4F).setResistance(6F);

public static final Item TutorialItem = new Item(1000).setItemName("TutItem");

public void load()
{
ModLoader.registerBlock(TutorialBlock);

ModLoader.addName(TutorialBlock, "cool block");
ModLoader.addName(TutorialItem, "cool Item");

TutorialBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/Tutorial Block.png");
TutorialItem.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/Platnum.png");

ModLoader.addSmelting(mod_Tutorial.TutorialBlock.blockID, new ItemStack(TutorialItem, 1));

}


public void genertesurface(World world, Random rand, int baseX, int baseZ)
{

//Tutorial Block

for(int l = 0; l<50; l++)
{

int Xcoord = baseX +rand.nextInt(16);
int Ycoord = rand.nextInt(64);
int Zcoord = baseZ +rand.nextInt(16);

(new WorldGenMinable(TutorialBlock.blockID, 15)).generate(world, rand, Xcoord, Ycoord, Zcoord);

}

//end Tutorial Block

}


public String getVersion()
{
return"1.2.4";
}
}

Register or log in to remove.

#102

kevers
    kevers

    Tree Puncher

  • Members
  • 13 posts

Posted 03 April 2012 - 02:12 AM

okay, so i made a sword with my custom item (2 platinum and a stick) when ever i go to craft my platinum sword it just gives me 1 piece of the item platinum. some one please help me fix this problem, thank you.

#103

kevers
    kevers

    Tree Puncher

  • Members
  • 13 posts

Posted 03 April 2012 - 09:48 PM

ok so here is mod_Tutorial:


package net.minecraft.src;
import java.util.Random;

public class mod_Tutorial extends BaseMod
{

static
{


}


public static final Block TutorialBlock = new TutBlock(150, 0).setBlockName("TutBlock").setHardness(4F).setResistance(6F);

public static final Item TutorialItem = new Item(1000).setItemName("TutItem");

public void load()
{
ModLoader.registerBlock(TutorialBlock);

ModLoader.addName(TutorialBlock, "Platnum Ore");
ModLoader.addName(TutorialItem, "Platnum");

TutorialBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/Tutorial Block.png");
TutorialItem.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/Platnum.png");

ModLoader.addSmelting(mod_Tutorial.TutorialBlock.blockID, new ItemStack(TutorialItem, 1));

}

public void generateSurface(World world, Random rand, int baseX, int baseZ)
{

//Tutorial Block

for(int l = 0; l<15; l++)
{

int Xcoord = baseX +rand.nextInt(16);
int Ycoord = rand.nextInt(50);
int Zcoord = baseZ +rand.nextInt(16);

(new WorldGenMinable(TutorialBlock.blockID, 8)).generate(world, rand, Xcoord, Ycoord, Zcoord);

}

//end Tutorial Block

}


public String getVersion()
{
return"1.2.4";
}
}


here is TutBlock:


package net.minecraft.src;

import java.util.Random;

public class TutBlock extends Block
{
public TutBlock(int par1, int par2)
{
super(par1, par2, Material.rock);
}

/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return mod_Tutorial.TutorialBlock.blockID;
}
}


here is mod_PlatnumSword:


package net.minecraft.src;

public class mod_PlatnumSword extends BaseMod
{

public static Item PlatnumSword;

static
{

PlatnumSword = (new ItemSword(1000, EnumToolMaterial.PLATNUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/mods/PlatnumSword.png")).setItemName("Platnum Sword");

}


public mod_PlatnumSword()
{

ModLoader.addName(PlatnumSword, "Platnum Sword");

ModLoader.addRecipe(new ItemStack(PlatnumSword, 1), new Object[]
{
" P ", " P ", " S ", Character.valueOf('P'), mod_Tutorial.TutorialItem, Character.valueOf('S'), Item.stick
});

}

public void load()
{

#104

ejotus
    ejotus

    Newly Spawned

  • Members
  • 1 posts

Posted 06 April 2012 - 06:35 PM

Ore is not randomly generating..i dont get crashes, just cant find it. the crafting works right tho hers da code


package net.minecraft.src;
import java.util.Random;

public class mod_gems extends BaseMod
{
  
    public static Item EmeraldGem;
  
    public static final Block Emerald;
  
    static
    {
      
        Emerald = (new BlockEmerald(135, ModLoader.addOverride("/terrain.png", "/mods/Emerald.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("EmeraldOre"));
      
        EmeraldGem = (new Item(180)).setIconCoord(9, 11).setItemName("Emerald");
    }
  
  

  
  
    public void load()
    {
      
    }
        public mod_gems()
        {
          
            ModLoader.addName(EmeraldGem, "Emerald");
          
            ModLoader.registerBlock(Emerald);
            ModLoader.addName(Emerald, "Emerald Ore");
            ModLoader.addRecipe(new ItemStack(mod_gems.Emerald, 1), new Object[]
                {
                "XX", "XX", Character.valueOf('X'), Item.diamond   
             });
    }
  
    public void GenerateSurface(World world, Random rand, int chunkx, int chunkz)
    {
      
      
        for(int l=0; l<90; l++)
        {
          
        int i1 = chunkx +rand.nextInt(16);
        int j1 = rand.nextInt(100);
        int k1 = chunkz + rand.nextInt(16);
      
        (new WorldGenMinable(Emerald.blockID, 90)).generate(world, rand, i1, j1, k1);
          
        }
      
      
      
    }
  
  
  
    public String getversion()
    {
        return "gems v1";
    }}
  

  
      
  


  
  


PLZ HALP

#105

Benster198

Posted 07 April 2012 - 10:16 PM

I love your tutorials i think they are great i have made some tools but can only craft sword and spade (cant craft pickaxe, hoe and an axe) i don't know what the problem is i have tried re-coding the the recipes so they are in a vertical column but cant seem to extend them horizontally can you help and do you need my code? thanks

#106

Conan
    Conan

    Out of the Water

  • Members
  • 6 posts

Posted 08 April 2012 - 11:30 PM

java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 9999
at net.minecraft.src.Block.<init>(Block.java:230)
at net.minecraft.src.Block.<init>(Block.java:267)
at net.minecraft.src.BlockStone.<init>(BlockStone.java:9)
at net.minecraft.src.BlockAdamantite.<init>(BlockAdamantite.java:11)
at net.minecraft.src.mod_AdamCraft.<clinit>(mod_AdamCraft.java:12)
... 15 more

View PostConan, on 08 April 2012 - 11:29 PM, said:

java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 9999
at net.minecraft.src.Block.<init>(Block.java:230)
at net.minecraft.src.Block.<init>(Block.java:267)
at net.minecraft.src.BlockStone.<init>(BlockStone.java:9)
at net.minecraft.src.BlockAdamantite.<init>(BlockAdamantite.java:11)
at net.minecraft.src.mod_AdamCraft.<clinit>(mod_AdamCraft.java:12)
... 15 more

My Code
package net.minecraft.src;
import java.util.Random;
public class mod_AdamCraft extends BaseMod
{

public static final Block Adamantite;


static
{

Adamantite = (new BlockAdamantite(9999, ModLoader.addOverride("/terrain.png", "/mods/Adamantite.png"))).setHardness(3F).setResistance(3F).setStepSound(Block.soundStoneFootstep).setBlockName("Adamantite");

}

public mod_AdamCraft()
{

ModLoader.registerBlock(Adamantite);
ModLoader.addName(Adamantite, "Adamantite Ore");

}

public void load()
{


}

public void generateSurface(World world, Random rand, int chunkx, int chunkz)
{
//Adamantite Starting

for(int l = 0; l<30; l++)
{

int i1 = chunkx +rand.nextInt(16);
int j1 = rand.nextInt(70);
int k1 = chunkz + rand.nextInt(16);

(new WorldGenMinable(Adamantite.blockID, 40)).generate(world, rand, i1, j1, k1);

}

//ending

}

public String getVersion()
{

return "Minecraft 1.2.5 mod";

}

}

#107

SkateGuy2000
  • Location: The End
  • Minecraft: SkateGuy2000

Posted 10 April 2012 - 03:00 PM

hey how do you make it so that a block drops itself when mined?

#108

SkateGuy2000
  • Location: The End
  • Minecraft: SkateGuy2000

Posted 10 April 2012 - 03:13 PM

hey it gives me this error:

== MCP 6.2 (data: 6.2, client: 1.2.5, server: 1.2.5) ==
# found jad, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs, pa
ram csvs, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files\Java\jdk1.7.0_03\bin\javac" -Xlint:-options -deprecation -g -
source 1.6 -target 1....' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_BlackMetal.java:11: error: ';' expected
				BlackMetalOre = (new BlockBlackMetalOre(300, ModLoader.addOverri
de("/terrain.png", "/blackmetal/ore.png"))).setHardness(5F).setResistance(9F)Bla
ckMetalOre.setStepSound(Block.soundStoneFootstep).setBlockName("blackmetalOre");

1 error
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .

this is my code:
package net.minecraft.src;
public class mod_BlackMetal extends BaseMod
{

public static final Block BlackMetalOre;

static
{

  BlackMetalOre = (new BlockBlackMetalOre(300, ModLoader.addOverride("/terrain.png", "/blackmetal/ore.png"))).setHardness(5F).setResistance(9F)BlackMetalOre.setStepSound(Block.soundStoneFootstep).setBlockName("blackmetalOre");

}

public mod_BlackMetal()
{



}

public void load()
{



}

public String getVersion()
{

  return "MineCraft 1.2.5";

}

}


#109

Conan
    Conan

    Out of the Water

  • Members
  • 6 posts

Posted 11 April 2012 - 12:51 AM

View PostSkateGuy2000, on 10 April 2012 - 03:00 PM, said:

hey how do you make it so that a block drops itself when mined?

mod_modname.Blockname.blockID

#110

zigrass
    zigrass

    Out of the Water

  • Members
  • 8 posts

Posted 11 April 2012 - 06:13 PM

dont generate says no erros





package


net.minecraft.src;
import


java.util.Random;

public


class mod_Reddiamondore
{

public static final Block Reddiamondore;



static
{

Reddiamondore = (new BlockReddiamond(1005, ModLoader.addOverride("/terrain.png", "/gui/Reddiamondore.png"))).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("Reddiamondore");

}


public void GenerateSurface(World world, Random rand, int chunkx, int chunkz)
{

for(int l = 0; l< 45; l++)
{


int i1 = chunkx + rand.nextInt(16);

int j1 = rand.nextInt(65);

int k1 = chunkz + rand.nextInt(16);

(
new WorldGenMinable(Reddiamondore.blockID, 20)).generate(world, rand, i1, j1, k1);

}
}


public mod_Reddiamondore()
{

}


public void load()
{

}


public String getVersion()
{

return "1.2.5";
}
}




it starting the game with no errors but i cant find any ors i have seach VERY long time?!

View Postzigrass, on 11 April 2012 - 06:09 PM, said:

dont generate says no erros





package


net.minecraft.src;
import


java.util.Random;

public


class mod_Reddiamondore
{

public static final Block Reddiamondore;



static
{

Reddiamondore = (new BlockReddiamond(1005, ModLoader.addOverride("/terrain.png", "/gui/Reddiamondore.png"))).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("Reddiamondore");

}


public void GenerateSurface(World world, Random rand, int chunkx, int chunkz)
{

for(int l = 0; l< 45; l++)
{


int i1 = chunkx + rand.nextInt(16);

int j1 = rand.nextInt(65);

int k1 = chunkz + rand.nextInt(16);

(
new WorldGenMinable(Reddiamondore.blockID, 20)).generate(world, rand, i1, j1, k1);

}
}


public mod_Reddiamondore()
{

}


public void load()
{

}


public String getVersion()
{

return "1.2.5";
}
}




it starting the game with no errors but i cant find any ors i have seach VERY long time?!

heres the blockreddiamond file

package


net.minecraft.src;

import


java.util.Random;

public


class BlockReddiamond extends BlockStone
{


public BlockReddiamond(int i, int j)
{

super (i, j);
}


public int quantityDropped(Random random)
{

return 1;
}


public int idDropped(int i, Random random, int j)
{

return mod_Reddiamond.ReddiamondItem.shiftedIndex;
}

}

#111

icestroge

Posted 05 May 2012 - 06:12 PM

Could you do somthing on armour Posted Image

#112

ylebouth
    ylebouth

    Tree Puncher

  • Members
  • 18 posts

Posted 10 May 2012 - 09:10 PM

View Postejotus, on 06 April 2012 - 06:35 PM, said:

Ore is not randomly generating..i dont get crashes, just cant find it. the crafting works right tho hers da code


package net.minecraft.src;
import java.util.Random;

public class mod_gems extends BaseMod
{
  
public static Item EmeraldGem;
  
public static final Block Emerald;
  
static
{
  
Emerald = (new BlockEmerald(135, ModLoader.addOverride("/terrain.png", "/mods/Emerald.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("EmeraldOre"));
  
EmeraldGem = (new Item(180)).setIconCoord(9, 11).setItemName("Emerald");
}
  
  

  
  
public void load()
{
  
}
public mod_gems()
{
  
ModLoader.addName(EmeraldGem, "Emerald");
  
ModLoader.registerBlock(Emerald);
ModLoader.addName(Emerald, "Emerald Ore");
ModLoader.addRecipe(new ItemStack(mod_gems.Emerald, 1), new Object[]
   {
   "XX", "XX", Character.valueOf('X'), Item.diamond   
});
}
  
public void GenerateSurface(World world, Random rand, int chunkx, int chunkz)
{
  
  
for(int l=0; l<90; l++)
{
  
int i1 = chunkx +rand.nextInt(16);
int j1 = rand.nextInt(100);
int k1 = chunkz + rand.nextInt(16);
  
(new WorldGenMinable(Emerald.blockID, 90)).generate(world, rand, i1, j1, k1);
  
}
  
  
  
}
  
  
  
public String getversion()
{
return "gems v1";
}}
  

  
  
  


  
  


PLZ HALP

Just change GenerateSurface to generateSurface. It sould work fine  Posted Image

#113

Mayvrn
    Mayvrn

    Tree Puncher

  • Members
  • 10 posts

Posted 02 July 2012 - 03:50 AM

View PostClient444, on 29 February 2012 - 01:53 PM, said:

I fixed it. Now, are you ever going to try to do a GUI tutorial?

How did you fix it? I'm having the same problem, I've viewed many tutorials, but can't find out what is wrong.