Example usage for net.minecraftforge.event.entity.living LivingFallEvent getEntity

List of usage examples for net.minecraftforge.event.entity.living LivingFallEvent getEntity

Introduction

In this page you can find the example usage for net.minecraftforge.event.entity.living LivingFallEvent getEntity.

Prototype

public Entity getEntity() 

Source Link

Usage

From source file:com.crowsofwar.avatar.common.bending.air.AirJumpParticleSpawner.java

License:Open Source License

@SubscribeEvent
public void onFall(LivingFallEvent e) {
    if (e.getEntity() == target && !e.getEntity().worldObj.isRemote) {
        MinecraftForge.EVENT_BUS.unregister(this);
    }//from w  ww  .j  a va2s. c o  m
}

From source file:com.crowsofwar.avatar.common.FallAbsorptionHandler.java

License:Open Source License

@SubscribeEvent
public void onFall(LivingFallEvent e) {
    Entity entity = e.getEntity();
    if (entity instanceof EntityPlayer && !entity.worldObj.isRemote) {
        EntityPlayer player = (EntityPlayer) entity;
        AvatarPlayerData data = AvatarPlayerData.fetcher().fetch(player);
        if (data.getFallAbsorption() != 0) {
            e.setDistance(e.getDistance() - data.getFallAbsorption());
            if (e.getDistance() < 0)
                e.setDistance(0);//from   ww  w  .  j  av  a  2s .c o m
            data.setFallAbsorption(0);
        }
    }
}

From source file:com.sr2610.steampunkd.handlers.PlayerMovementHandler.java

License:Creative Commons License

@SubscribeEvent
public void livingFall(LivingFallEvent event) {
    if ((event.getEntity() instanceof EntityPlayer)) {
        final EntityPlayer eventPlayer = (EntityPlayer) event.getEntity();
        if (eventPlayer.getItemStackFromSlot(EntityEquipmentSlot.FEET) != null) {
            final ItemStack boots = eventPlayer.getItemStackFromSlot(EntityEquipmentSlot.FEET);
            if (boots.getItem() == ModItems.pistonBoots) {
                final int d = (int) (event.getDistance() / 2);
                if (((ISteamUser) boots.getItem()).getCurrentSteam(boots) > d) {
                    ((ISteamUser) boots.getItem()).useSteam(d, boots);
                    event.setDistance(0);
                }/*from   w w w  . ja v a 2 s .c o  m*/

            }
        }
    }

}

From source file:com.yyon.grapplinghook.items.LongFallBoots.java

License:Open Source License

@SubscribeEvent
public void onLivingFallEvent(LivingFallEvent event) {
    if (event.getEntity() != null && event.getEntity() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntity();

        for (ItemStack armor : player.getArmorInventoryList()) {
            if (armor != null && armor.getItem() instanceof LongFallBoots) {
                // this cancels the fall event so you take no damage
                event.setCanceled(true);
            }// ww w .  ja v  a  2s  . c o  m
        }
    }
}

From source file:de.canitzp.rarmor.module.jump.ItemModuleJump.java

@SubscribeEvent
public static void onFall(LivingFallEvent event) {
    Entity entity = event.getEntity();
    if (entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        if (!player.isSneaking()) {
            IRarmorData data = RarmorAPI.methodHandler.getDataForChestplate(player, false);
            if (data != null) {
                if (data.getInstalledModuleWithId(ActiveModuleJump.IDENTIFIER) != null
                        && RarmorAPI.methodHandler.getHasRarmorInSlot(player,
                                EntityEquipmentSlot.FEET) != null) {
                    event.setDistance(event.getDistance() - 2F);
                }//from  w  ww .  java2s .com
            }
        }
    }
}