Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
}
}
}

 

 


 

 

 

 

 

 

1.7.10 is not supported here anymore. Update to the newer versions.

This is my signature. I don't really too much know about java but i try to help and i try to get help from others too. Thank you!

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.