Jump to content

[SOLVED] Achievement "ItemPickupEvent" with metadata


Raffox97

Recommended Posts

Hi at all, i immediately explain my problem. I want to create an achievement that be triggered when I pick up a Lapis Lazuli, the problem is that the Lapis Lazuli is a dye and it create a problem with the mod that I'm making, because if i insert the code of the Lapis Lazuli the achievement don't be triggered but if i remove the metadata and I leave only the data of the ink sac, it working. Can anyone explain me that?

Link to comment
Share on other sites

Here's the code:

 

MineEvent/Pickup Event:

public class MineEvent {

 

@SubscribeEvent

public void getMinedThings(PlayerEvent.ItemPickupEvent e){

if(e.pickedUp.getEntityItem().isItemEqual(new ItemStack(Items.dye, 1, 3))){

e.player.addStat(GenericMod.LapisLazuliAchievement, 1);

}

}

 

}

 

GenericMod class:

        @EventHandler

        public void load(FMLInitializationEvent event)

        {

          LapisLazuliAchievement = new Achievement("achievement.LapisLazuliAchievement", "LapisLazuliAchievement", 8, 4, new ItemStack(Items.dye, 1, 4), AchievementList.buildBetterPickaxe).registerStat();

        FMLCommonHandler.instance().bus().register(new MineEvent());

       

        proxy.registerRenderers();

        }

}

 

I've taken away many thing as you see, but in the original class there are still here.

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.