Posted June 30, 201411 yr Problem 1: I made a custom structure and got it to spawn. Now I created a more complex structure and put stairs, and a chest, and doors, and other things with direction and metadata. How would I go about adding metadata and direction to these in my "WorldGenSTRUCTURE" class? Problem 2: This is probably really simple, and I think I have some idea, but can't pinpoint the exact problem...My structures are spawning in the same spot, 1 on top of the other...They aren't spawning alone in separate locations like they should. Can anybody think of a reason why this is happening? All Help is appreciated! Thank you!
June 30, 201411 yr Hi! How would I go about adding metadata and direction to these in my "WorldGenSTRUCTURE" class? Bear with me, as I am incredibly new to this, and could be wrong about everything. Are you inheriting from net.minecraft.world.gen.structure.StructureComponent for your structure components? If so, getMetadataWithOffset seems to do what you want, provided you're keeping track of your coordBaseMode , I think. Furthermore, generateStructureChestContents appears like a nice method for generating chests with items in it. As for your second issue, could you post a snippet of where and how you are spawning structures?
June 30, 201411 yr I must say.. If you are asking a question that involves multiple possible solutions depending on what is actually not working, please post your relevant code. It makes my life so much easier. Besides, my magical code viewing device is broken. So I can't look at your code... We all stuff up sometimes... But I seem to be at the bottom of that pot.
June 30, 201411 yr Author structure 1 (minus all set blocks for size reasons): public class WorldGenChurch implements IWorldGenerator{ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case -1: generateNether(world, random, chunkX * 16, chunkZ * 16); break; case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); break; case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); break; } } private void generateEnd(World world, Random random, int i, int j) { } private void generateNether(World world, Random random, int i, int j) { } public void generateSurface(World world, Random random, int i2, int k2) { int i = i2 + random.nextInt(15); int k = k2 + random.nextInt(15); int j = world.getHeightValue(i,k)-1; if((random.nextInt(1000000)+1)<=100000){ boolean place = true; Structure 2 (minus all set blocks for size reasons): same thing as above with different set blocks
June 30, 201411 yr Author I also need help with doors, if you can, because they are on the ground as items when the structure generates
June 30, 201411 yr Author Use setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag) The doors still aren't in place and nothing is changing direction when I get this line to work...can you give me an example of this line of code with parameters filled in?
June 30, 201411 yr If you look at the source code for villages.. They make a call to ItemDoor.placeDoorBlock(params); Please, search through mc source code and try to find something similar to what you want, then try and change it to suit your needs. If that doesn't work, come back and ask on the forums (and if you just copy/paste from vanilla code... You will be getting a bit of questioning from us. But if vanilla code is exactly what you need... ) We all stuff up sometimes... But I seem to be at the bottom of that pot.
June 30, 201411 yr Author If you look at the source code for villages.. They make a call to ItemDoor.placeDoorBlock(params); Please, search through mc source code and try to find something similar to what you want, then try and change it to suit your needs. If that doesn't work, come back and ask on the forums (and if you just copy/paste from vanilla code... You will be getting a bit of questioning from us. But if vanilla code is exactly what you need... ) I'm sorry to ask so many questions, but I've gone through the code and used the right parameters(i think) and the doors still spawn on the ground as items....What am I doing wrong, can somebody test this out?
July 1, 201411 yr Next question: What blocks do you have that could be knocking the door back to the ground?? We all stuff up sometimes... But I seem to be at the bottom of that pot.
July 2, 201411 yr Author Next question: What blocks do you have that could be knocking the door back to the ground?? I have pressure plates. Could they do it?
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.