本文整理汇总了Java中net.minecraft.entity.EntityLivingBase.isSprinting方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLivingBase.isSprinting方法的具体用法?Java EntityLivingBase.isSprinting怎么用?Java EntityLivingBase.isSprinting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.EntityLivingBase
的用法示例。
在下文中一共展示了EntityLivingBase.isSprinting方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopJump
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
@SubscribeEvent
public void stopJump(LivingEvent.LivingJumpEvent event) {
EntityLivingBase living=event.getEntityLiving();
if ((living.getActivePotionEffect(TF2weapons.stun) != null && living.getActivePotionEffect(TF2weapons.bombmrs) == null)
|| living.getActivePotionEffect(TF2weapons.charging) != null
|| (living.getHeldItemMainhand() != null && living.getHeldItemMainhand().getItem() instanceof ItemMinigun
&& living.hasCapability(TF2weapons.WEAPONS_CAP, null) && living.getCapability(TF2weapons.WEAPONS_CAP, null).chargeTicks > 0)) {
living.isAirBorne = false;
living.motionY -= 0.5f;
if (living.isSprinting()) {
float f = living.rotationYaw * 0.017453292F;
living.motionX += MathHelper.sin(f) * 0.2F;
living.motionZ -= MathHelper.cos(f) * 0.2F;
}
}
}
示例2: spinMinigun
import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
public void spinMinigun(ItemStack stack, final EntityLivingBase living, World world) {
if (super.canFire(world, living, stack)) {
WeaponsCapability cap = living.getCapability(TF2weapons.WEAPONS_CAP, null);
float ammo=TF2Attribute.getModifier("Ammo Spinned", stack, 0, living);
int spinuptime=(int) TF2Attribute.getModifier("Minigun Spinup", stack, 18, living);
if(cap.chargeTicks >= spinuptime || (living instanceof EntityPlayer && ((EntityPlayer) living).isCreative())) {
if(cap.minigunTicks<20)
cap.minigunTicks+=1;
if( ammo > 0 && !ItemAmmo.searchForAmmo(living, stack).isEmpty()) {
if ((living.ticksExisted % (20/ammo)) == 0) {
ItemAmmo.consumeAmmoGlobal(living, stack, 1);
}
}
if(living.ticksExisted % 10 == 0) {
float flamedmg=TF2Attribute.getModifier("Ring Fire", stack, 0, living);
if(flamedmg > 0) {
if(world.isRemote ) {
for(int i=0;i<50;i++)
ClientProxy.spawnFlameParticle(world, living, 0, true);
}
else {
for(EntityLivingBase target:world.getEntitiesWithinAABB(EntityLivingBase.class, living.getEntityBoundingBox().grow(4, -0.5, 4).offset(0, -0.5, 0), new Predicate<EntityLivingBase>() {
@Override
public boolean apply(EntityLivingBase input) {
// TODO Auto-generated method stub
return input != living && TF2Util.canHit(living, input) && input.getDistanceSqToEntity(living)<16;
}
})){
TF2Util.dealDamage(target, world, living, stack, 0, flamedmg, TF2Util.causeDirectDamage(stack, living, 0).setFireDamage());
TF2Util.igniteAndAchievement(target, living, 7);
}
}
}
}
}
if (living.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getModifier(slowdownUUID) == null)
living.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).applyModifier(slowdown);
if (living.isSprinting()){
living.motionX *= 0.6D;
living.motionZ *= 0.6D;
living.setSprinting(false);
}
if(world.isRemote)
ClientProxy.removeSprint();
if (cap.fire1Cool <= 0 && cap.chargeTicks < spinuptime)
cap.chargeTicks += 1;
}
}