Jump to content

Custom Structure with Metadata and Other Problems


ess0523

Recommended Posts

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.