Hi guys, can anyone explain how can I use my own blocks to be the "dirt" of my Biome? I mean, I already know the method and how to use it, but I get an error when use my own blocks.
When: Block.dirt.blockID => Working
When: mod_MyMod.MyBlock.blockID => Crashing
I also know that some blocks can't be filler blocks and etc, but my custom blocks don't have any special feature.
Hi guys, can anyone explain how can I use my own blocks to be the "dirt" of my Biome? I mean, I already know the method and how to use it, but I get an error when use my own blocks.
When: Block.dirt.blockID => Working
When: mod_MyMod.MyBlock.blockID => Crashing
I also know that some blocks can't be filler blocks and etc, but my custom blocks don't have any special feature.
The most likely reason that your game is crashing is due to your block ID. Make sure it is below 127 for terrain gen.
package net.minecraft.src;
import java.util.Random;
import java.util.List;
import net.minecraft.client.Minecraft;
import java.util.*;
public class mod_CrazyWorld extends BaseMod
{
public static final BiomeGenBase Vjungle = new BiomeGenVjungle(30).setColor(0xFFCCCC).setBiomeName("Vjungle");
public static final Block SalGrass = new BlockSalmonGrass(150).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("salgrass");
public static int SalGrassBottom = ModLoader.addOverride("/terrain.png", "/modblocks/salbottom.png");
public static int SalGrassTop = ModLoader.addOverride("/terrain.png", "/modblocks/saltop.png");
public static int SalGrassSides = ModLoader.addOverride("/terrain.png", "/modblocks/salside.png");
public static final Block SalDirt = new BlockSalmonDirt(151, 0).setHardness(0.5F).setStepSound(soundGrassFootstep).setBlockName("saldirt");
public void load()
{
SalDirt.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/modblocks/saldirt.png");
ModLoader.addBiome(Vjungle);
world = ModLoader.getMinecraftInstance().theWorld;
ModLoader.addName(SalDirt, "Salmon Dirt");
ModLoader.addName(SalGrass, "Salmon Grass");
}
public String getVersion()
{
return "1.2.5";
}
}
Well I see a couple of things that I believe need to be fixed..
First this line,
public static final Block SalGrass = new BlockSalmonGrass(150)
If this is a custom block, which it looks to be, you need both your block id AND your texture coord id. in your case you only have your block id as 150, which can not be used for world gen. So yours should look something like this instead
public static final Block SalGrass = new BlockSalmonGrass(127,0)
Notice I changed the id from 150 to 127, and added the texture coord of 0, which tells MC that you are not using the texture atlas map, but your own custom texture.
The second part, very similar to the first
public static final Block SalDirt = new BlockSalmonDirt(151, 0)
Your block id must be below 151. There is a technical reason for this, which was mentioned in this thread a long time ago, but I have forgotten the answer. Techguy would know.
Anyhow, those are the most obvious things that I see. Let it be known though that I am quite new to modding and programming, so there may be other issues at work.
The first block is fine, I didn't put the coord because it is a multi texture block, so the second number is not needed. My custom block is working normally when I turn the Biome's lines into commentaries.
As I said, I tried your recomendation about change the ID numbers to 127 below, but didn't work, and personally I think that any number ID available for blocks can be used since new blocks are usually being added in vanilla version. Eventually the ID 127 will be used (I think ID 123~124 is already being used).
I saw your code and mine is not different :\ since you said that your custom block is generating the Biome normally, I'm probably missing something.
The error report
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) 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(Unknown Source) Caused by: java.lang.NullPointerException at net.minecraft.src.BiomeGenVjungle.<init>(BiomeGenVjungle.java:20) at net.minecraft.src.mod_CrazyWorld.<clinit>(mod_CrazyWorld.java:21) ... 15 more --- END ERROR REPORT 385accf8 ----------
Edit: Oh, by the way, how can I use the proper eclipse format in forum?
Custom blocks will indeed work by themselves with higher block ids. But used as biome gen they won't. This is a fact. A lesson I learned myself having the game crash when it attempted to load my custom biome.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Hey Tech Guy,
Do you know of anywhere that explains how the textures of new mobs I would make work? Because it just gave me the white cube even when I told it where the picture was.
Hey Tech Guy,
Do you know of anywhere that explains how the textures of new mobs I would make work? Because it just gave me the white cube even when I told it where the picture was.
Did you add the renderer? Have a look at the tutorials on the OP if you don't know what I mean.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Me -> !! Thanks so much, you just saved me years of generation coding for my mod. I have now witnessed a miracle!
Yeah, I was like that before because I watched TheInstitution's videos and your tutorial about generating stuff and **** just blow my head. Then I found it in the Modding Discussion. :)))) I was getting errors first with those chunkX and Y because they are different in my code but I figured it out.
Im working on a mod that adds tools to the game and i also wanted to make a special stick to use in stead of normal wooden sticks but i cant figure out how to add sticks without changing the Items.java file. does any one know how to do this??
Greetz Zero
Just make a new item?
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Thanks, you fixed those error*S*, but now I have an erro*R*.Sorryto bother you with that problem all the time It says:
error: constructor WorldGenFlowers in class WorldGenFlowers cannot be applied to given types;
WorldGenFlowers worldgenflowers = new WorldGenFlowers();
(arrow pointing towards "n" in "new")
required: int
found: no arguments
reason: actual and formal argument lists differ in length
1 error
Add a the block you want to generate inside the brackets after WorldGenFlowers. Example:
(new WorldGenFlower(Peat.blockID)).generate(world, random, randPosX, randPosY, randPosZ);
Hmm yeah i figured as much. im trying this right now but i dont know what to place at int i ?
public ItemNetherStick(int i)
im sorry im fairly new to this so im not sure
You keep it the same.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
I have a problem I have spent the last 4 hours trying to fix!
My mod I am done with it I recompiled the files then re-obfuscation it then I put the files into minecraft.jar along with the modloader I start mc i do the recipe and nothing happens! please help code for my main file is below but it didn't bring any errors at all:
package net.minecraft.src;
import java.util.Random;
public class mod_DarkMatter
{
public static final Block darkmatterOre = new BlockDarkMatterOre(2007, 0).setHardness(9.0F).setResistance(5.0F).setBlockName("darkmatterOre");
public static final Block darkmatterBlock = new BlockDarkMatter(2008, 0).setHardness(1.5F).setResistance(5.0F).setBlockName("darkmatterBlock");
public static final Item darkmatterItem = new Item(2000).setItemName("darkmatterItem");
public static final Item darkmatterPick = new ItemPickaxe(2001, EnumToolMaterial.DM).setItemName("darkmatterPick");
public static final Item darkmatterShovel = new ItemSpade(2002, EnumToolMaterial.DM).setItemName("darkmatterShovel");
public static final Item darkmatterAxe = new ItemAxe(2003, EnumToolMaterial.DM).setItemName("darkmatterAxe");
public static final Item darkmatterHoe = new ItemHoe(2004, EnumToolMaterial.DM).setItemName("darkmatterHoe");
public static final Item darkmatterSword = new ItemSword(2005, EnumToolMaterial.DM).setItemName("darkmatterSword");
public void load()
{
darkmatterOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod_DarkMatter/darkmatterore.png");
darkmatterBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod_DarkMatter/darkmatterblock.png");
darkmatterItem.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmatteritem.png");
darkmatterPick.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmatterpick.png");
darkmatterShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmattershovel.png");
darkmatterAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmatteraxe.png");
darkmatterHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmatterhoe.png");
darkmatterSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmattersword.png");
ModLoader.registerBlock(darkmatterOre);
ModLoader.registerBlock(darkmatterBlock);
ModLoader.addName(darkmatterOre, "Darkmatter Ore");
ModLoader.addName(darkmatterBlock, "Darkmatter Block");
ModLoader.addName(darkmatterItem, "Darkmatter");
ModLoader.addName(darkmatterPick, "Darkmatter Pickaxe");
ModLoader.addName(darkmatterShovel, "Darkmatter Shovel");
ModLoader.addName(darkmatterAxe, "Darkmatter Axe");
ModLoader.addName(darkmatterHoe, "Darkmatter Hoe");
ModLoader.addName(darkmatterSword, "Darkmatter Sword");
ModLoader.addRecipe(new ItemStack(darkmatterItem, 9), new Object[] {
"X", Character.valueOf('X'), darkmatterBlock });
ModLoader.addRecipe(new ItemStack(darkmatterBlock, 1), new Object[] {
"XXX", "XXX", "XXX", Character.valueOf('X'), darkmatterItem });
ModLoader.addRecipe(new ItemStack(darkmatterPick, 1), new Object[] {
"XXX", " | ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick });
ModLoader.addRecipe(new ItemStack(darkmatterShovel, 1), new Object[] {
" X ", " | ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick });
ModLoader.addRecipe(new ItemStack(darkmatterAxe, 1), new Object[] {
"XX ", "X| ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick });
ModLoader.addRecipe(new ItemStack(darkmatterHoe, 1), new Object[] {
"XX ", " | ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick });
ModLoader.addRecipe(new ItemStack(darkmatterSword, 1), new Object[] {
" X ", " X ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick });
ModLoader.addRecipe(new ItemStack(darkmatterBlock, 1), new Object[] {
"XX ", "XX ", " ", Character.valueOf('X'), Block.dirt });
}
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for (int i = 0; i < 6; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(16);
new WorldGenMinable(darkmatterOre.blockID, 2007).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
public String Version()
{
return "1.2.5";
}
}
Rollback Post to RevisionRollBack
Web Developer/Modder/Software Developer/App Developer PM if interested.
Bro... You're so awesome. All the other tutorials it's just "Do this and this will happen!" But you tell us why it will happen, and how to fully edit the variables. Thanks man, you just made my day (In the good way)
package net.minecraft.src;
import java.util.Random;
public class mod_Testium extends BaseMod
{
public static final Block testiumore = new Blocktestium(180,0).setHardness(3F).setResistance(5F).setLightValue(0.6F).setBlockName("testore");
public static final Item testingot = new Testiumingot(181).setItemName("testbar");
public static final Item testiumpickaxe = new TestiumPickaxe(182, EnumToolMaterial.TESTIUM).setItemName("testpickaxe");
public mod_Testium(){
//Block
ModLoader.registerBlock(testiumore);
ModLoader.addName(testiumore,"Testium Ore");
testiumore.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/testiumore.png");
}
{
//Ingot
testingot.iconIndex = ModLoader.addOverride("/gui/items.png", "/testiumingot.png");
ModLoader.addName(testingot, "Testium Ingot");
ModLoader.addSmelting(testiumore.blockID, new ItemStack(testingot, 1));
}
{
//Pickaxe
{
testiumpickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/testiumpickaxe.png");}
ModLoader.addName(testiumpickaxe, "Testium Pickaxe");
ModLoader.addRecipe(new ItemStack(testiumpickaxe, 1), new Object []
{"###", " X ", " X ", Character.valueOf('#'), testingot, Character.valueOf('X'), Item.stick});}
public void generateSurface(World world, Random random, int baseX, int baseZ)
{
for(int x = 0; x < 15; x++ )
{
int Xcoord = baseX + random.nextInt(5);
int Ycoord = random.nextInt(70);
int Zcoord = baseZ + random.nextInt(5);
(new WorldGenMinable(testiumore.blockID, 12)).generate(world, random, Xcoord, Ycoord, Zcoord);
}
}
public void load(){};
public String getVersion()
{
return "1.2.5";
}
}
and my error code
Mods loaded: 1
ModLoader 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 9f578458 --------
Generated 5/15/12 4:29 PM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_04, Oracle Corporation
VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: ATI Radeon HD 3450 version 2.1.8781, ATI Technologies Inc.
java.lang.NullPointerException
at net.minecraft.src.mod_Testium.<init>(mod_Testium.java:32)
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)
--- END ERROR REPORT 859adabd ----------
I am tryong to make a new block and if i follow the tutorial(using eclipse) and then i look at another block they dont look the same. This is what i did when i changed a stone block. Thanks for the help and one more thing what do you do after you make a new java file in src?
Heres the code i chanded from the stone block.
package net.minecraft.src;
import java.util.Random;
public class BlockBunker extends Block
{
public BlockBunker(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 Block.cobblestone.blockID;
Rollback Post to RevisionRollBack
Translation from Spanish: Like a boss!
To post a comment, please login or register a new account.
Nah. I've been using Schematic to Java program which converts a schematic file to java file. Here.
When: Block.dirt.blockID => Working
When: mod_MyMod.MyBlock.blockID => Crashing
I also know that some blocks can't be filler blocks and etc, but my custom blocks don't have any special feature.
The most likely reason that your game is crashing is due to your block ID. Make sure it is below 127 for terrain gen.
Post your full code and we may be able to assist you more accurately.
package net.minecraft.src; import java.util.Random; import java.util.List; import net.minecraft.client.Minecraft; import java.util.*; public class mod_CrazyWorld extends BaseMod { public static final BiomeGenBase Vjungle = new BiomeGenVjungle(30).setColor(0xFFCCCC).setBiomeName("Vjungle"); public static final Block SalGrass = new BlockSalmonGrass(150).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("salgrass"); public static int SalGrassBottom = ModLoader.addOverride("/terrain.png", "/modblocks/salbottom.png"); public static int SalGrassTop = ModLoader.addOverride("/terrain.png", "/modblocks/saltop.png"); public static int SalGrassSides = ModLoader.addOverride("/terrain.png", "/modblocks/salside.png"); public static final Block SalDirt = new BlockSalmonDirt(151, 0).setHardness(0.5F).setStepSound(soundGrassFootstep).setBlockName("saldirt"); public void load() { SalDirt.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/modblocks/saldirt.png"); ModLoader.addBiome(Vjungle); world = ModLoader.getMinecraftInstance().theWorld; ModLoader.addName(SalDirt, "Salmon Dirt"); ModLoader.addName(SalGrass, "Salmon Grass"); } public String getVersion() { return "1.2.5"; } }And my BiomeGen*** class
package net.minecraft.src; import java.util.List; import java.util.Random; public class BiomeGenVjungle extends BiomeGenBase { public BiomeGenVjungle (int par1) { super(par1); biomeDecorator.treesPerChunk = 5; biomeDecorator.grassPerChunk = 5; biomeDecorator.flowersPerChunk = 5; biomeDecorator.cactiPerChunk = 5; spawnableCreatureList.clear(); spawnableMonsterList.clear(); spawnableCreatureList.add(new SpawnListEntry(net.minecraft.src.EntityWolf.class, 6, 3, 3)); spawnableMonsterList.add(new SpawnListEntry(net.minecraft.src.EntityOcelot.class, 6, 3, 3)); spawnableCreatureList.add(new SpawnListEntry(net.minecraft.src.EntityChicken.class, 6, 3, 3)); waterColorMultiplier = 0xFFCCCC; topBlock = (byte)mod_CrazyWorld.SalGrass.blockID; fillerBlock = (byte)mod_CrazyWorld.SalDirt.blockID; } public WorldGenerator getRandomWorldGenForTrees(Random par1Random) { if (par1Random.nextInt(5) == 0) { return worldGenForest; } if (par1Random.nextInt(10) == 0) { return worldGenBigTree; } else { return worldGenTrees; } } public WorldGenerator func_48410_b(Random par1Random) { if (par1Random.nextInt(4) == 0) { return new WorldGenTallGrass(Block.tallGrass.blockID, 2); } else { return new WorldGenTallGrass(Block.tallGrass.blockID, 1); } } }First this line,
If this is a custom block, which it looks to be, you need both your block id AND your texture coord id. in your case you only have your block id as 150, which can not be used for world gen. So yours should look something like this instead
Notice I changed the id from 150 to 127, and added the texture coord of 0, which tells MC that you are not using the texture atlas map, but your own custom texture.
The second part, very similar to the first
Your block id must be below 151. There is a technical reason for this, which was mentioned in this thread a long time ago, but I have forgotten the answer. Techguy would know.
Anyhow, those are the most obvious things that I see. Let it be known though that I am quite new to modding and programming, so there may be other issues at work.
As I said, I tried your recomendation about change the ID numbers to 127 below, but didn't work, and personally I think that any number ID available for blocks can be used since new blocks are usually being added in vanilla version. Eventually the ID 127 will be used (I think ID 123~124 is already being used).
I saw your code and mine is not different :\ since you said that your custom block is generating the Biome normally, I'm probably missing something.
The error report
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
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(Unknown Source)
Caused by: java.lang.NullPointerException
at net.minecraft.src.BiomeGenVjungle.<init>(BiomeGenVjungle.java:20)
at net.minecraft.src.mod_CrazyWorld.<clinit>(mod_CrazyWorld.java:21)
... 15 more
--- END ERROR REPORT 385accf8 ----------
Edit: Oh, by the way, how can I use the proper eclipse format in forum?
Me ->
together they are powerful beyond imagination."
Do you know of anywhere that explains how the textures of new mobs I would make work? Because it just gave me the white cube even when I told it where the picture was.
Did you add the renderer? Have a look at the tutorials on the OP if you don't know what I mean.
together they are powerful beyond imagination."
I did, I was looking for the differences of your code to mine because mine works fine. I have managed to find it:
You need to change the i and j arguments to those of the method, which are chunkX and chunkZ. Also remove the d at the end.
I know it was a problem with the tutorial, which I have now fixed.
together they are powerful beyond imagination."
Yeah, I was like that before because I watched TheInstitution's videos and your tutorial about generating stuff and **** just blow my head. Then I found it in the Modding Discussion. :)))) I was getting errors first with those chunkX and Y because they are different in my code but I figured it out.
Just make a new item?
together they are powerful beyond imagination."
Add a the block you want to generate inside the brackets after WorldGenFlowers. Example:
Thanks
You keep it the same.
together they are powerful beyond imagination."
I have a problem I have spent the last 4 hours trying to fix!
My mod I am done with it I recompiled the files then re-obfuscation it then I put the files into minecraft.jar along with the modloader I start mc i do the recipe and nothing happens! please help code for my main file is below but it didn't bring any errors at all:
package net.minecraft.src; import java.util.Random; public class mod_DarkMatter { public static final Block darkmatterOre = new BlockDarkMatterOre(2007, 0).setHardness(9.0F).setResistance(5.0F).setBlockName("darkmatterOre"); public static final Block darkmatterBlock = new BlockDarkMatter(2008, 0).setHardness(1.5F).setResistance(5.0F).setBlockName("darkmatterBlock"); public static final Item darkmatterItem = new Item(2000).setItemName("darkmatterItem"); public static final Item darkmatterPick = new ItemPickaxe(2001, EnumToolMaterial.DM).setItemName("darkmatterPick"); public static final Item darkmatterShovel = new ItemSpade(2002, EnumToolMaterial.DM).setItemName("darkmatterShovel"); public static final Item darkmatterAxe = new ItemAxe(2003, EnumToolMaterial.DM).setItemName("darkmatterAxe"); public static final Item darkmatterHoe = new ItemHoe(2004, EnumToolMaterial.DM).setItemName("darkmatterHoe"); public static final Item darkmatterSword = new ItemSword(2005, EnumToolMaterial.DM).setItemName("darkmatterSword"); public void load() { darkmatterOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod_DarkMatter/darkmatterore.png"); darkmatterBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mod_DarkMatter/darkmatterblock.png"); darkmatterItem.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmatteritem.png"); darkmatterPick.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmatterpick.png"); darkmatterShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmattershovel.png"); darkmatterAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmatteraxe.png"); darkmatterHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmatterhoe.png"); darkmatterSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/mod_DarkMatter/darkmattersword.png"); ModLoader.registerBlock(darkmatterOre); ModLoader.registerBlock(darkmatterBlock); ModLoader.addName(darkmatterOre, "Darkmatter Ore"); ModLoader.addName(darkmatterBlock, "Darkmatter Block"); ModLoader.addName(darkmatterItem, "Darkmatter"); ModLoader.addName(darkmatterPick, "Darkmatter Pickaxe"); ModLoader.addName(darkmatterShovel, "Darkmatter Shovel"); ModLoader.addName(darkmatterAxe, "Darkmatter Axe"); ModLoader.addName(darkmatterHoe, "Darkmatter Hoe"); ModLoader.addName(darkmatterSword, "Darkmatter Sword"); ModLoader.addRecipe(new ItemStack(darkmatterItem, 9), new Object[] { "X", Character.valueOf('X'), darkmatterBlock }); ModLoader.addRecipe(new ItemStack(darkmatterBlock, 1), new Object[] { "XXX", "XXX", "XXX", Character.valueOf('X'), darkmatterItem }); ModLoader.addRecipe(new ItemStack(darkmatterPick, 1), new Object[] { "XXX", " | ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick }); ModLoader.addRecipe(new ItemStack(darkmatterShovel, 1), new Object[] { " X ", " | ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick }); ModLoader.addRecipe(new ItemStack(darkmatterAxe, 1), new Object[] { "XX ", "X| ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick }); ModLoader.addRecipe(new ItemStack(darkmatterHoe, 1), new Object[] { "XX ", " | ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick }); ModLoader.addRecipe(new ItemStack(darkmatterSword, 1), new Object[] { " X ", " X ", " | ", Character.valueOf('X'), darkmatterItem, Character.valueOf('|'), Item.stick }); ModLoader.addRecipe(new ItemStack(darkmatterBlock, 1), new Object[] { "XX ", "XX ", " ", Character.valueOf('X'), Block.dirt }); } public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ) { for (int i = 0; i < 6; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(128); int randPosZ = chunkZ + rand.nextInt(16); new WorldGenMinable(darkmatterOre.blockID, 2007).generate(world, rand, randPosX, randPosY, randPosZ); } } public String Version() { return "1.2.5"; } }package net.minecraft.src; import java.util.Random; public class mod_Testium extends BaseMod { public static final Block testiumore = new Blocktestium(180,0).setHardness(3F).setResistance(5F).setLightValue(0.6F).setBlockName("testore"); public static final Item testingot = new Testiumingot(181).setItemName("testbar"); public static final Item testiumpickaxe = new TestiumPickaxe(182, EnumToolMaterial.TESTIUM).setItemName("testpickaxe"); public mod_Testium(){ //Block ModLoader.registerBlock(testiumore); ModLoader.addName(testiumore,"Testium Ore"); testiumore.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/testiumore.png"); } { //Ingot testingot.iconIndex = ModLoader.addOverride("/gui/items.png", "/testiumingot.png"); ModLoader.addName(testingot, "Testium Ingot"); ModLoader.addSmelting(testiumore.blockID, new ItemStack(testingot, 1)); } { //Pickaxe { testiumpickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/testiumpickaxe.png");} ModLoader.addName(testiumpickaxe, "Testium Pickaxe"); ModLoader.addRecipe(new ItemStack(testiumpickaxe, 1), new Object [] {"###", " X ", " X ", Character.valueOf('#'), testingot, Character.valueOf('X'), Item.stick});} public void generateSurface(World world, Random random, int baseX, int baseZ) { for(int x = 0; x < 15; x++ ) { int Xcoord = baseX + random.nextInt(5); int Ycoord = random.nextInt(70); int Zcoord = baseZ + random.nextInt(5); (new WorldGenMinable(testiumore.blockID, 12)).generate(world, random, Xcoord, Ycoord, Zcoord); } } public void load(){}; public String getVersion() { return "1.2.5"; } }and my error code
Mods loaded: 1
ModLoader 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 9f578458 --------
Generated 5/15/12 4:29 PM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_04, Oracle Corporation
VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: ATI Radeon HD 3450 version 2.1.8781, ATI Technologies Inc.
java.lang.NullPointerException
at net.minecraft.src.mod_Testium.<init>(mod_Testium.java:32)
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)
--- END ERROR REPORT 859adabd ----------
Help?
Heres the code i chanded from the stone block.
package net.minecraft.src; import java.util.Random; public class BlockBunker extends Block { public BlockBunker(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 Block.cobblestone.blockID;