Posted May 18, 201312 yr Ok so In my mod I need my ore to be generating in my custom dimension. Heres what I thought might work for code, because it works for the surface so try plugging in my dimension Ids in the switch statement and go from there. package net.shinemod; 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 OreWorldGen 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(); break; case 0: generateSurface(world, random, chunkX*16, chunkZ*16); break; case 1: generateEnd(); break; case 20: generateShine(world, random, chunkX * 16, chunkZ * 16); break; case 21: generateEclipse(world, random, chunkX * 16, chunkZ * 16); break; } } private void generateEclipse(World world, Random rand, int chunkX, int chunkZ) { //BlackWhite ORE for (int i = 0; i < 10; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(64); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.EclipseBlock.blockID, 10)).generate(world, rand, randPosX, randPosY, randPosZ); } } private void generateShine(World world, Random rand, int chunkX, int chunkZ) { //BlackWhite ORE for (int i = 0; i < 10; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(20); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.BlackWhiteOre.blockID, 2)).generate(world, rand, randPosX, randPosY, randPosZ); } for (int i = 0; i < 10; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(16); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.RainbowOre.blockID, 1)).generate(world, rand, randPosX, randPosY, randPosZ); } for (int i = 0; i < 10; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(64); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.EclipseBlock.blockID, 10)).generate(world, rand, randPosX, randPosY, randPosZ); } } public void generateNether() { } public void generateSurface(World world, Random rand, int chunkX, int chunkZ) { // 30 veins of ore per chunk //YELLOW ORE for (int i = 0; i < 12; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(64); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.YellowOre.blockID, ).generate(world, rand, randPosX, randPosY, randPosZ); } //BLUE ORE for (int i = 0; i < 10; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(60); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.BlueOre.blockID, 7)).generate(world, rand, randPosX, randPosY, randPosZ); } //RED ORE for (int i = 0; i < 10; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(54); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.RedOre.blockID, 6)).generate(world, rand, randPosX, randPosY, randPosZ); } //GREEN ORE for (int i = 0; i < 8; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(46); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.GreenOre.blockID, 4)).generate(world, rand, randPosX, randPosY, randPosZ); } //Silver ORE for (int i = 0; i < 11; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(64); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.SilverOre.blockID, ).generate(world, rand, randPosX, randPosY, randPosZ); } //PINK ORE for (int i = 0; i < 7; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(42); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.PinkOre.blockID, 5)).generate(world, rand, randPosX, randPosY, randPosZ); } //PURPLE ORE for (int i = 0; i < 5; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(37); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.PurpleOre.blockID, 4)).generate(world, rand, randPosX, randPosY, randPosZ); } //BLACK ORE for (int i = 0; i < 5; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(34); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.BlackOre.blockID, 4)).generate(world, rand, randPosX, randPosY, randPosZ); } } public void generateEnd() { } } Note that overworld generation does work, yet none of my dimensions do. Also since my dimension has a custom biome, only 1 Custom biome I figured I might as well try to generate ores from my biome using the decorate method. package net.shinemod.dimensions; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.EntitySquid; import net.minecraft.src.ModLoader; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.SpawnListEntry; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenTaiga1; import net.minecraft.world.gen.feature.WorldGenTaiga2; import net.minecraft.world.gen.feature.WorldGenerator; import net.shinemod.mod_tutorial; import net.shinemod.creatures.ShineChicken; import net.shinemod.creatures.ShineCow; import net.shinemod.creatures.ShineCreeper; import net.shinemod.creatures.ShinePig; import net.shinemod.creatures.ShineSheep; import net.shinemod.creatures.ShineSkeleton; import net.shinemod.creatures.ShineSpider; import net.shinemod.creatures.ShineZombie; public class BiomeShine extends BiomeGenBase { public BiomeShine(int par1) { super(par1); this.setBiomeName("Shine"); this.fillerBlock = (byte) mod_tutorial.SDirt.blockID; this.topBlock = (byte) mod_tutorial.SGrass.blockID; this.maxHeight = 0.55f; this.minHeight = 0; this.theBiomeDecorator.treesPerChunk = 3; /**Adding My Monsters/Creatures**/ this.spawnableCreatureList.add(new SpawnListEntry(ShineCow.class, 8, 4, 4)); this.spawnableMonsterList.add(new SpawnListEntry(ShineSpider.class, 10, 4, 4)); this.spawnableCreatureList.add(new SpawnListEntry(ShineSheep.class, 10, 4, 4)); this.spawnableMonsterList.add(new SpawnListEntry(ShineCreeper.class, 10, 4, 4)); this.spawnableCreatureList.add(new SpawnListEntry(ShinePig.class, 10, 4, 4)); this.spawnableCreatureList.add(new SpawnListEntry(ShineChicken.class, 10, 4, 4)); this.spawnableMonsterList.add(new SpawnListEntry(ShineZombie.class, 10, 4, 4)); this.spawnableMonsterList.add(new SpawnListEntry(ShineSkeleton.class, 10, 4, 4)); /**Despawning Other Monsters**/ this.spawnableCreatureList.remove(new SpawnListEntry(EntitySheep.class, 12, 4, 4)); this.spawnableCreatureList.remove(new SpawnListEntry(EntityPig.class, 10, 4, 4)); this.spawnableCreatureList.remove(new SpawnListEntry(EntityChicken.class, 10, 4, 4)); this.spawnableCreatureList.remove(new SpawnListEntry(EntityCow.class, 8, 4, 4)); this.spawnableMonsterList.remove(new SpawnListEntry(EntitySpider.class, 10, 4, 4)); this.spawnableMonsterList.remove(new SpawnListEntry(EntityZombie.class, 10, 4, 4)); this.spawnableMonsterList.remove(new SpawnListEntry(EntitySkeleton.class, 10, 4, 4)); this.spawnableMonsterList.remove(new SpawnListEntry(EntitySlime.class, 10, 4, 4)); this.spawnableMonsterList.remove(new SpawnListEntry(EntityEnderman.class, 1, 1, 4)); this.spawnableWaterCreatureList.remove(new SpawnListEntry(EntitySquid.class, 10, 4, 4)); this.spawnableCaveCreatureList.remove(new SpawnListEntry(EntityBat.class, 10, 8, ); this.spawnableCreatureList.clear(); this.spawnableMonsterList.clear(); } public WorldGenerator getRandomWorldGenForTrees(Random par1Random) { return (WorldGenerator)(par1Random.nextInt(3) == 0 ? new WorldGenShineTrees() : new WorldGenShine2(false)); } public void decorate(World world, Random rand, int chunkX, int chunkZ) { //BlackWhite ORE for (int i = 0; i < 10; i++) { //16x16 area up to y = 64 int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(64); int randPosZ = chunkZ + rand.nextInt(16); // 10 blocks per vein (new WorldGenMinable(mod_tutorial.EclipseBlock.blockID, 10)).generate(world, rand, randPosX, randPosY, randPosZ); } } } And no luck came from that. If anyone could please help me, theres no videos or tutorials on how to do this. I would appericate anyone willing to help. Thanks!
May 18, 201312 yr I added mine to the chunkProvider class for my dimension and my ore generation works well, good luck!! Hope it helped. I am the creator of the Soul Forest Mod : http://www.planetminecraft.com/mod/151-soul-forest-10-ores-vines-dimension-mobs-and-more/
May 18, 201312 yr Author I was thinking about doing that!! Can you plese show an example of what you did?
May 18, 201312 yr Pusedo Code: public void populate(IChunkProvider ichunkprovider, int i, int j) { BlockSand.fallInstantly = true; int k = i * 16; int l = j * 16; random.setSeed(worldObj.getSeed()); long l1 = (random.nextLong() / 2L) * 2L + 1L; long l2 = (random.nextLong() / 2L) * 2L + 1L; random.setSeed((long)i * l1 + (long)j * l2 ^ worldObj.getSeed()); double d = 0.25D; if(random.nextInt(32) == 0) { int i1 = k + random.nextInt(16); int j5 = random.nextInt(64) + 32; int j10 = l + random.nextInt(16); (new OreGenMinable(YOURMOD.ore.blockID, //amt in each vein)).generate(worldObj, random, i1, j5, j10); } Create new class named OreGenMinable. Put this in: package tut; import java.util.Random; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class OreGenMinable extends WorldGenerator { private int minableBlockID; private int numberOfBlocks; public OreGenMinable(int i, int j) { minableBlockID = i; numberOfBlocks = j; } public boolean generate(World world, Random random, int i, int j, int k) { float f = random.nextFloat() * 3.151593F; double d = (float)(i + + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d1 = (float)(i + - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d2 = (float)(k + + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d3 = (float)(k + - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d4 = j + random.nextInt(3) + 2; double d5 = j + random.nextInt(3) + 2; for(int l = 0; l <= numberOfBlocks; l++) { double d6 = d + ((d1 - d) * (double)l) / (double)numberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)l) / (double)numberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)l) / (double)numberOfBlocks; double d9 = (random.nextDouble() * (double)numberOfBlocks) / 16D; double d10 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; int i1 = MathHelper.floor_double(d6 - d10 / 2D); int j1 = MathHelper.floor_double(d7 - d11 / 2D); int k1 = MathHelper.floor_double(d8 - d10 / 2D); int l1 = MathHelper.floor_double(d6 + d10 / 2D); int i2 = MathHelper.floor_double(d7 + d11 / 2D); int j2 = MathHelper.floor_double(d8 + d10 / 2D); for(int k2 = i1; k2 <= l1; k2++) { double d12 = (((double)k2 + 0.5D) - d6) / (d10 / 2D); if(d12 * d12 >= 1.0D) { continue; } for(int l2 = j1; l2 <= i2; l2++) { double d13 = (((double)l2 + 0.5D) - d7) / (d11 / 2D); if(d12 * d12 + d13 * d13 >= 1.0D) { continue; } for(int i3 = k1; i3 <= j2; i3++) { double d14 = (((double)i3 + 0.5D) - d8) / (d10 / 2D); if(d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlockId(k2, l2, i3) == YOURMOD.STONE.blockID && world.getBlockMetadata(k2, l2, i3) <= 1) //Put your dimension's basic material (stone) { world.setBlock(k2, l2, i3, minableBlockID); } } } } } return true; } }
May 18, 201312 yr Create new class named OreGenMinable. Put this in: Why would you do that? Just go to your chunkProvider class and put this in there (in the public void populate) Example: WorldGenMinable worldgenminable; int j2; for (int i = 0; i < 7; i++) { int randPosX = k + soulRNG.nextInt(16); int randPosY = soulRNG.nextInt(128); //Rarerity 6 (1-15) 1 is very common 15 is extremely rare int randPosZ = l + soulRNG.nextInt(16); (new WorldGenMinable(mod_Ores.Amazoniteore.blockID, 7, mod_Ores.Slate.blockID)).generate(worldObj, soulRNG, randPosX, randPosY, randPosZ); } for (int i = 0; i < 9; i++) { int randPosX = k + soulRNG.nextInt(16); int randPosY = soulRNG.nextInt(128); //Rarerity 4 (1-15) 1 is very common 15 is extremely rare int randPosZ = l + soulRNG.nextInt(16); (new WorldGenMinable(mod_Ores.Amethystore.blockID, 9, mod_Ores.Porphyry.blockID)).generate(worldObj, soulRNG, randPosX, randPosY, randPosZ); } for (int i = 0; i < 9; i++) { int randPosX = k + soulRNG.nextInt(16); int randPosY = soulRNG.nextInt(128); //Rarerity 4 (1-15) 1 is very common 15 is extremely rare int randPosZ = l + soulRNG.nextInt(16); (new WorldGenMinable(mod_Ores.Aquamarineore.blockID, 9, mod_Ores.Slate.blockID)).generate(worldObj, soulRNG, randPosX, randPosY, randPosZ); } Thats how i did it and that works, just note that i have mod_Ores.Slate.blockID set as the block it needs to replace, for the overworld this is stone. I am the creator of the Soul Forest Mod : http://www.planetminecraft.com/mod/151-soul-forest-10-ores-vines-dimension-mobs-and-more/
May 18, 201312 yr You are seriously mentally retarded. No offense. Learn java. The vanilla WorldGenMinable only makes ores spawn when the dimension uses the vanilla: "Stone" You need to create a new GenMinable if you want the ores to spawn in a custom: "Stone"
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.