Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Author

I did it here:

 

@EventHandler

    public void preInit(FMLPreInitializationEvent event)

    {

    yourworldtype = new AntLionType("AntLion Farm");

    GameRegistry.registerWorldGenerator(caveSphere, 1);

    }

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.

  • Author

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?

  • Author

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.