Jump to content

Recommended Posts

Posted

Hi,

I have an EvenHandler class with the PlayerRespawnEvent in it and it seems to not want to behave.

I was using the Recommended version of Forge(10.13.0.1180), but I tried it even on the Latest version(10.13.0.1208) and it still doesn't work.

 

This is my EventHandler class:

public class HEventHandler 
{
@SubscribeEvent(priority = EventPriority.NORMAL)
public void playerRespawn(PlayerInteractEvent event) 
{
	LogHelper.info("INTERACT");
}

@SubscribeEvent(priority = EventPriority.NORMAL)
public void playerRespawn(PlayerRespawnEvent event) 
{
	LogHelper.info("RESPAWN");			
}
}

 

And it's registered here:

@EventHandler
    public void init(FMLInitializationEvent event)
    {
    	MinecraftForge.EVENT_BUS.register(new HEventHandler());
    	proxy.init();
    }

 

In the console I get the "INTERACT" message when a player triggers it, so the EventHandler is working fine, I don't get the "RESPAWN" message when a player die and respawn.

Posted

I just had an idea, and it worked.

 

You have to register your EventHandler on the FML bus to make it works.

Like this:

FMLCommonHandler.instance().bus().register(new HEventHandler());

instead of

MinecraftForge.EVENT_BUS.register(new HEventHandler());

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.