Jump to content

[1.8] Generating a sphere of air?


drok0920

Recommended Posts

I am making a custom world type with a custom generater and it works but i cant seem to get a sphere of air to generate.  I ttied using the solution here:

http://www.minecraftforge.net/forum/index.php?topic=24403.0

but with no success.  It throws and Index of of bounds eception.  So my question is how can i get it to generate it.

 

Thanks in advanced.

Link to comment
Share on other sites

Show where and how you registered your IWorldGenerator

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

You just need to check the chunk bounds while generating, or even just check if the chunk for each given position is loaded, but that's a lot more checks than simply restricting your bounds.

 

Given a set of block coordinates x/y/z, the chunk coordinates are (x >> 4) and (z >> 4), which is equivalent to (x / 16) and (z / 16). That will give you the (0, 0) of your current chunk, but you want block coordinates so multiply it by 16 again to get those.

// example
int x = 64;
int z = 72;
int cx = (x >> 4); // gives you 4
int cz = (z >> 4); // also gives you 4
cx = (cx << 4); // gives you 64
cz = (cz << 4); // also gives you 64
// (64, 64) is your zero position for the block coordinates (64, 72)

// This iterates over every x position in the chunk:
for (int i = cx; i < cx + 16; ++i) {
   // put z position, etc.
}

Or, once you've found the zero position, you can also set the max (zero + 16), and the make sure every block position you set is within those bounds.

Link to comment
Share on other sites

Yes i'm aware that minecraft is generated in chunks my concern was that what ever is getting "cut off" will never be generated at all meaning that a sphere larger han 16/16 will no longer be a sphere.  But im still confused... can i have an example?

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.



×
×
  • Create New...

Important Information

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