当前位置: 首页>>代码示例>>Java>>正文


Java Path.getCurrentPathIndex方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:EntityRabbit.java

示例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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:EntityRabbit.java

示例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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:65,代码来源:EntityRabbit.java


注:本文中的net.minecraft.pathfinding.Path.getCurrentPathIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。