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

I'm trying to create a simple chunk loader to load just the chunk the block is located in. I read about Forge's ticket system, however I'm not sure I understand it. This is what I have so far:

public class TileLoader extends TileEntity {
private ForgeChunkManager.Ticket ticket;

@Override
public void validate() {
	super.validate();
	if (!worldObj.isRemote && ticket == null) {
		ticket = ForgeChunkManager.requestTicket(LoaderTest.instance, this.worldObj, ForgeChunkManager.Type.NORMAL);
		ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(this.xCoord / 16, this.yCoord / 16));
	}
}

@Override
public void invalidate() {
	super.invalidate();
	ForgeChunkManager.releaseTicket(ticket);
}
}

With this code, many more tickets are created than needed and it doesn't seem to even load the chunk it is.

What have I done wrong?

  • Author

Thanks for your suggestion. If I'm reading Buildcraft's code correctly, the ticket is created and used in the TileEntity update method with an initialized boolean to make sure that it only happens once. I tried using this method rather than the validate function, however it did not been to change the results. Many more tickets are created than needed and the chunk doesn't seem to be loaded.

Any other suggestions?

What is it about player entities that keeps chunks loaded around them? Could you imitate that? Or, create a special entity (or tile entity) that tricks the vanilla system into keeping its chunk loaded... sort of like a phantom player with observation radius 1.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

  • Author

I mean I'd rather go through forge's system for it. I'm pretty sure the vanilla player entity loads chunks in a completely separate way. There's no need to "trick" the system when forge has a system built just for this. I just can't figure out how to use forge's system.

  • Author

Well this is embarassing....

new ChunkCoordIntPair(this.xCoord / 16, this.yCoord / 16)

when forcing the chunk. I used the yCoord instead of the zCoord.

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.