Posted January 13, 20169 yr 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?
January 13, 20169 yr Maybe look at the code for Quarry in the Buildcraft Github? I know the quarry loads chunks. http://imageshack.com/a/img907/9908/313wU8.png[/img]
January 13, 20169 yr 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?
January 15, 20169 yr Author I'm still unable to get this working. I would be very grateful to anyone who can help.
January 16, 20169 yr 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.
January 16, 20169 yr 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.
January 18, 20169 yr I don't have my ide right now, and that's just and idea, but try passing te's coordinates to ticket requester, instead of chunk coordinates. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
January 21, 20169 yr 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.