Jump to content

[1.8] Events don't fire on server


Jedispencer21

Recommended Posts

Right now I am working on a small HUD that for some of the elements use events to set a boolean to true, they work fine on single player, but when I'm on a server, they don't work. What I'm wondering is how to handle this. (Events I use are PlayerPickupXpEvent and EntityItemPickupEvent)

Link to comment
Share on other sites

Learn how to use proxies.

 

Client proxy will fire only on client.jar. Server only for dedicated.jar (your server).

 

You did event registration in ClientProxy - that's why it doesn't exist on server.

You need to separate Client events (such as HUD, gui, render) and all other (pickup events) to 2 separate classes and register them accordingly.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Only if you need it.

I told you - learn what a proxy is.

 

There are 2 possible ways of launching minecraft - with client.jar and server.jar (refered to as dedic).

 

In your mod you can define 2 classes - server and client proxy.

Say you have:

@SidedProxy(clientSide = "client.ClientProxy", serverSide = "server.ServerProxy")
public static CommonProxy proxy;

 

ServerProxy and ClientProxy would extend abstract CommonProxy.

Now - you can call abstract method proxy.somethingAbstract();

That will be overriden by client/server proxy.

 

When you are on client.jar - ClientProxy would be called. When on dedic.jar - server one.

 

Ideally - ALL events that should work for server and client should be in CommonProxy (SP is ALSO a server, but only in mea of logical side, not actual "dedic"). All stuff that is client side goes to ClientProxy. ServerProxy on the other had (since SP also needs server events that are placed in CommonProxy) would be used only for server.jar exclusive features - e.g when you are coding special config files for server only.

1.7.10 is no longer supported by forge, you are on your own.

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.