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

I made this method to give the player more xp when he kills a mob, but it doesn't work, it simply does nothing.

 

@SubscribeEvent

public void itDied(LivingDeathEvent event)

{

Entity entity = event.entity;

DamageSource source = event.source;

System.out.println("ASTA MERGE !111111111111");

if (source.getSourceOfDamage() instanceof EntityPlayer)

{

System.out.println("ASTA MERGE!!!!");

if (event.entity instanceof EntityMob)

{

System.out.println("ASTA MERGE!!! 222222");

EntityPlayer player = (EntityPlayer) event.source.getEntity();

player.addExperience(1000);

}

}

}

 

 

 

This is the part from my main modding class:

 

public void preInit(FMLPreInitializationEvent e)

{

 

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

}

  • Author

I need a parameter for TheClassWhereYouHaveYouExperienceStuff(). It says "the constructor TheClassWhereYouHaveYouExperienceStuff() is undefined"

@Nevermind, the code example was an example and the TheClassWhereYouHaveYouExperienceStuff needs to be changed to the name of your event handler class.

 

Based on your previous code posted above, I think you called it PlayerEventHandler, so in that case it would be:

MinecraftForge.EVENT_BUS.register(new PlayerEventHandler());

 

By the way if you want to know more about event handlers, I have a tutorial with list of which events are on which bus (and explanation on how to check package to figure this out yourself), see: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • Author

Thanks jabelar, but I knew that was an example. The problem was that the name which I used was already used for something else. As for diesieben07, I don't find see a silly mistake as "not knowing absolute basics"

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...

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.