Posted June 8, 201411 yr I have lots of ores. All the ones that are supposed to spawn in stone work fine. But I tried getting some to spawn in Sand, Endstone, Dirt, etc but they just won't appear even after setting them to attempt generation in very high amounts... I made a new WorldGenMinable class for each block I wanted an ore to place before I realised you could just add a third parameter, but it doesn't work either way. Main: public static SpecialWorldGen SpecialGen = new SpecialWorldGen(); package com.pixelmoncore.main; import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; import com.pixelmoncore.main.SandGenMinable; import com.pixelmoncore.main.DirtGenMinable; import com.pixelmoncore.main.EndGenMinable; import com.pixelmoncore.main.WaterGenMinable; import com.pixelmoncore.main.LavaGenMinable; public class SpecialWorldGen implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case -1: generateInNether(world, random, chunkX*16, chunkZ*16); break; case 0: generateInOverworld(world, random, chunkX*16, chunkZ*16); break; case 1: generateInEnd(world, random, chunkX*16, chunkZ*16); break; } } private void generateInEnd(World world, Random random, int x, int z) { for(int i = 0; i < 2 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(256); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.endstoneOre, 1, Blocks.end_stone)).generate(world, random, chunkX, chunkY, chunkZ); } } private void generateInOverworld(World world, Random random, int x, int z) { for(int i = 0; i < 3 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(50); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.aquaOre, 1, Blocks.water)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 20 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(68); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.sandFossil, 20, Blocks.sand)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(128); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.dirtOre, 1, Blocks.dirt)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 16 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(80); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.infestedDirt, 1, Blocks.dirt)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(64); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.lavaOre, 1, Blocks.lava)).generate(world, random, chunkX, chunkY, chunkZ); } } private void generateInNether(World world, Random random, int x, int z) { for(int i = 0; i < 2 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(30); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.hellstoneOre, 5, Blocks.netherrack)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 5 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(20); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.obsidianOre, 10, Blocks.nettherack)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(64); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.lavaOre, 1, Blocks.lava)).generate(world, random, chunkX, chunkY, chunkZ); } } } This is what I had before that didn't work either: package com.pixelmoncore.main; import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; import com.pixelmoncore.main.SandGenMinable; import com.pixelmoncore.main.DirtGenMinable; import com.pixelmoncore.main.EndGenMinable; import com.pixelmoncore.main.WaterGenMinable; import com.pixelmoncore.main.LavaGenMinable; public class SpecialWorldGen implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case -1: generateInNether(world, random, chunkX*16, chunkZ*16); break; case 0: generateInOverworld(world, random, chunkX*16, chunkZ*16); break; case 1: generateInEnd(world, random, chunkX*16, chunkZ*16); break; } } private void generateInEnd(World world, Random random, int x, int z) { for(int i = 0; i < 2 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(256); //Max height to generate int chunkZ = z + random.nextInt(16); (new EndGenMinable(Main.endstoneOre, 1)).generate(world, random, chunkX, chunkY, chunkZ); } } private void generateInOverworld(World world, Random random, int x, int z) { for(int i = 0; i < 3 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(50); //Max height to generate int chunkZ = z + random.nextInt(16); (new WaterGenMinable(Main.aquaOre, 1)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 20 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(68); //Max height to generate int chunkZ = z + random.nextInt(16); (new WorldGenMinable(Main.sandFossil, 20, Blocks.sand)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(128); //Max height to generate int chunkZ = z + random.nextInt(16); (new DirtGenMinable(Main.dirtOre, 1)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 16 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(80); //Max height to generate int chunkZ = z + random.nextInt(16); (new DirtGenMinable(Main.infestedDirt, 1)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(64); //Max height to generate int chunkZ = z + random.nextInt(16); (new LavaGenMinable(Main.lavaOre, 1)).generate(world, random, chunkX, chunkY, chunkZ); } } private void generateInNether(World world, Random random, int x, int z) { for(int i = 0; i < 2 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(30); //Max height to generate int chunkZ = z + random.nextInt(16); (new NetherGenMinable(Main.hellstoneOre, 5)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 5 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(20); //Max height to generate int chunkZ = z + random.nextInt(16); (new NetherGenMinable(Main.obsidianOre, 10)).generate(world, random, chunkX, chunkY, chunkZ); } for(int i = 0; i < 1 /* <- Rarity per chunk */; i++) { int chunkX = x + random.nextInt(16); int chunkY = random.nextInt(64); //Max height to generate int chunkZ = z + random.nextInt(16); (new LavaGenMinable(Main.lavaOre, 1)).generate(world, random, chunkX, chunkY, chunkZ); } } } And the custom WorldGenMinable classes are the same, just with the block replaced changed package com.pixelmoncore.main; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class SandGenMinable extends WorldGenerator { private Block field_150519_a; /** The number of blocks to generate. */ private int numberOfBlocks; private Block field_150518_c; private static final String __OBFID = "CL_00000426"; private int mineableBlockMeta; public SandGenMinable(Block p_i45459_1_, int p_i45459_2_) { this(p_i45459_1_, p_i45459_2_, Blocks.sand); } public SandGenMinable(Block p_i45460_1_, int p_i45460_2_, Block p_i45460_3_) { this.field_150519_a = p_i45460_1_; this.numberOfBlocks = p_i45460_2_; this.field_150518_c = p_i45460_3_; } public SandGenMinable(Block block, int meta, int number, Block target) { this(block, number, target); this.mineableBlockMeta = meta; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.nextFloat() * (float)Math.PI; double d0 = (double)((float)(par3 + + MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F); double d1 = (double)((float)(par3 + - MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F); double d2 = (double)((float)(par5 + + MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F); double d3 = (double)((float)(par5 + - MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F); double d4 = (double)(par4 + par2Random.nextInt(3) - 2); double d5 = (double)(par4 + par2Random.nextInt(3) - 2); for (int l = 0; l <= this.numberOfBlocks; ++l) { double d6 = d0 + (d1 - d0) * (double)l / (double)this.numberOfBlocks; double d7 = d4 + (d5 - d4) * (double)l / (double)this.numberOfBlocks; double d8 = d2 + (d3 - d2) * (double)l / (double)this.numberOfBlocks; double d9 = par2Random.nextDouble() * (double)this.numberOfBlocks / 16.0D; double d10 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D; int i1 = MathHelper.floor_double(d6 - d10 / 2.0D); int j1 = MathHelper.floor_double(d7 - d11 / 2.0D); int k1 = MathHelper.floor_double(d8 - d10 / 2.0D); int l1 = MathHelper.floor_double(d6 + d10 / 2.0D); int i2 = MathHelper.floor_double(d7 + d11 / 2.0D); int j2 = MathHelper.floor_double(d8 + d10 / 2.0D); for (int k2 = i1; k2 <= l1; ++k2) { double d12 = ((double)k2 + 0.5D - d6) / (d10 / 2.0D); if (d12 * d12 < 1.0D) { for (int l2 = j1; l2 <= i2; ++l2) { double d13 = ((double)l2 + 0.5D - d7) / (d11 / 2.0D); if (d12 * d12 + d13 * d13 < 1.0D) { for (int i3 = k1; i3 <= j2; ++i3) { double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlock(k2, l2, i3).isReplaceableOreGen(par1World, k2, l2, i3, field_150518_c)) { par1World.setBlock(k2, l2, i3, this.field_150519_a, mineableBlockMeta, 2); } } } } } } } return true; } } What am I doing wrong?
June 8, 201411 yr What is your exact symptom? Crash? Or the ores not generating? I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
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.