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

The following are Jave code examples for showing how to use isSprinting() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ExPetrum   File: PlayerManager.java   View Source Code Vote up 6 votes
public static void handleHungerChange(EntityPlayer of, IExPPlayer data, float multiplier)
{
	float cRemoved = 0.05f;
	if (of.isSprinting() && multiplier == 1)
	{
		cRemoved *= 2;
	}
	
	cRemoved *= multiplier;
	if (!of.capabilities.isCreativeMode)
	{
		data.setCalories(data.getCalories() - cRemoved);
		float cCurrent = data.getCalories();
		for (FoodGroup n : FoodGroup.values())
		{
			data.setNutritionLevel(Math.max(0, data.getNutritionLevel(n) - (cCurrent >= 500 ? 0.001F : 0.005F) * multiplier), n);
		}
	}
}
 
Example 2
Project: ExPetrum   File: PiercingDash.java   View Source Code Vote up 4 votes
@Override
public boolean canExecute(EntityPlayer player, WeaponType currentWeapon, EnumWeaponWeight currentWeaponWeight, boolean invokedWithRightClick)
{
	return player.getActiveItemStack().isEmpty() && (player.isSprinting() && !invokedWithRightClick && (currentWeapon.isAssociated(WeaponType.SWORD) || currentWeapon.isAssociated(WeaponType.SPEAR) || currentWeapon.isAssociated(WeaponType.DAGGER)));
}