ZeldaCorporation Posted January 4, 2013 Share Posted January 4, 2013 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 Quote Link to comment Share on other sites More sharing options...
tyrael142 Posted January 7, 2013 Share Posted January 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
Kore Posted January 7, 2013 Share Posted January 7, 2013 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? Quote The Korecraft Mod Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 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) Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 Ok so at this point in time the world will manage to actually generate BUT the ore still doesnt generate,i have made 5 worlds searched for 10 mins and never found it Quote Link to comment Share on other sites More sharing options...
Bishamonten Posted January 7, 2013 Share Posted January 7, 2013 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. Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 try to gen more than 10 just to test, like instead of 10 put 50 and test Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 try to gen more than 10 just to test, like instead of 10 put 50 and test still couldnt find it,meaning it just plain out is not generating...and idk why Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 ... 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... Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 ... 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??? Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 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); Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 so that code its not being called Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 so that code its not being called so any suggestions for making it be called??? Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 so that code its not being called actually i just realized that i had commented out something so i could work on a diff mod and didnt un-comment it Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 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? Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 50 its amoun that wil generate in chunk Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 50 its amoun that wil generate in chunk what about how many per vain??? oh and also could i do multipul ore's in this class??? Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 1- its same too 2 - yea you can, just do other coordinates so it dont conflict with that ore Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 1- its same too 2 - yea you can, just do other coordinates so it dont conflict with that ore how yould i go about doing other coordinates??? and would doing this be the easiest way??? Quote Link to comment Share on other sites More sharing options...
opssemnik Posted January 7, 2013 Share Posted January 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
ZeldaCorporation Posted January 7, 2013 Author Share Posted January 7, 2013 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??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.