Posted March 16, 20169 yr UPDATE: Ok, I got it nearly working. For testing purpose I decided to use lava. Thats how it looks so far, but there is one problem. Is there a way to remove the lava which is over the one block air level? My current code: for(int x = 0; x < 16; ++x) { for(int z = 0; z < 16; ++z) { BiomeBase biomeBase = (BiomeBase)baseBiome[x * 16 + z]; biomeBase.replaceBlocksForBiome(chunkX * 16 + x, chunkZ * 16 + z, blocks, state, baseBiome, noise); for(int y = 255; y >= 0; --y) { if(y <= this.random.nextInt(4)) { primer.setBlockState((chunkX * 16 + x) & 15, y, (chunkZ * 16 + z) & 15, Blocks.bedrock.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 1, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 2, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 3, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 4, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 5, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 6, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); // doesn't remove all lava... not working if(primer.getBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); } } } } So everything above y + 6 should not generate the lava spots. (lava lakes are ok, but thats a future task for me) Thx in advance. Bektor Hi, I've got a question (which is a problem, too). So, I'm currently working on my own world generator for my own dimension, but now I'm wondering how to generate bedrock at the bottom of the world. Currently it's not generating in my world and when you dig down you just fell out of the world. So does anyone got an idea how to genereate bedrock in a world generator cause I'm unable to find out how Mojang does it and my own code isn't working (replaceBlockBiomes code...) Thats my code which I tried: private void replaceBlocksForBiome(int chunkX, int chunkZ, Block[] blocks, IBlockState[] state, BiomeGenBase[] baseBiome, float[] noise, ChunkPrimer primer) { ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, primer, world); MinecraftForge.EVENT_BUS.post(event); if(event.getResult() == Result.DENY) return; for(int x = 0; x < 16; ++x) { for(int z = 0; z < 16; ++z) { BiomeBase biomeBase = (BiomeBase)baseBiome[x * 16 + z]; biomeBase.replaceBlocksForBiome(chunkX * 16, chunkZ * 16, blocks, state, baseBiome, noise); blocks[(z * 16 + x) * 256] = Blocks.bedrock; state[(z * 16 + x) * 256] = Blocks.bedrock.getDefaultState(); } } } [i don't even know if that code is correct, I just now it gives me no errors] For generating stuff I'm using OpenSimplexNoise and currently just generating a few layers of stone... no grass, no dirt, no hills, no caves etc. Thx in advance. Bektor Developer of Primeval Forest.
March 16, 20169 yr replaceBlocksForBiome is intended for replacing the top 4 blocks of stone with grass or sand (or at least, that's what Minecraft uses it for). The bottom bedrock is handled by the chunk provider the last time I looked at it. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
March 16, 20169 yr Author replaceBlocksForBiome is intended for replacing the top 4 blocks of stone with grass or sand (or at least, that's what Minecraft uses it for). The bottom bedrock is handled by the chunk provider the last time I looked at it. Ah, ok. Just thought I can use it for that purpose, too, because some mods do it [MC 1.7.10]. So how is the chunk provider doing this? Everytime when I search for "bedrock" in the "ChunkProviderGenerate" from Mojang I can't find it. And "replaceBlocksForBiome" is a method inside of the chunk provider. Developer of Primeval Forest.
March 16, 20169 yr Been a while since I looked at it, TBH. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
March 16, 20169 yr If you look for usages of the Blocks.bedrock field, you'll see that it's used in BiomeGenBase#generateBiomeTerrain . This is called from BiomeGenBase#genTerrainBlocks , which is called from ChunkProviderGenerate#replaceBlocksForBiome . Each biome generates its own terrain (including bedrock) from this method. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
March 16, 20169 yr Author If you look for usages of the Blocks.bedrock field, you'll see that it's used in BiomeGenBase#generateBiomeTerrain . This is called from BiomeGenBase#genTerrainBlocks , which is called from ChunkProviderGenerate#replaceBlocksForBiome . Each biome generates its own terrain (including bedrock) from this method. Ok, thx. Now its mostly working..... I just broke MC down to 2FPS because I wanted to generate over the bedrock something else like which is generated like the bedrock..... Any idea how my code must look to generate in (java) level 256 bedrock and in (java) 255 for example dirt? Developer of Primeval Forest.
March 16, 20169 yr Author Ok, I got it nearly working. For testing purpose I decided to use lava. Thats how it looks so far, but there is one problem. Is there a way to remove the lava which is over the one block air level? My current code: for(int x = 0; x < 16; ++x) { for(int z = 0; z < 16; ++z) { BiomeBase biomeBase = (BiomeBase)baseBiome[x * 16 + z]; biomeBase.replaceBlocksForBiome(chunkX * 16 + x, chunkZ * 16 + z, blocks, state, baseBiome, noise); for(int y = 255; y >= 0; --y) { if(y <= this.random.nextInt(4)) { primer.setBlockState((chunkX * 16 + x) & 15, y, (chunkZ * 16 + z) & 15, Blocks.bedrock.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 1, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 2, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 3, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 4, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 5, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 6, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); // doesn't remove all lava... not working if(primer.getBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); } } } } So everything above y + 6 should not generate the lava spots. (lava lakes are ok, but thats a future task for me) Bektor Developer of Primeval Forest.
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.