Jump to content

Recommended Posts

Posted

I am having trouble getting some ore generation to work.

Every time i attempt to create a world it does freeze but it gets stuck at the "Building terrain" screen

 

Mod_Base.java is my base class and includes the blocks,items,,recipes,smealting recipes, block and item names,block registry

 

package ZeldaCraft;


import net.minecraft.block.Block;
import net.minecraft.block.BlockOre;
import net.minecraft.block.material.Material;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraft.item.Item;
import cpw.mods.fml.common.Mod; 
import cpw.mods.fml.common.Mod.Init; 
import cpw.mods.fml.common.Mod.PreInit; 
import cpw.mods.fml.common.event.FMLInitializationEvent; 
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;


@Mod(modid = "ZeldaCraft", name = "ZeldaCraft", version = "v1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)





public class Mod_Base
{
//Items

public static Item Triforce;
public static Item TriforceofPower;
public static Item TriforceofWisdom;
public static Item TriforceofCourage;
public static Item TriforceShardLeft;
public static Item TriforceShardRight;
public static Item TriforceShardTop;
public static Item Crimsonine;
public static Item Azurine;
public static Item Aquanine;

//Blocks
public static Block TriShardOre;   //Tri-force shard ore
public static Block CrimsonineOre; //red
public static Block AquanineOre;   //green
public static Block AzurineOre;    //Blue

@PreInit


        


        public void initConfig(FMLPreInitializationEvent fpe)
    {

        }

@Init


        


        public void load(FMLInitializationEvent fie)
        {

	//Blocks
	TriShardOre = (new Blocks(1000, 0, Material.rock)).setHardness(20.0F).setResistance(20.0F).setBlockName("Tri-Shard Ore");
	AzurineOre = (new Blocks(1001, 3, Material.rock)).setHardness(5.0F).setResistance(20.0F).setBlockName("Azurine Ore");
	AquanineOre = (new Blocks(1002, 2, Material.rock)).setHardness(5.0F).setResistance(20.0F).setBlockName("Aquanine Ore");
	CrimsonineOre = (new Blocks(1003, 1, Material.rock)).setHardness(5.0F).setResistance(20.0F).setBlockName("Crimsonine Ore");
	        
	//Items



	        registeringBlocks();
                itemNames();
                recipes();
                smelting();
                generation();
                
            	//MineCraft Forge Texture Function
            	
            	MinecraftForgeClient.preloadTexture("/Textures/Blocksheet.png");
            	MinecraftForgeClient.preloadTexture("/Textures/Itemsheet.png");
        }


public void registeringBlocks()
    {
                //BLOCKS
	GameRegistry.registerBlock(TriShardOre,"Tri-Force Shard Ore");
	GameRegistry.registerBlock(AzurineOre, "Azurine Ore");
	GameRegistry.registerBlock(AquanineOre, "Aquanine Ore");
	GameRegistry.registerBlock(CrimsonineOre, "Crimsonine Ore");



    }

public void blockNames()
{
	LanguageRegistry.addName(TriShardOre, "Tri-Force Shard Ore");
	LanguageRegistry.addName(AzurineOre, "AzurineOre Ore");
	LanguageRegistry.addName(AquanineOre, "Aquanine Ore");
	LanguageRegistry.addName(CrimsonineOre, "Crimsonine Ore");
}

public void itemNames()
{



}

public void recipes()
{



}

public void smelting()
{



}

public void generation()
{
	GameRegistry.registerWorldGenerator(new OreWorldGenerator());



}
}

 

Blocks.java contains my basic block class fore making new blocks

package ZeldaCraft;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

public class Blocks extends Block
{
public Blocks(int par1, int par2, Material par3)
{
	super(par1, par2, par3);
	this.blockIndexInTexture = par2;
	this.setCreativeTab(CreativeTabs.tabBlock);
}

public String getTextureFile()
{
	return "/Textures/Blocksheet.png";
}

}

 

OreWorldGeneration.java is where i have declared my blocks generation

package ZeldaCraft;

import java.util.Random;

import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;

public class OreWorldGenerator implements IWorldGenerator {

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
	switch (world.provider.dimensionId)
	{
	case -1: generateNether(world, random, chunkX*16, chunkZ*16);
	case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
	}

}

private void generateSurface(World world, Random random, int BlockX, int BlockZ) 
{
	for(int i = 0; 1<16; i++)
	{
		int Xcoord = BlockX + random.nextInt(16);
		int Zcoord = BlockZ + random.nextInt(16);
		int Ycoord = random.nextInt(60);

(new WorldGenMinable(Mod_Base.TriShardOre.blockID, 10)).generate(world, random,Xcoord, Ycoord, Zcoord);

	}

}

private void generateNether(World world, Random random, int i, int j) 
{


}

}

 

I included all three because if i need to change something then you can tell me only other class is an item class

Posted

I'm really new to coding but you might try changing

TriShardOre = (new Blocks(1000, 0, Material.rock)).setHardness(20.0F).setResistance(20.0F).setBlockName("Tri-Shard Ore");
AzurineOre = (new Blocks(1001, 3, Material.rock)).setHardness(5.0F).setResistance(20.0F).setBlockName("Azurine Ore");
AquanineOre = (new Blocks(1002, 2, Material.rock)).setHardness(5.0F).setResistance(20.0F).setBlockName("Aquanine Ore");
CrimsonineOre = (new Blocks(1003, 1, Material.rock)).setHardness(5.0F).setResistance(20.0F).setBlockName("Crimsonine Ore");

 

to

 

TriShardOre = new Blocks(1000, 0, Material.rock).setHardness(20.0F).setResistance(20.0F).setBlockName("Tri-Shard Ore");
AzurineOre = new Blocks(1001, 3, Material.rock).setHardness(5.0F).setResistance(20.0F).setBlockName("Azurine Ore");
AquanineOre = new Blocks(1002, 2, Material.rock).setHardness(5.0F).setResistance(20.0F).setBlockName("Aquanine Ore");
CrimsonineOre = new Blocks(1003, 1, Material.rock).setHardness(5.0F).setResistance(20.0F).setBlockName("Crimsonine Ore");

 

and also try changing the GameRegistry.registerBlock(); to this

 

GameRegistry.registerBlock(TriShardOre);
GameRegistry.registerBlock(AzurineOre);
GameRegistry.registerBlock(AquanineOre);
GameRegistry.registerBlock(CrimsonineOre);

 

this might also affect it

 

private void generateSurface(World world, Random random, int BlockX, int BlockZ) 
int Xcoord = BlockX + random.nextInt(16);
int Zcoord = BlockZ + random.nextInt(16);
int Ycoord = random.nextInt(60)

private void generateNether(World world, Random random, int i, int j)

 

to

 

private void generateSurface(World world, Random random, int chunkX, int chunkZ)
int Xcoord = chunkX + random.nextInt(16);
int Zcoord = chunkZ + random.nextInt(16);
int Ycoord = random.nextInt(60)

private void generateNether(World world, Random random, int chunkX, int chunkZ)

 

reason i say this is because earlier when you did your switch/cases you predefined the parameters as chunkX, chunkZ and tried to change them to BlockX, BlockZ, i, and j which would cause an error.

 

you might also want to go ahead and add case 1: to the switch for the End otherwise all of the custom ore will generate in the End aswell

Posted
to

 

Code: [select]

private void generateSurface(World world, Random random, int chunkX, int chunkZ)

int Xcoord = chunkX + random.nextInt(16);

int Zcoord = chunkZ + random.nextInt(16);

int Ycoord = random.nextInt(60)

 

private void generateNether(World world, Random random, int chunkX, int chunkZ)

 

reason i say this is because earlier when you did your switch/cases you predefined the parameters as chunkX, chunkZ and tried to change them to BlockX, BlockZ, i, and j which would cause an error.

 

private void generateNether(World world, Random random, int Xcoord, int Zcoord);

where is the y in the genNether?

The Korecraft Mod

Posted

and also try changing the GameRegistry.registerBlock(); to this

 

GameRegistry.registerBlock(TriShardOre);
GameRegistry.registerBlock(AzurineOre);
GameRegistry.registerBlock(AquanineOre);
GameRegistry.registerBlock(CrimsonineOre);

 

doing this causes a line like this: GameRegistry.registerBlock

 

does that mean anything

Posted

just remove this

for(int i = 0; 1<16; i++)

  {

u dont need that for WorldGenMinable, exept for flowers and other gen stuff, because u are saying to generate in the surface, but WorldGenMinable its to gen int stone noise (witch is underground)

Posted

doing this causes a line like this: GameRegistry.registerBlock

 

does that mean anything

 

GameRegistry.registerBlock now requires another var in the ( ). Its crossed out to indicate to users that they need to update this line of code.

 

you have to add a Mod Specific name after the declaration name. ( i know i'm more then likely using the wrong wording )

 

so your line:

 

GameRegistry.registerBlock(TriShardOre)

 

should be:

 

GameRegistry.registerBlock(TriShardOre, "ZeldaCorp_TriShardOre")

 

you dont have to name it that. but it's intended to register the block so that it is identified with your mod.

Posted

put that after the xcord, ycord,zcord

System.out.println(Xcoord);

System.out.println(Ycoord);

System.out.println(Zcoord);

then go to cordinates and see if your block its there

 

 

Posted

put that after the xcord, ycord,zcord

System.out.println(Xcoord);

System.out.println(Ycoord);

System.out.println(Zcoord);

then go to cordinates and see if your block its there

which set though??? lol idk where you are saying to put it

Posted

... in the file that haves the generation stuff, like in the void that u are doing the generation sutff, most espific at

private void generateSurface(World world, Random random, int chunkX, int chunkZ)

int Xcoord = chunkX + random.nextInt(16);

int Zcoord = chunkZ + random.nextInt(16);

int Ycoord = random.nextInt(60)

System.out.println(Xcoord);

System.out.println(Ycoord);

System.out.println(Zcooord);

its the only place to put...

Posted

... in the file that haves the generation stuff, like in the void that u are doing the generation sutff, most espific at

private void generateSurface(World world, Random random, int chunkX, int chunkZ)

int Xcoord = chunkX + random.nextInt(16);

int Zcoord = chunkZ + random.nextInt(16);

int Ycoord = random.nextInt(60)

System.out.println(Xcoord);

System.out.println(Ycoord);

System.out.println(Zcooord);

its the only place to put...

 

k done,but may i ask what exactly that was supposed to do because it still didnt gen and nothing new showed in the console.......does that mean it didnt work???

Posted

it to show in the console the location but i made one thing wrong

change to this

  int Xcoord = BlockX + random.nextInt(16);

    int Zcoord = BlockZ + random.nextInt(16);

    int Ycoord = random.nextInt(60);

  (new WorldGenMinable(Mod_Base.TriShardOre.blockID, 10)).generate(world, random,Xcoord, Ycoord, Zcoord);

System.out.println(Xcoord);

System.out.println(Ycoord);

System.out.println(Zcooord);

Posted

it to show in the console the location but i made one thing wrong

change to this

  int Xcoord = BlockX + random.nextInt(16);

    int Zcoord = BlockZ + random.nextInt(16);

    int Ycoord = random.nextInt(60);

  (new WorldGenMinable(Mod_Base.TriShardOre.blockID, 10)).generate(world, random,Xcoord, Ycoord, Zcoord);

System.out.println(Xcoord);

System.out.println(Ycoord);

System.out.println(Zcooord);

 

same thing as before,nothing different in the console

Posted

so that code its not being called

ITS WORKING!!! the change to 50 lagged me a bit though lol but its working!!!

.........one last thing,could you tell me which numbers represent what??? like rarity and how many per ore vain????

Posted

1 look at spoiler

 

 

i use this for my gen

private void generateFantasy(World world, Random random, int blockX, int blockZ) {

int Xcoord = blockX + random.nextInt(16);

int Ycoord = random.nextInt(60);

int Zcoord = blockZ + random.nextInt(16);

(new WorldGenMinableFantasy(Block.oreCoal.blockID, 19)).generate(world, random, Xcoord, Ycoord, Zcoord);

int Xcoord2 = blockX + random.nextInt(16);

int Ycoord2 = random.nextInt(40);

int Zcoord2 = blockZ + random.nextInt(16);

(new WorldGenMinableFantasy(Block.oreIron.blockID, 10)).generate(world, random, Xcoord2, Ycoord2, Zcoord2);

int Xcoord3 = blockX + random.nextInt(16);

int Ycoord3 = random.nextInt(40);

int Zcoord3 = blockZ + random.nextInt(16);

(new WorldGenMinableFantasy(Block.oreGold.blockID, 5)).generate(world, random, Xcoord3, Ycoord3, Zcoord3);

int Xcoord4 = blockX + random.nextInt(16);

int Ycoord4 = random.nextInt(14);

int Zcoord4 = blockZ + random.nextInt(16);

(new WorldGenMinableFantasy(Block.oreDiamond.blockID, 3)).generate(world, random, Xcoord4, Ycoord4, Zcoord4);

}

 

 

2 - yes

Posted

1 look at spoiler

 

 

i use this for my gen

private void generateFantasy(World world, Random random, int blockX, int blockZ) {

int Xcoord = blockX + random.nextInt(16);

int Ycoord = random.nextInt(60);

int Zcoord = blockZ + random.nextInt(16);

(new WorldGenMinableFantasy(Block.oreCoal.blockID, 19)).generate(world, random, Xcoord, Ycoord, Zcoord);

int Xcoord2 = blockX + random.nextInt(16);

int Ycoord2 = random.nextInt(40);

int Zcoord2 = blockZ + random.nextInt(16);

(new WorldGenMinableFantasy(Block.oreIron.blockID, 10)).generate(world, random, Xcoord2, Ycoord2, Zcoord2);

int Xcoord3 = blockX + random.nextInt(16);

int Ycoord3 = random.nextInt(40);

int Zcoord3 = blockZ + random.nextInt(16);

(new WorldGenMinableFantasy(Block.oreGold.blockID, 5)).generate(world, random, Xcoord3, Ycoord3, Zcoord3);

int Xcoord4 = blockX + random.nextInt(16);

int Ycoord4 = random.nextInt(14);

int Zcoord4 = blockZ + random.nextInt(16);

(new WorldGenMinableFantasy(Block.oreDiamond.blockID, 3)).generate(world, random, Xcoord4, Ycoord4, Zcoord4);

}

 

 

2 - yes

 

AWSOME thanks alot man! if you have a skype could i add you if i need help again???

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.

Announcements



×
×
  • Create New...

Important Information

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