Posted September 19, 201411 yr I have over 11000 lines in one of my structure codes, a big water temple, and it's important that it's generated exactly how it's built (converted a schematic to java). Because of its length I need to break it down into several methods, one for each floor. But when I try to make it generate in 8 pieces, for some reason it skips every other piece and puts a big space between them. Here's what I mean (screenshot): Can someone tell me what I'm doing wrong? Generating it: public class GenerateStructures 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; case 3: generateInTwilightRealm(world, random, chunkX*16, chunkZ*16); break; } } private void generateInOverworld(World world, Random random, int x, int z) { WaterTempleBase waterTemple = new WaterTempleBase(); Random r = new Random(); int chance = r.nextInt(500); for(int i = 0; i < 1; i++) { int chunkX = x; int chunkZ = z; int chunkY = world.getHeightValue(chunkX, chunkZ); if(chance < FConfig.waterTemple()) { waterTemple.generateSurface(world, random, chunkX, chunkY, chunkZ); } } } } The structure (without the code that places each block): public class WaterTempleBase extends StructureComponent { public void generateSurface(World world, Random random, int chunkX, int chunkY, int chunkZ) { int j = world.getHeightValue(chunkX,chunkZ); if(world.getBiomeGenForCoords(chunkX, chunkZ).biomeName.equals(BiomeGenBase.ocean.biomeName) || world.getBiomeGenForCoords(chunkX, chunkZ).biomeName.equals(BiomeGenBase.deepOcean.biomeName)) { boolean place = true; for (int y = 0; y<11; y++) for (int z = 0; z<13; z++) for (int x = 0; x<9; x++) if(world.getBlock(chunkX+x,j+y+1,chunkZ +z)!=Blocks.air) place = false; if(place) { System.out.println("[FandomCraft] Attempting to build the Water Temple at (" + chunkX + ", " + j + ", " + chunkZ + ")"); world.setBlock(chunkX+0, j+0, chunkZ+0, Main.waterDungeonBlock, 0, 2); ...other code generate2(world, random, chunkX, chunkY, chunkZ); } } } public void generate2(World world, Random random, int chunkX, int chunkZ, int chunkY) { int j = world.getHeightValue(chunkX,chunkZ); world.setBlock(chunkX+25, j+6, chunkZ+0, Main.waterDungeonBlock, 0, 2); ...other code generate3(world, random, chunkX, chunkY, chunkZ); } public void generate3(World world, Random random, int chunkX, int chunkZ, int chunkY) { int j = world.getHeightValue(chunkX,chunkZ); world.setBlock(chunkX+7, j+12, chunkZ+7, Main.waterDungeonBlock, 0, 2); ...other code generate4(world, random, chunkX, chunkY, chunkZ); } public void generate4(World world, Random random, int chunkX, int chunkZ, int chunkY) { int j = world.getHeightValue(chunkX,chunkZ); world.setBlock(chunkX+0, j+15, chunkZ+0, Main.waterDungeonBlock, 0, 2); ...other code generate5(world, random, chunkX, chunkY, chunkZ); } public void generate5(World world, Random random, int chunkX, int chunkZ, int chunkY) { int j = world.getHeightValue(chunkX,chunkZ); world.setBlock(chunkX+11, j+19, chunkZ+1, Main.waterDungeonBlock, 0, 2); ...other code generate6(world, random, chunkX, chunkY, chunkZ); } public void generate6(World world, Random random, int chunkX, int chunkZ, int chunkY) { int j = world.getHeightValue(chunkX,chunkZ); world.setBlock(chunkX+0, j+22, chunkZ+0, Main.waterDungeonBlock, 0, 2); ...other code world.setBlock(chunkX+28, j+26, chunkZ+7, Main.waterDungeonBlock, 0, 2); generate7(world, random, chunkX, chunkY, chunkZ); } public void generate7(World world, Random random, int chunkX, int chunkZ, int chunkY) { int j = world.getHeightValue(chunkX,chunkZ); world.setBlock(chunkX+0, j+26, chunkZ+8, Main.waterDungeonBlock, 0, 2); ...other code world.setBlock(chunkX+28, j+29, chunkZ+27, Main.waterDungeonBlock, 0, 2); System.out.println("[FandomCraft] Probably built the Water Temple at (" + chunkX + ", " + j + ", " + chunkZ + ")"); } @Override public boolean addComponentParts(World world, Random r, StructureBoundingBox box) { generateSurface(world, r, coordBaseMode, coordBaseMode, coordBaseMode); generate2(world, r, coordBaseMode, coordBaseMode, coordBaseMode); generate3(world, r, coordBaseMode, coordBaseMode, coordBaseMode); generate4(world, r, coordBaseMode, coordBaseMode, coordBaseMode); generate5(world, r, coordBaseMode, coordBaseMode, coordBaseMode); generate6(world, r, coordBaseMode, coordBaseMode, coordBaseMode); generate7(world, r, coordBaseMode, coordBaseMode, coordBaseMode); return true; } @Override protected void func_143012_a(NBTTagCompound p_143012_1_) { } @Override protected void func_143011_b(NBTTagCompound p_143011_1_) { } }
September 19, 201411 yr I am not totally sure but I'm suspicious of the world.getHeightValue() function. I think that once you build, it will return a different value. so I think that in each of your generates you shouldn't be adding so much to j. Like just use j+1 in each generate and see what that does. To really trace this, after each j=world.getHeightValue() you can print a console statement like System.out.println("j = "+j); and see what it says. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.