Jump to content

[1.7.10] Achievements not being awarded


NomNuggetNom

Recommended Posts

I followed

on creating custom achievements. My achievement page is appear correctly, but my achievements are not being rewarded. Here's my first achievement:

 

	public static Achievement playCTF = new Achievement("achievement.playCTF", "playCTF", 0, 0, Items.nether_star, (Achievement)null).initIndependentStat().registerStat();

 

Again, it's in the achievement page and everything, so that's fine. Basically, the purpose of the achievement is to detect when I log onto a certain server. So, I use the event onJoin to detect this:

 

@SubscribeEvent
public void onJoin(EntityJoinWorldEvent event) {
	if (mc.func_147104_D().serverIP.endsWith("ip removed")) {
		EntityPlayer p = (EntityPlayer)event.entity;
                        System.out.println("Trigger achievement!");
		p.addStat(Achievements.playCTF, 1);
	}

 

Now, "Trigger achievement" is getting printed out, but nothing else is happening. It is not saying my achievement is "Taken!" or anything. Any ideas?

 

 

 

Link to comment
Share on other sites

I'm going to assume everything is set up correctly about the achievement, in which case, make the event a PlayerLoggedInEvent. That should make it work.

-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

I'm going to assume everything is set up correctly about the achievement, in which case, make the event a PlayerLoggedInEvent. That should make it work.

 

That event doesn't seem to be firing. Also, what if I wanted to trigger an achievement outside of an event, or with an event that doesn't include the player as a parameter?

 

EDIT: Worked in single player, which doesn't make any sense at all. Especially because I checked the IP. Now I'm not sure what the problem is...

EDIT 2: I'm thinking it checked the IP of the last server I joined.. or something. Is it possible to trigger custom achievements while logged onto a vanilla server?

Link to comment
Share on other sites

PlayerLoggedInEvent triggers on ANY server.

-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

PlayerLoggedInEvent triggers on ANY server.

 

Just to be clear, I am creating a client-side only mod for playing on a vanilla server. Does it still trigger?

Oops, I doubt it. Client-only mods can process and reveal data from the server (hence the notorious "X-ray" mods), but they can't change the world. You might eventually program something client-side that will tell you that you earned an achievement, but your vanilla client won't fire via the usual vanilla client pathways (it's not receiving the server packets telling it to do so).

 

If you walk through the vanilla code behind your stat call, you'll probably find one of those pesky "!isRemote()" tests barring the gate.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

PlayerLoggedInEvent triggers on ANY server.

 

Just to be clear, I am creating a client-side only mod for playing on a vanilla server. Does it still trigger?

Oops, I doubt it. Client-only mods can process and reveal data from the server (hence the notorious "X-ray" mods), but they can't change the world. You might eventually program something client-side that will tell you that you earned an achievement, but your vanilla client won't fire via the usual vanilla client pathways (it's not receiving the server packets telling it to do so).

 

If you walk through the vanilla code behind your stat call, you'll probably find one of those pesky "!isRemote()" tests barring the gate.

 

Thank you, that must be the problem. I'm having a similar problem with playing custom sounds. What a shame :(.

Link to comment
Share on other sites

Now hold on a second... Playing a custom sound is a display idiosyncracy, so that is something that you should be able to do client-only. As long as your client has the data, it should be able to decide what sound to play when (just like an X-Ray mod that shows to much).

 

A custom sound issue is OT, so start a new thread if you want help with it (but work on it first). Good luck!

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

  • 1 month later...

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.