Jump to content

WorldLoad Event


pjlasl

Recommended Posts

I am trying to display a message to the player, my mods name and version number when the world loads.

 

I created a worldevent.load method but I noticed it fires off three times. I placed the Event_bus register in the Init method. Can someone help me out here?

 

Here i my event class

 

import java.util.logging.Level;

import lcspm.lib.LogHelper;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.WorldEvent;

public class WorldLoadListener {

@ForgeSubscribe
public void onWorldLoad(WorldEvent.Load event)
{

	String world = null;
	world = event.world.getWorldInfo().getWorldName();


	if (event.world.isRemote) {			
		LogHelper.log(Level.INFO, world + " is remote");
	}
	else {
		LogHelper.log(Level.INFO, world + " is not remote");
	}

}
}

 

The output is as follows (notice the 3 bold areas):

2013-09-09 11:09:56 [iNFO] [LCSPM] New World1 is not remote

2013-09-09 11:09:56 [iNFO] [LCSPM] New World1 is not remote

2013-09-09 11:09:56 [iNFO] [Minecraft-Server] Preparing start region for level 0

2013-09-09 11:09:57 [iNFO] [Minecraft-Server] Preparing spawn area: 82%

2013-09-09 11:09:58 [iNFO] [sTDOUT] loading single player

2013-09-09 11:09:58 [iNFO] [Minecraft-Server] Player64[/127.0.0.1:0] logged in with entity id 208 at (80.90360859928775, 64.0, 280.1289411981967)

2013-09-09 11:09:58 [iNFO] [Minecraft-Server] Player64 joined the game

2013-09-09 11:09:58 [iNFO] [LCSPM] MpServer is remote

 

I also looked into creating a TickHandler using the WorldLoad but it never seems to fire.

 

Any help would be greatly appreciated.

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.

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.