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 just want to Register an LivingFallEvent, to prevent players Fall-Damage, but the @SubscribeEvent is not catched somehow....

 

 

 

package com.nextlevelminecraft.cad435.TNL_Client_Dependencies.Glider_Framework;

 

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import net.minecraftforge.event.entity.living.LivingFallEvent;

 

public class PreventGliderFalldamage {

 

    @SubscribeEvent(receiveCanceled = true)

    private void onFall(LivingFallEvent event) {

 

        System.out.println("EVENT!");

 

 

        if (event.entityLiving instanceof EntityPlayerMP)

            if (event.source  == DamageSource.fall)

            if (Framework.isGliderinInventory((EntityPlayer) event.entityLiving)) {

 

            //todo here

 

            }

 

    }

 

}

 

(Console didn't print out "EVENT!" at any time...)

 

According to this list: https://dl.dropboxusercontent.com/s/h777x7ugherqs0w/forgeevents.html

it has to be registered on MinecraftForge.EVENT_BUS , wich i've done Here:

 

 

    //main class

    //some code here...

   

    @Mod.EventHandler

    public void PreInit(FMLPreInitializationEvent e)

    {

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

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

        com.nextlevelminecraft.cad435.TNL_Client_Dependencies.MoreStuff.MoreStuff.PreInitial();

 

        proxy.ServerChecker();

        proxy.ClientChecker();

        proxy.ClientPreInit();

 

    }

 

    //some code here...

 

 

 

and i think i had this with an PlayerLoggedOutEvent too, a short time ago but haven't think about it because i did it another way...

 

(running on Forge #1291)

  • Author

yes i tested that in suvival, eg. jump of a tree and get hurt^^

 

Event didn't get catched...

I had the same problem with a LoggedOut and Joined Event a while ago. Could it be that it wasn't me who did something wrong?

 

Here could be your advertisement!

Event handling methods need to be public; yours is private.

 

Also, LivingFallEvent does not have a DamageSource 'source' member - that should be giving you an error.

 

PlayerLoggedInEvent, btw, is on the FML bus, not the regular event bus, which is probably why it didn't work for you.

  • Author

Event handling methods need to be public; yours is private.

 

thats it, thx!

 

and the lines of code below the "if(..." are actually marked as a comment, but idk why the "/*" symbols aren't there^^

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.