Jump to content

Recommended Posts

Posted

I did it here:

 

@EventHandler

    public void preInit(FMLPreInitializationEvent event)

    {

    yourworldtype = new AntLionType("AntLion Farm");

    GameRegistry.registerWorldGenerator(caveSphere, 1);

    }

Posted

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.

Posted

I'm a little confused.  How does that help me?  Im using it as an IWorldGenerator and i don't believe i can use chunk coords there.  Can you explain?  Also wouldnt this cut off anything going into another chunk completly?

Posted

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?

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.