Jump to content

PlayerEvent.PlayerLoggedInEvent doesn't work


Pandal

Recommended Posts

Hi.
I'm trying to use this event, but it doens't work, i've tried solutions of different posts in this forum, but nothing.
I don't know why but the function "onPlayerLogin" doesn't start...

This is the function: 

 

EventHandler class:

@EventBusSubscriber
public class PandalEventHandler
@SubscribeEvent
    public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)

 

Main

MinecraftForge.EVENT_BUS.register(PandalEventHandler.class);

 

PS: I'm testing it joining in my server, i need it client-side.. i think this event is client side, or not?

 

Can someone help me?

Edited by Pandal
Link to comment
Share on other sites

21 minutes ago, Pandal said:

think this event is client side, or not?

It is not client side, only server side.

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Ah.
Is there any equivalent event to use client_side?
I have to take only the player entity, nothing more.

 

Or maybe i can use the ClientConnectedToServerEvent.

Can i take player display name and the server ip using that?

Edited by Pandal
Link to comment
Share on other sites

39 minutes ago, Pandal said:

Can i take player display name and the server ip using that?

Why not try it and see if it works? And I dont think there is any problem except maybe the player won't exist.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Also, even for server side I don't think you're registering it correctly. If your even handling method is static you should use the annotation method for subscribing (whole class annotated as an event bus subscriber) or you should remove the static modifier if you continue to register it directly like you're doing.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

5 hours ago, jabelar said:

If your even handling method is static you should use the annotation method for subscribing (whole class annotated as an event bus subscriber) or you should remove the static modifier if you continue to register it directly like you're doing.

You can register the class if your methods are static, though I agree the annotation is neater.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I know your pain, what I use on the client instead is: But this also fires on dimension changes. It's useful at times, but should be used with care.

@SubscribeEvent
public static void onEvent(EntityJoinWorldEvent event)
{
    if ((event.getEntity() instanceof EntityPlayer))
    {

    }
}
Edited by Aeronica
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.