Jump to content

Problem with Chunk Load Event


Recommended Posts

I'm not sure what's causing the problem, but sometimes it skips out on chunks.


My mod is supposed to generate new structures and ores after the Ender Dragon is killed. When I return to the overworld, only some chunks have the new ores.


Chunk Load Event:

public void chunkLoad(ChunkDataEvent.Load event) {
	if(!event.world.isRemote) {
		World world = event.world;
		Chunk chunk = event.getChunk();
		NBTTagCompound nbt = event.getData();
		if(!nbt.hasKey(ReferenceRF.ID)) {
			nbt.setTag(ReferenceRF.ID, new NBTTagCompound());
		nbt = event.getData().getCompoundTag(ReferenceRF.ID);
		if(!nbt.getBoolean("postDragon") && ServerProxyRF.getWorldProperty(world.getWorldInfo().getWorldName(), "hasDefeatedEnderDragon", false).getBoolean(false)) {
			nbt.setBoolean("postDragon", true);


Here's my World Tick Handler:

public class ServerWorldTickHandlerRF {
public static ArrayList<Chunk> chunksToGenerate = new ArrayList<Chunk>();

public void onWorldTick(TickEvent.WorldTickEvent event) {
		for(int i = 0; i < chunksToGenerate.size(); i++) {
			Chunk chunk = chunksToGenerate.get(i);
			for(int j = 0; j < 8; j++) {
				int x = (chunk.xPosition * 16) + event.world.rand.nextInt(16);
				int y = 128;
				int z = (chunk.zPosition * 16) + event.world.rand.nextInt(16);
				event.world.setBlock(x, y, z, Blocks.diamond_block);
				System.err.println("Generating at X: " + x + "|Y: " + y + "|Z: " + z);


Link to comment
Share on other sites

I tried that, the only other thing I noticed was that if I selected the world, it would return to the world selection menu. After a couple of seconds, it spawns me in the world. During that time, it said it was generating the stuff, but when I spawned nothing was there.


Link to comment
Share on other sites

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.

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.


  • Create New...

Important Information

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