Jump to content

Achievement not working - please help (MC 1.7.10)


tsant2009

Recommended Posts

Hello all,
I am trying to program an achievement on picking up a certain item in my mod, but cannot get it to work.
My mod is targeting MC 1.7.10. I know it's old but I like to work with that version for now.
This is the relevant code (I think) in my Mod, and I suspect something is not right - please help me:

 

Spoiler

(from my main class)

@EventHandler
public void init(FMLInitializationEvent event)
{
Item linxiumItem = new LinxiumItem("linxiumItem");
GameRegistry.registerItem(linxiumItem, "linxiumItem");

ach = new Achievement("", "LinxiumAchievement", 0, 0, linxiumItem, null);
FMLCommonHandler.instance().bus().register(new EventListener());
}

 

(my item class)

public class LinxiumItem extends Item {
public LinxiumItem(String itemName)
{
this.setUnlocalizedName(itemName);
this.setTextureName(ExampleMod.MODID + ":" + itemName);
this.setCreativeTab(CreativeTabs.tabMisc);
}
}

 

(my event listener)

public class EventListener {
public void pickup(ItemPickupEvent event)
{
if(event.pickedUp.getEntityItem().getItem() == ExampleMod.linxiumItem)
{
event.player.addStat(ExampleMod.ach, 1);
}
}
}

 

 


 

 

 

 

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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