Jump to content

[1.7.10]Help With Adding Achievements


EsvDefcon

Recommended Posts

Hi,

 

So, I am trying to add achievements to my mod. Well, I say trying, but I've got the first achievement working fine (which is unlocked when you craft a block). What I'm trying to do now is to add an achievement when a certain button is activated in my GUI. What I'm looking for is a method that I can use to add my achievement to the player when the GUI button is pressed. i tried assigning an int veriable to it (I have the int change to 1 when the button was pressed, and an if statement saying that if the int was equalt to 1, then it would add the achievement to the player, but I couldn't do this because I needed to use an existing method to call whatever.player.addStat(achievement, 1);). Anyway, does anyone know how I can add the achievement when the button is pressed?

 

Thanks in advance :)

Link to comment
Share on other sites

Thanks, any idea on how to go about doing this? I get the idea behind it, but I need to use a method which I can actually call the player from to be able to add the achievement to them. And (just in case it makes any difference), my buttons run straight to another class which handles them.

Link to comment
Share on other sites

Alright, I tried using entityplayer.triggerAchievement inside of the method which handles when the buttons are pressed. Under the button I want to trigger the achievement, I put the entityplayer reference. Obviously I have to use a reference of this instead of using EntityPlayer.triggerAchievement (correct me if I'm wrong), so I added the parameter EntityPlayer entityplayer into the moethod's parameters. I get no errors, open up Minecraft, but when I go to test it out the buttons press but now have no functionality. So, this whole method was f***d up by this, basically.

 

So, after this, I tried making a new method to give the achievement (with the parameter EntityPlayer entityplayer), and I tried calling that from inside of my GUI button method. Now, that (for some reason) didn't work. When I call this method, I may be using the wrong parameter, or at least I'm guessing so. Here's the method I made:

 

public void getAchievementShipwright(EntityPlayer entityplayer) {

entityplayer.triggerAchievement(Skyline.achievementShipwright);

}

 

To call it, I have to use getAchievementShipwright(), but what parameter should I use when calling it? Thanks to anyone who can help, and sorry for the stupid questions, I've been working on fixing bugs with the mod for the past few hours and I'm getting tired now.

Link to comment
Share on other sites

Alright, I already have the serverStarting(FMLServerStartingEvent event) method for registering my mod's commands, and I read that you can just register a new packet channel in this method. So, I gave it a go, but I didn't really get very far with it. Can you help me with sending a packet to the server to do this? And thanks for your help so far :)

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.