NomNuggetNom Posted August 10, 2014 Posted August 10, 2014 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? Quote
Mitchellbrine Posted August 10, 2014 Posted August 10, 2014 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. Quote -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
NomNuggetNom Posted August 10, 2014 Author Posted August 10, 2014 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? Quote
Mitchellbrine Posted August 11, 2014 Posted August 11, 2014 PlayerLoggedInEvent triggers on ANY server. Quote -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
NomNuggetNom Posted August 11, 2014 Author Posted August 11, 2014 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? Quote
jeffryfisher Posted August 11, 2014 Posted August 11, 2014 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. Quote 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.
NomNuggetNom Posted August 11, 2014 Author Posted August 11, 2014 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 . Quote
jeffryfisher Posted August 11, 2014 Posted August 11, 2014 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! Quote 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.
Epix Posted September 25, 2014 Posted September 25, 2014 PlayerLoggedInEvent triggers on ANY server. PlayerLoggedInEvent won't be triggered on a client side mod when joining a server. Don' know if it's designed to do so? BTW I'm using EntityJoinWorldEvent and it seems working well on client side. Quote
Recommended Posts
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.