Jump to content

Ore Generation {SOLVED}


Texasjake95

Recommended Posts

I can't get my ore to generate in the world...

I used the following generation code with no luck...  :(

Is there something wrong with the code or a better way to do it?

public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
    {
                    for(int l = 0; l < 25; l++)
                    {
                            int i1 = chunkX + rand.nextInt(16);
                            int j1 = rand.nextInt(60);
                            int k1 = chunkZ + rand.nextInt(16);
                            (new WorldGenMinable(oreCopper.blockID, 10)).generate(world, rand, i1, j1, k1);
                    }
    }

Sorry if this is in the wrong section.

Link to comment
Share on other sites

Here's the code for my mod_xxx.java and the block I am trying to generate. I can't seem to figure out why its not generating... Everything but the generating works

 

mod_XXX

 

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

import net.minecraft.src.forge.*;

public class mod_XXX extends BaseMod
{

public void load ()
{
MinecraftForge.registerOre("ingotCopper", new ItemStack(ingotCopper));
ModLoader.registerBlock(oreCopper);
ModLoader.addName ( oreCopper, "Copper Ore" );
ModLoader.addName ( ingotCopper, "Copper Ingot");
ModLoader.addName ( helmetCopper, "Copper Helmet");
ModLoader.addName ( plateCopper, "Copper Plate");
ModLoader.addName ( legsCopper, "Copper Legs");
ModLoader.addName ( bootsCopper, "Copper Boots");
ModLoader.addName ( pickaxeCopper, "Copper Pickaxe");
ModLoader.addName ( swordCopper, "Copper Sword");
ModLoader.addName ( shovelCopper, "Copper Shovel");
ModLoader.addName ( hoeCopper, "Copper Hoe");
ModLoader.addName ( axeCopper, "Copper Axe");
MinecraftForgeClient.preloadTexture("/XXX/Blocks.png");
MinecraftForgeClient.preloadTexture("/XXX/Items.png");
MinecraftForgeClient.preloadTexture("/XXX/Armor/Copper1.png");
MinecraftForgeClient.preloadTexture("/XXX/Armor/Copper2.png");
MinecraftForge.setToolClass(pickaxeCopper, "pickaxe", 2);
    MinecraftForge.setToolClass(shovelCopper, "shovel", 2);
    MinecraftForge.setToolClass(axeCopper, "axe", 2);
    ModLoader.addRecipe(new ItemStack(pickaxeCopper, 1), new Object[] {
	"XXX", " Y ", " Y ",
	Character.valueOf('X'), ingotCopper, Character.valueOf('Y'), Item.stick	});
    ModLoader.addRecipe(new ItemStack(axeCopper, 1), new Object[] {
	"XX ",
	"XY ",
	" Y ",
	Character.valueOf('X'), ingotCopper, Character.valueOf('Y'), Item.stick
	});
    ModLoader.addRecipe(new ItemStack(axeCopper, 1), new Object[] {
	" XX",
	" YX",
	" Y ",
	Character.valueOf('X'), ingotCopper, Character.valueOf('Y'), Item.stick
	});
    ModLoader.addRecipe(new ItemStack(hoeCopper, 1), new Object[] {
	"XX ",
	" Y ",
	" Y ",
	Character.valueOf('X'), ingotCopper, Character.valueOf('Y'), Item.stick
	});
    ModLoader.addRecipe(new ItemStack(hoeCopper, 1), new Object[] {
	" XX",
	" Y ",
	" Y ",
	Character.valueOf('X'), ingotCopper, Character.valueOf('Y'), Item.stick
	});
    ModLoader.addRecipe(new ItemStack(shovelCopper, 1), new Object[] {
	" X ",
	" Y ",
	" Y ",
	Character.valueOf('X'), ingotCopper, Character.valueOf('Y'), Item.stick
	});
    ModLoader.addRecipe(new ItemStack(swordCopper, 1), new Object[] {
	" X ",
	" X ",
	" Y ",
	Character.valueOf('X'), ingotCopper, Character.valueOf('Y'), Item.stick
	});
       ModLoader.addRecipe(new ItemStack(oreCopper, 1), new Object[] {
	"   ",
	" X ",
	"   ",
	Character.valueOf('X'), Block.sand
	});
ModLoader.addRecipe(new ItemStack(ingotCopper, 1), new Object[] {
	"   ",
	" X ",
	"   ",
	Character.valueOf('X'), Block.dirt
	});
ModLoader.addRecipe(new ItemStack(helmetCopper, 1), new Object[] {
	"XXX",
	"X X",
	Character.valueOf('X'), ingotCopper
	});
ModLoader.addRecipe(new ItemStack(plateCopper, 1), new Object[] {
		"X X",
		"XXX",
		"XXX",
		Character.valueOf('X'), ingotCopper
		});
ModLoader.addRecipe(new ItemStack(bootsCopper, 1), new Object[] {
	"X X",
	"X X",
	Character.valueOf('X'), ingotCopper
	});
ModLoader.addRecipe(new ItemStack(legsCopper, 1), new Object[] {
	"XXX",
	"X X",
	"X X",
	Character.valueOf('X'), ingotCopper
	});
ModLoader.addSmelting(oreCopper.blockID, new ItemStack(ingotCopper, 1));
}
public void GenerateSurface(World world, Random random, int chunkX, int chunkZ)
    {
                    for(int l = 0; l < 999; l++)
                    {
                            int i1 = chunkX + random.nextInt(16);
                            int j1 = random.nextInt(256);
                            int k1 = chunkZ + random.nextInt(16);
                            (new WorldGenMinable(oreCopper.blockID, 100)).generate(world, random, i1, j1, k1);
                    }
    }


public String getVersion()
{
return "Beta 1.0.0 for Minecraft 1.2.5";
}


public static final Block oreCopper = new texasjake95_CopperBlock (150, 0).setHardness(2.0F).setResistance(4.0F).setStepSound(Block.soundStoneFootstep).setBlockName("Copper Ore");
public static final Item ingotCopper = new texasjake95_CopperIngot(3500).setIconCoord (0,0).setItemName ("Copper Ingot");

 static EnumToolMaterial CopperTool = EnumHelper.addToolMaterial("COPPER", 2, 500, 7F, 3, 9);
 static EnumArmorMaterial CopperArmor = EnumHelper.addArmorMaterial("COPPER", 12, new int[] {2, 5, 4, 2}, 9);
     public static final Item helmetCopper = (new texasjake95_CopperArmor(127, CopperArmor, 5, 0)).setIconCoord(6, 0).setItemName("helmetCopper");
     public static final Item plateCopper = (new texasjake95_CopperArmor(128, CopperArmor, 5, 1)).setIconCoord (7, 0).setItemName("chestplateCopper");
     public static final Item legsCopper = (new texasjake95_CopperArmor(129, CopperArmor, 5, 2)).setIconCoord (8, 0).setItemName("leggingsCopper");
     public static final Item bootsCopper = (new texasjake95_CopperArmor(130, CopperArmor, 5, 3)).setIconCoord(9, 0).setItemName("bootsCopper");
     public static final Item shovelCopper = (new texasjake95_CopperSpade(135, CopperTool)).setIconCoord(2, 0).setItemName("shovelCopper");
     public static final Item pickaxeCopper = (new texasjake95_CopperPickaxe(134, CopperTool)).setIconCoord(3, 0).setItemName("pickaxeCopper");
     public static final Item axeCopper = (new texasjake95_CopperAxe(133, CopperTool)).setIconCoord(4, 0).setItemName("hatchetCopper");
     public static final Item swordCopper = (new texasjake95_CopperSword(132, CopperTool)).setIconCoord(1, 0).setItemName("swordCopper");
     public static final Item hoeCopper = (new texasjake95_CopperHoe(131, CopperTool)).setIconCoord(5, 0).setItemName("hoeCopper");
}


 

texasjake95_CopperBlock.java

 

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

import net.minecraft.src.forge.*;


public class texasjake95_CopperBlock extends Block implements ITextureProvider
{
public texasjake95_CopperBlock(int i, int j)
{
	super(i, j, Material.rock);
}

public String getTextureFile()
{
	return "/XXX/Blocks.png";
}

public int idDropped(int i, Random random)
{
	return XXX.oreCopper.blockID;
}

public int quantityDropped(Random random)
{
	return 1;
}

public void addCreativeItems(ArrayList itemList)
{
	itemList.add(new ItemStack(this));
}


}

 

 

 

Link to comment
Share on other sites

for(int l = 0; l < 999; l++) umm...

oreCopper.blockID, 100 umm...

int j1 = random.nextInt(256); umm...

 

I'm not sure how that would affect it, but it doesn't seem right compared to your original posted code.

 

Also, you don't need to implement ITextureProvider, all blocks/items do already.

Link to comment
Share on other sites

for(int l = 0; l < 999; l++) umm...

oreCopper.blockID, 100 umm...

int j1 = random.nextInt(256); umm...

 

I'm not sure how that would affect it, but it doesn't seem right compared to your original posted code.

 

Also, you don't need to implement ITextureProvider, all blocks/items do already.

I was experimenting with different tutorials and forgot to change back

 

Edit:

Found out what was wrong there was a capital G on generateSurface...  :o I cant believe that one typo didn't allow my ore to generate...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.