Example usage for net.minecraftforge.common ForgeHooks onLivingJump

List of usage examples for net.minecraftforge.common ForgeHooks onLivingJump

Introduction

In this page you can find the example usage for net.minecraftforge.common ForgeHooks onLivingJump.

Prototype

public static void onLivingJump(LivingEntity entity) 

Source Link

Usage

From source file:com.blogspot.jabelarminecraft.magicbeans.entities.EntityGiant.java

License:Open Source License

/**
  * Causes this entity to do an upwards motion (jumping).
  *//*from ww w  .ja  va  2 s  . co  m*/
@Override
public void jump() {
    motionY = 0.41999998688697815D * 1.5;
    isAirBorne = true;
    ForgeHooks.onLivingJump(this);
}

From source file:EJ.entity.WitherSpider.java

License:LGPL

protected void jump() {
    this.motionY = 0.62D;

    if (this.isPotionActive(Potion.jump)) {
        this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);
    }/*from   w  w  w.j  a v  a 2  s . c  o m*/

    if (this.isSprinting()) {
        float f = this.rotationYaw * 0.017453292F;
        this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
        this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
    }

    this.isAirBorne = true;
    ForgeHooks.onLivingJump(this);
}

From source file:k4unl.minecraft.doubleJump.network.MessageKeyPressed.java

License:Open Source License

@Override
public void handleServerSide(MessageKeyPressed message, EntityPlayer player) {
    switch (keyIndex) {
    case 0://  w  ww .  jav  a 2 s. c o m
        NBTTagCompound tCompound = player.getEntityData();
        if (tCompound.hasKey("hasJumped")) {
            if (player.motionY < 0.4
                    && tCompound.getInteger("hasJumped") < DJConfig.INSTANCE.getInt("maxJumps")) {
                if (DJConfig.INSTANCE.getBool("secondJumpUsesHunger")) {
                    player.jump();
                } else {
                    player.motionY = 0.41999998688697815D;

                    if (player.isPotionActive(Potion.jump)) {
                        player.motionY += (double) ((float) (player.getActivePotionEffect(Potion.jump)
                                .getAmplifier() + 1) * 0.1F);
                    }

                    if (player.isSprinting()) {
                        float f = player.rotationYaw * 0.017453292F;
                        player.motionX -= (double) (MathHelper.sin(f) * 0.2F);
                        player.motionZ += (double) (MathHelper.cos(f) * 0.2F);
                    }

                    player.isAirBorne = true;
                    ForgeHooks.onLivingJump(player);
                }
                player.motionY += DJConfig.INSTANCE.getDouble("jumpBoost");
                player.velocityChanged = true;
            }
        }
        break;
    }
}