Example usage for net.minecraftforge.event.entity.living LivingEvent.LivingJumpEvent getEntity

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

Introduction

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

Prototype

public Entity getEntity() 

Source Link

Usage

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

@SubscribeEvent
public static void onJump(LivingEvent.LivingJumpEvent 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) {
                int use = 50;
                if (data.getEnergyStored() >= use) {
                    if (data.getInstalledModuleWithId(ActiveModuleJump.IDENTIFIER) != null
                            && RarmorAPI.methodHandler.getHasRarmorInSlot(player,
                                    EntityEquipmentSlot.FEET) != null) {
                        player.motionY += 0.3;
                        data.extractEnergy(use, false);
                    }// w  ww .  j ava 2 s  . co m
                }
            }
        }
    }
}