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

So one of the big justifications I get given for chunk loaders on servers (and also iirc the reason things like the buildcraft quarry chunk load) is that a lot of the automation stuff can break in horrible ways if the server has some of the chunks loaded, but not others (e.g. loads a chunk containing buildcraft combustion engines, but not the chunks containing the buildcraft water pumps that stop them exploding).

 

So my idea is basically to merge a bunch of adjacent chunks into some kind of dependency group, and make forge load and unload them all at the same time (at least on the server, don't think it matters for the client too much?).

 

 

Using the chunk loaded event I can check my dependency data, and with ForgeChunkManager can force any chunks I want to also load.

 

However my issue is how to know when my force load "ticket" is the only thing keeping all the chunks in question loaded (the players have moved away).

Like a "Ticket.isActivelyForcingChunkLoad(x,z)" method? I looked through the code, and couldn't really see anyway to determine that. The only thing I did find was in ChunkProviderServer.unloadQueuedChunks which I guess if chunksToUnload contains all the chunks that would normally be unloaded (not entirely certain, can't see how it is populated apart from the no players unloadAll case) I could in theory check to see if all my chunks are in that set, and then delete my ticket if they are. But there does not seem to any forge hook at that location for me to do so...

 

So any other ways to check the chunk unload conditions / states?

You can use the ChunkUnloadEvent, I assume.

Check that the chunk is in a group,

 

if(all chunks in this group are in the "waiting unload" list)

{ unload the group}

else

{add the chunk to the "waiting unload" list}.

  • Author

What event exactly are you thinking of? I searched through all the sources/api's I have and only came across org.bukkit.event.world.ChunkUnloadEvent, which obviously isn't useable for a forge mod.

 

Forge has a net.minecraftforge.event.world.ChunkEvent.Unload but this is only sent if the chunk is really being unloaded (from ChunkProviderServer in the loop after the force load check loop), it also doesn't say what other chunks are being unloaded, and has no way to cancel the unload (I guess to prevent mods from working around the ticket/limit system since seems forge has gone with not trusting mods in that regard?).

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.