Posted December 22, 201212 yr here are some world generation files that I wrote to generate blocks exactly where I wanted them I reformatted them to be as generic as they can be so, Enjoy and use as you wish! first one is called WorldGenMinableNearBlock to use do (new WorldGenMinableNearBlock( blockid to spawn, metadata for that block, the number of blocks, and the block it will spawn near) import java.util.Random; import net.minecraft.block.Block; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class WorldGenMinableNearBlock extends WorldGenerator { /** The block ID of the ore to be placed using this generator. */ private int minableBlockId; //metadata for spawning private int metadata; /** The number of blocks to generate. */ private int numberOfBlocks; //block to spawn near, essentially next to private int nearBlock; public WorldGenMinableNearBlock(int par1, int par2, int par3, int near) { minableBlockId = par1; metadata = par2; numberOfBlocks = par3; nearBlock = near; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.nextFloat() * (float)Math.PI; double d = (float)(par3 + + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d1 = (float)(par3 + - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d2 = (float)(par5 + + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d3 = (float)(par5 + - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d4 = (par4 + par2Random.nextInt(3)) - 2; double d5 = (par4 + par2Random.nextInt(3)) - 2; for (int i = 0; i <= numberOfBlocks; i++) { double d6 = d + ((d1 - d) * (double)i) / (double)numberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)i) / (double)numberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)i) / (double)numberOfBlocks; double d9 = (par2Random.nextDouble() * (double)numberOfBlocks) / 16D; double d10 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; int j = MathHelper.floor_double(d6 - d10 / 2D); int k = MathHelper.floor_double(d7 - d11 / 2D); int l = MathHelper.floor_double(d8 - d10 / 2D); int i1 = MathHelper.floor_double(d6 + d10 / 2D); int j1 = MathHelper.floor_double(d7 + d11 / 2D); int k1 = MathHelper.floor_double(d8 + d10 / 2D); for (int l1 = j; l1 <= i1; l1++) { double d12 = (((double)l1 + 0.5D) - d6) / (d10 / 2D); if (d12 * d12 >= 1.0D) { continue; } for (int i2 = k; i2 <= j1; i2++) { double d13 = (((double)i2 + 0.5D) - d7) / (d11 / 2D); if (d12 * d12 + d13 * d13 >= 1.0D) { continue; } for (int j2 = l; j2 <= k1; j2++) { double d14 = (((double)j2 + 0.5D) - d8) / (d10 / 2D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(l1, i2, j2) == Block.stone.blockID && ((par1World.getBlockId(l1, i2-1, j2) == nearBlock ) || (par1World.getBlockId(l1, i2+1, j2) == nearBlock ) || (par1World.getBlockId(l1, i2, j2+1) == nearBlock )|| (par1World.getBlockId(l1, i2, j2-1) == nearBlock )|| (par1World.getBlockId(l1-1, i2, j2) == nearBlock ) || (par1World.getBlockId(l1+1, i2, j2) == nearBlock ) || ((par1World.getBlockId(l1, i2+1, j2) == this.minableBlockId) && (par1World.getBlockMetadata(l1, i2+1, j2) == this.metadata)) || ((par1World.getBlockId(l1, i2-1, j2) == this.minableBlockId) && (par1World.getBlockMetadata(l1, i2-1, j2) == this.metadata)) || ((par1World.getBlockId(l1-1, i2, j2) == this.minableBlockId) && (par1World.getBlockMetadata(l1-1, i2, j2) == this.metadata)) || ((par1World.getBlockId(l1+1, i2, j2) == this.minableBlockId) && (par1World.getBlockMetadata(l1+1, i2, j2) == this.metadata)) || ((par1World.getBlockId(l1, i2, j2+1) == this.minableBlockId) && (par1World.getBlockMetadata(l1, i2, j2+1) == this.metadata)) || ((par1World.getBlockId(l1, i2, j2-1) == this.minableBlockId) && (par1World.getBlockMetadata(l1, i2, j2-1) == this.metadata)))) { par1World.setBlockAndMetadata(l1, i2, j2, minableBlockId, metadata); continue; } } } } } return true; } } the next one is so that ores will spawn in the nether and this must be ran in the generateNether in a properly formatted world generation file to run do (new WorldGenMinableNether( Block Id, The metadata for that block, the number of blocks in vein) import java.util.Random; import net.minecraft.block.Block; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class WorldGenMinableNether extends WorldGenerator { /** The block ID of the ore to be placed using this generator. */ private int minableBlockId; private int metadata; /** The number of blocks to generate. */ private int numberOfBlocks; public WorldGenMinableNether(int par1, int par2, int par3) { minableBlockId = par1; metadata = par2; numberOfBlocks = par3; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.nextFloat() * (float)Math.PI; double d = (float)(par3 + + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d1 = (float)(par3 + - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d2 = (float)(par5 + + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d3 = (float)(par5 + - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d4 = (par4 + par2Random.nextInt(3)) - 2; double d5 = (par4 + par2Random.nextInt(3)) - 2; for (int i = 0; i <= numberOfBlocks; i++) { double d6 = d + ((d1 - d) * (double)i) / (double)numberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)i) / (double)numberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)i) / (double)numberOfBlocks; double d9 = (par2Random.nextDouble() * (double)numberOfBlocks) / 16D; double d10 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; int j = MathHelper.floor_double(d6 - d10 / 2D); int k = MathHelper.floor_double(d7 - d11 / 2D); int l = MathHelper.floor_double(d8 - d10 / 2D); int i1 = MathHelper.floor_double(d6 + d10 / 2D); int j1 = MathHelper.floor_double(d7 + d11 / 2D); int k1 = MathHelper.floor_double(d8 + d10 / 2D); for (int l1 = j; l1 <= i1; l1++) { double d12 = (((double)l1 + 0.5D) - d6) / (d10 / 2D); if (d12 * d12 >= 1.0D) { continue; } for (int i2 = k; i2 <= j1; i2++) { double d13 = (((double)i2 + 0.5D) - d7) / (d11 / 2D); if (d12 * d12 + d13 * d13 >= 1.0D) { continue; } for (int j2 = l; j2 <= k1; j2++) { double d14 = (((double)j2 + 0.5D) - d8) / (d10 / 2D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(l1, i2, j2) == Block.netherrack.blockID) { par1World.setBlockAndMetadata(l1, i2, j2, minableBlockId, metadata); } } } } } return true; } } FBalazs's generation API http://www.minecraftforum.net/topic/1608655-fbalazss-modding-api/ If you want some generation code done for you I'll gladly do it! funny thing is that i have no idea how to make a tile entity but this is a breeze for me. lol. if you know of a good tile entity tutorial, video if possible, please point me toward it
December 22, 201212 yr Could you write up a code to spawn .schematic in only some biomes? For me I will be thank ful.
December 22, 201212 yr I made a modding API that has nether and end generation included. See the link below. http://www.minecraftforum.net/topic/1608655-fbalazss-modding-api/ My mods with my API http://www.minecraftforum.net/topic/1609828-fbalazss-mods/ But I want to make a rotating block with a rotating box and a static box. Anybody can help me how to render this in my block rendering handler? Sorry for my bad English! FBalazs
December 23, 201212 yr Author FBalazs I made this a list and added your api to it Also to the person 2 posts above this, i'm afraid that this can't be done with my current level of expertise, in other words i havn't learned how to read from schematic files yet however i might do this after i learn that because i have been wanting to use something like that for some time now
December 24, 201212 yr Nice job, this is really usefull "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
January 11, 201312 yr If I gave you the .java of a structur could you make a simply. Code to spawn to at like 100,100,30 of 200,100,50?
January 11, 201312 yr API, Y U NO BE IN FORGE??? "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
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.