Jump to content

Recommended Posts

Posted

Hey guys!

 

I want to create a chunk loader which keeps all the chunks in an adjustable radius round the block loaded. How can I do this?

I tried the following, but this didn't work:

In a tileEntity I overrode onChunkUnloading and added the method worldObj.getChunkProvider().loadChunk(...);

 

This only caused that the server fails to shut down. The commandBlock i placed there didn't write anything in the chat as it should.

 

So, how can I create a working chunk loader block?

Posted

Basically it works fine, thanks for that!

 

But I got two problems:

First, I don't understand how to use the LoadingCallback.

Second, if I reload a world and remove the chunkloader, I get this error:

 

  Reveal hidden contents

 

 

The code of my chunkloader is this:

 

  Reveal hidden contents

 

Posted

Changed, but still get an error

(I think its the same, but I post it anyway)

  Reveal hidden contents

 

Posted

OK. I did this now, but actually it doesn't work any more.

 

I did it like this:

 

  Reveal hidden contents

 

 

Posted

Well, I now copied some if the code, but it is from 1.6 and I get some problems.

 

For example, this line of code is used very often:

world.theChunkProviderServer.loadedChunks

The problem is, that this is declared private in the class ChunkProviderServer.

 

How can I get acces to this field? Or do you know another way to get the actual loaded chunks?

  • 4 weeks later...
Posted

When I created a chunkloader for 1.6.4, I created a class and had it implement 'net.minecraftforge.common.ForgeChunkManager.LoadingCallback'.

 

WorldEvents:

public class WorldEvents implements LoadingCallback {

@Override
public void ticketsLoaded(List<Ticket> tickets, World world) {
		//TODO: somthing when the tickets are loaded

}
}

 

Immobile Entity (Loading a block should be the same.  Note: this only loads on chunk):

...
if(!worldObj.isRemote) {
Ticket ticket = ForgeChunkManager.requestTicket(AdvancedRocketry.instance, this.worldObj, Type.NORMAL);
        if(ticket != null)
      ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair((int)this.posX / 16, (int)this.posZ / 16));
}
...

 

 

Hope this helps...

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.