Jump to content

[1.8] Is it possible to display achievements on client side only? [SOLVED]


Recommended Posts

Posted

I know this is a strange question, but it is related to a requested mod from one of the Moderators of a server i play on.

Is it possible to display an Achievement to the client side only? Not actually adding an achievement, but display one anyways?

Something along the lines of thePlayer.Triggerachievement("Wow, you installed a mod.")

 

From my searching i've found server side mods that do this, but this needs to be entirely client side.

Posted

Ok so with this code in a keybind i can get the achievement to display, a second press crashes the game.

		Achievement ach;
	ach = new Achievement("achievement.LazyCheater", "LazyCheater", 0, 0, Blocks.command_block, (Achievement)null).func_180788_c();
	AchievementPage.registerAchievementPage(new AchievementPage("Troll", new Achievement[]{ach}));
	Minecraft.getMinecraft().guiAchievement.displayAchievement(ach);

 

If i place this part in the Init portion

		Achievement ach;
	ach = new Achievement("achievement.LazyCheater", "LazyCheater", 0, 0, Blocks.command_block, (Achievement)null).func_180788_c();
	AchievementPage.registerAchievementPage(new AchievementPage("Troll", new Achievement[]{ach}));

 

And this part in the keybind

Minecraft.getMinecraft().guiAchievement.displayAchievement(ach);

I get an error in code, where ach can't be resolved.

 

Basically what i'm wanting to happen is that every time a player goes into gamemode 1, they get this achievement.

So if they did gm 1, gm 0, gm 1, they would get the achievement display twice.

Posted

Ok so here's the working source, in case someone else wants to know how to do this.

 

Put this in your main mod file.

@EventHandler
public void init(FMLInitializationEvent event){
	ach = new Achievement("achievement.LazyCheater", "LazyCheater", 0, 0, Blocks.command_block, (Achievement)null).func_180788_c();
	AchievementPage.registerAchievementPage(new AchievementPage("Troll", new Achievement[]{ach}));
}
public static  Achievement ach;

Then place this code where you want the Achievement to display.

Minecraft.getMinecraft().guiAchievement.displayAchievement(yourmainmod.ach);

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.