Posted November 3, 201311 yr In my mod, I've noticed a problem where I am trying to update information in a TileEntity that has been unloaded. There isn't really a way to get around this except loading the chunk the block is in, just long enough to update the data I need. However, I have no idea how to load/unload a chunk, because I am a total n00b. Any help is appreciated. My code: https://gist.github.com/anonymous/7295390
November 4, 201311 yr From what little i have experimented with this i found out Chunk c = worldObj.getChunkFromBlockCoords(xCoord, zCoord); worldObj.getChunkProvider().loadChunk(c.xPosition, c.zPosition); Loads it some what well but i have no idea how often to call it to make it efficient and anything like that.
November 4, 201311 yr Author That doesn't appear to be helping any. Somehow my getBlockTileEntity call is returning null, so either it's a problem with that, or that code just isn't loading the chunk. I've tried changing worldObj to world (since I pass the world in my function call) and that sill didn't work. I'm at a loss.
November 4, 201311 yr You shouldn't load the chunk. If the chunk isn't loaded, save the changes somewhere, and send them to the tile entity when the chunk is loaded, using ChunkEvent.Load.
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.