Jump to content

Recommended Posts

Posted

I've been modding for a few months now and I've always build my mod by putting it into the src/minecraft folder and then running recompile.sh and then reobfuscate_srg.sh. And it worked flawlessly on both client and server side.

But the last time I tried it I keep getting errors when I try to run it on a server (client still works perfectly)

The errors vary but they are all NoSuchMethod/NoSuchField (not sure if exact name, but shouldn't matter) exceptions, thrown by fields such as this:

 

@SideOnly(Side.CLIENT)

private Icon[] icon = new Icon[2];

 

And if I comment that one out, then some other client only field throws the same/similar exception (EntityPlayerSP from when one of my events loads up, even though I don't import/use it anywhere in the methods).

I tried using the last 3 versions of forge (930 and beyond) getting the same results.

 

Am I doing something wrong? Can someone point me out on the right direction.

 

Thank you :)

Posted

you're accessing client on fields on the dedicated server.

They flat out do not exist on the dedicated server.

Hence why they are CLIENTonly

Quit referencing code that doesn't exist.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

but for example.. the icon variable I showed.

I only use it twice... creating the variable, and then registering it (in that usual method), both with the SideOnly(Side.Client) annotation.

 

If that's wrong, than how am I meant to register block icons for example?

Posted

private Icon[] icon = new Icon[2];

The 'icon = new Icon[2];' Is actually code that is compiled into your constructor.

So if you have side only fields, you can't use inline initalizers.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.