Jump to content

[1.7.10]help onItemUse sending chat message twice [solved]


spiderbiggen

Recommended Posts

For my mod i made an item to help me with debugging. It currently sends a chat message with the metadata of the block i use it on but it sends this text message twice. Any help as on why. I'm a beginner with modding so it might be that I'm missing something pretty obvious... also i can't post code right now because I'm on mobile.

Link to comment
Share on other sites

I'm quite the beginner too, hehe.

I think the person above might've been correct. You might want to redirect the message ONLY to the client, as it might be calling on both server AND client.

From my knowledge, you can try putting this before the method that sends the message:

@SideOnly(Side.CLIENT) // DO NOT add a ; after this

And, you might want to import these two things at the beginning of your code:

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

 

I hope I help. :)

Link to comment
Share on other sites

NO! DO NOT USE @SideOnly! Use

 

if (world.isRemote) {
// Do things!
}

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.