Java Code Examples for net.minecraft.entity.player.EntityPlayer#jump()

The following examples show how to use net.minecraft.entity.player.EntityPlayer#jump() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@SubscribeEvent
public void onEntityFall(LivingFallEvent event) {
	if (event.getEntityLiving() instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer) event.getEntityLiving();
		for (ItemStack armor : player.getEquipmentAndArmor()) {
			if (armor.getItem() instanceof GTItemSpringBoots) {
				float amount = event.getDistance();
				if (amount < 20) {
					event.setResult(Event.Result.DENY);
					event.setCanceled(true);
				} else {
					armor.damageItem(Math.round(amount), player);
					event.setDamageMultiplier(event.getDamageMultiplier() * 0.5F);
					player.jump();
					event.getEntity().playSound(GTSounds.SPRING, 1.0F, 1.0F
							+ player.getEntityWorld().rand.nextFloat());
				}
			}
		}
	}
}
 
Example 2
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
	Potion jump = MobEffects.JUMP_BOOST;
	if (!player.isPotionActive(jump)) {
		player.addPotionEffect(new PotionEffect(jump, 10, 2, false, false));
	}
	if (player.onGround && player.isSprinting()) {
		player.jump();
		player.playSound(GTSounds.SPRING, 1.0F, 1.0F + world.rand.nextFloat());
		if (world.rand.nextInt(2) == 0) {
			stack.damageItem(1, player);
		}
	}
}