Posted January 23, 201510 yr 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)
January 24, 201510 yr Author yes i tested that in suvival, eg. jump of a tree and get hurt^^ Event didn't get catched...
January 24, 201510 yr 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!
January 24, 201510 yr The fall event works well for me. Are you sure you actually registered the handling class to the bus? Post your code for registering the handler. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
January 24, 201510 yr Author As i said before, its in Mod's Main-class, however here's the whole main-class http://pastebin.com/30MYzRXd
January 24, 201510 yr 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. http://i.imgur.com/NdrFdld.png[/img]
January 24, 201510 yr 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.