本文整理汇总了Java中net.minecraft.pathfinding.Path.getCurrentPathIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Path.getCurrentPathIndex方法的具体用法?Java Path.getCurrentPathIndex怎么用?Java Path.getCurrentPathIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.pathfinding.Path
的用法示例。
在下文中一共展示了Path.getCurrentPathIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJumpUpwardsMotion
import net.minecraft.pathfinding.Path; //导入方法依赖的package包/类
protected float getJumpUpwardsMotion()
{
if (!this.isCollidedHorizontally && (!this.moveHelper.isUpdating() || this.moveHelper.getY() <= this.posY + 0.5D))
{
Path path = this.navigator.getPath();
if (path != null && path.getCurrentPathIndex() < path.getCurrentPathLength())
{
Vec3d vec3d = path.getPosition(this);
if (vec3d.yCoord > this.posY + 0.5D)
{
return 0.5F;
}
}
return this.moveHelper.getSpeed() <= 0.6D ? 0.2F : 0.3F;
}
else
{
return 0.5F;
}
}
示例2: getJumpUpwardsMotion
import net.minecraft.pathfinding.Path; //导入方法依赖的package包/类
protected float getJumpUpwardsMotion()
{
if (!this.isCollidedHorizontally && (!this.moveHelper.isUpdating() || this.moveHelper.getY() <= this.posY + 0.5D))
{
Path path = this.navigator.getPath();
if (path != null && path.getCurrentPathIndex() < path.getCurrentPathLength())
{
Vec3d vec3d = path.getPosition(this);
if (vec3d.yCoord > this.posY)
{
return 0.5F;
}
}
return this.moveHelper.getSpeed() <= 0.6D ? 0.2F : 0.3F;
}
else
{
return 0.5F;
}
}
示例3: updateAITasks
import net.minecraft.pathfinding.Path; //导入方法依赖的package包/类
public void updateAITasks()
{
if (this.currentMoveTypeDuration > 0)
{
--this.currentMoveTypeDuration;
}
if (this.carrotTicks > 0)
{
this.carrotTicks -= this.rand.nextInt(3);
if (this.carrotTicks < 0)
{
this.carrotTicks = 0;
}
}
if (this.onGround)
{
if (!this.wasOnGround)
{
this.setJumping(false);
this.checkLandingDelay();
}
if (this.getRabbitType() == 99 && this.currentMoveTypeDuration == 0)
{
EntityLivingBase entitylivingbase = this.getAttackTarget();
if (entitylivingbase != null && this.getDistanceSqToEntity(entitylivingbase) < 16.0D)
{
this.calculateRotationYaw(entitylivingbase.posX, entitylivingbase.posZ);
this.moveHelper.setMoveTo(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, this.moveHelper.getSpeed());
this.startJumping();
this.wasOnGround = true;
}
}
EntityRabbit.RabbitJumpHelper entityrabbit$rabbitjumphelper = (EntityRabbit.RabbitJumpHelper)this.jumpHelper;
if (!entityrabbit$rabbitjumphelper.getIsJumping())
{
if (this.moveHelper.isUpdating() && this.currentMoveTypeDuration == 0)
{
Path path = this.navigator.getPath();
Vec3d vec3d = new Vec3d(this.moveHelper.getX(), this.moveHelper.getY(), this.moveHelper.getZ());
if (path != null && path.getCurrentPathIndex() < path.getCurrentPathLength())
{
vec3d = path.getPosition(this);
}
this.calculateRotationYaw(vec3d.xCoord, vec3d.zCoord);
this.startJumping();
}
}
else if (!entityrabbit$rabbitjumphelper.canJump())
{
this.enableJumpControl();
}
}
this.wasOnGround = this.onGround;
}