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

Posted

Hi, I'm porting my mod that generates roads across the overworld to Forge since I'd like for it to play nice with other mods. This is my first time working with Forge. The original mod modifies Chunk.java by adding a new variable called roadData to keep track of generated roads. How and where would I be able to achieve the same thing in Forge, since the idea is to not modify the base Minecraft classes? Or would I have to do something else entirely?

  • Author

I understand how to make my own WorldGen, I can easily add methods that generate one-off structures during chunk generation. However a road is a continuous, potentially infinite curve that snakes through the world so it has to be generated chunk by chunk as the player explores: Only it's start or end can be one-off events. I achieved this functionality in the non-forge version of my mod by adding an array of three points to Chunk.java called roadData. If the chunk contained a point on a highway's curve, roadData would contain the coordinates of that point and of the two adjacent points, so that chunks generating nearby could detect it and see if they had to continue the roadway (And likewise determine the next point in the road's curve).

 

I can no longer edit Chunk.java if I'm to be forge compatible, and I don't know how I could do so by creating my own WorldGen. I'm not a newb but am by no means a master at this stuff, so some guidance would be totally appreciated. Thanks :)

  • Author

Not dense at all, that's a great idea. I think that might have been my original plan, but I wasn't sure if data being stored in my WorldGen would get saved on exit the same way that data in Chunk instances do. Would I need do to anything special to make sure my road data saves if it's in the WorldGen or is that already taken care of by Minecraft?

Not dense at all, that's a great idea. I think that might have been my original plan, but I wasn't sure if data being stored in my WorldGen would get saved on exit the same way that data in Chunk instances do. Would I need do to anything special to make sure my road data saves if it's in the WorldGen or is that already taken care of by Minecraft?

Oh, I see. I suspect you would. I don't know much about this sort of thing, but I think you want to create an extension of WorldSavedData and then use world.perWorldStorage.setData("id",myWSD);

 

Of course, someone's going to tell me I'm wrong or there's a far more elegant way to do it, which I welcome.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

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.