Jump to content

Underground structures stacking on each other.(screenshots)


TheRPGAdventurer

Recommended Posts

So I tried to make my structure look for air blocks, then spawn it in there. My suspicion with my problem is that air blocks with the requirements are rare thus making it stack on each other. Other people doesn't seem to have this problem tho. I always see that the issue is on the Y level.

public static void generateNestUnderground(World world, Random random, int x, int z) {
	     int xzCheckDistance = 10;
	     if((random.nextInt(125)) == 1) {
	         for (int y = 55; y >= 30; y--) {
	             if (world.getBlockState(new BlockPos(x,y,z)).getBlock().isAir(world.getBlockState(new BlockPos(x,y,z)), world, new BlockPos(x,y,z))) {
	                 for (int y2 = 1; y2 <= 30; y2++) {
	                     if (world.getBlockState(new BlockPos(x,y-y2,z)).isBlockNormalCube()) {
	                         int y4 = 0;
	                         int y5 = 0;
	                         for (int x2 = 0; x2 <= xzCheckDistance; x2++) {
	                             if (world.getBlockState(new BlockPos(x-x2,y-y2+y4 +1,z)).isBlockNormalCube()) {
	                                 Boolean wall = true;
	                                 for (int y3 = 1; y3 <= 4; y3++) {
	                                     if (!world.getBlockState(new BlockPos(x-x2,y-y2+y4+1+y3,z)).isNormalCube()) {
	                                         wall = false;
	                                         y4 += y3;
	                                         break;
	                                     }
	                                 }
	                                 if (wall) {
	                                     if (world.getBlockState(new BlockPos(x - x2, y - y2 + y4, z)).isNormalCube()) {
	                                         StructureDragonNests.generate(world, new BlockPos(x - x2, y - y2 + y4, z), random);
                                       	     Utils.getLogger().info("Underground Nest here at:"  +  new BlockPos(x - x2, y - y2 + y4, z));
                                       }return;
                                   }
                               }
                           } break;
                       }
                   }
               }
           }
       }
	}
}

 

2017-09-02_11.51.41.png

2017-09-03_00.53.36.png

2017-09-03_00.53.43.png

2017-09-03_00.53.58.png

Edited by TheRPGAdventurer
screenshots
Link to comment
Share on other sites

I suggest that you search for a simpler air pocket and then enlarge the pocket to accommodate your structure (or include surrounding air as part of your structure). Also, if you see stacking, then your search needs to be reprogrammed so that block-changes made by one insertion will affect the results of the next search (preventing overlap).

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Just now, jeffryfisher said:

I suggest that you search for a simpler air pocket and then enlarge the pocket to accommodate your structure (or include surrounding air as part of your structure). Also, if you see stacking, then your search needs to be reprogrammed so that block-changes made by one insertion will affect the results of the next search (preventing overlap).

what's the difference of isNormalCube and isBlockNormalCube?

Link to comment
Share on other sites

4 hours ago, TheRPGAdventurer said:

what's the difference of isNormalCube and isBlockNormalCube?

Right click -> References -> Find in workspace -> learn

  • Like 1

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.

Link to comment
Share on other sites

1 hour ago, TheRPGAdventurer said:

Another question, what is the uppermost y level of the nether(bedrock.)

Start new game (Creative) -> Travel to the nether -> hit F3 -> Punch your way to the ceiling

 

Seriously. Learn how to figure this shit out for yourself. It's probably also on the wiki.

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.

Link to comment
Share on other sites

1 minute ago, Draco18s said:

Start new game (Creative) -> Travel to the nether -> hit F3 -> Punch your way to the ceiling

 

Seriously. Learn how to figure this shit out for yourself. It's probably also on the wiki.

My computer is kinda laggy for this sometimes, I already found the answer on the wiki. BTW! Thanks for making me learn to myself and notjust turn into some script kiddie.

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.