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


Java PathEntity.getPosition方法代码示例

本文整理汇总了Java中net.minecraft.pathfinding.PathEntity.getPosition方法的典型用法代码示例。如果您正苦于以下问题:Java PathEntity.getPosition方法的具体用法?Java PathEntity.getPosition怎么用?Java PathEntity.getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.pathfinding.PathEntity的用法示例。


在下文中一共展示了PathEntity.getPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateAITasks

import net.minecraft.pathfinding.PathEntity; //导入方法依赖的package包/类
public void updateAITasks()
{
    if (this.moveHelper.getSpeed() > 0.8D)
    {
        this.setMoveType(EntityRabbit.EnumMoveType.SPRINT);
    }
    else if (this.moveType != EntityRabbit.EnumMoveType.ATTACK)
    {
        this.setMoveType(EntityRabbit.EnumMoveType.HOP);
    }

    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.field_175537_bp)
        {
            this.setJumping(false, EntityRabbit.EnumMoveType.NONE);
            this.func_175517_cu();
        }

        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.doMovementAction(EntityRabbit.EnumMoveType.ATTACK);
                this.field_175537_bp = true;
            }
        }

        EntityRabbit.RabbitJumpHelper entityrabbit$rabbitjumphelper = (EntityRabbit.RabbitJumpHelper)this.jumpHelper;

        if (!entityrabbit$rabbitjumphelper.getIsJumping())
        {
            if (this.moveHelper.isUpdating() && this.currentMoveTypeDuration == 0)
            {
                PathEntity pathentity = this.navigator.getPath();
                Vec3 vec3 = new Vec3(this.moveHelper.getX(), this.moveHelper.getY(), this.moveHelper.getZ());

                if (pathentity != null && pathentity.getCurrentPathIndex() < pathentity.getCurrentPathLength())
                {
                    vec3 = pathentity.getPosition(this);
                }

                this.calculateRotationYaw(vec3.xCoord, vec3.zCoord);
                this.doMovementAction(this.moveType);
            }
        }
        else if (!entityrabbit$rabbitjumphelper.func_180065_d())
        {
            this.func_175518_cr();
        }
    }

    this.field_175537_bp = this.onGround;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:74,代码来源:EntityRabbit.java

示例2: updateAITasks

import net.minecraft.pathfinding.PathEntity; //导入方法依赖的package包/类
@Override
public void updateAITasks() {
	super.updateAITasks();

	if (getMoveHelper().getSpeed() > 0.8D)
		setMoveType(EntityRabbit.EnumMoveType.SPRINT);
	else if (moveType != EntityRabbit.EnumMoveType.ATTACK)
		setMoveType(EntityRabbit.EnumMoveType.HOP);

	if (currentMoveTypeDuration > 0)
		currentMoveTypeDuration--;

	if (carrotTicks > 0) {
		carrotTicks -= rand.nextInt(3);

		if (carrotTicks < 0)
			carrotTicks = 0;
	}

	if (onGround) {
		if (!field_175537_bp) {
			setJumping(false, EntityRabbit.EnumMoveType.NONE);
			func_175517_cu();
		}

		EntityRabbit.RabbitJumpHelper rabbitjumphelper = getJumpHelper();

		if (!rabbitjumphelper.getIsJumping()) {
			if (!getNavigator().noPath() && currentMoveTypeDuration == 0) {
				PathEntity pathentity = getNavigator().getPath();
				Vec3 vec3 = Vec3.createVectorHelper(getMoveHelper().getX(), getMoveHelper().getY(), getMoveHelper().getZ());

				if (pathentity != null && pathentity.getCurrentPathIndex() < pathentity.getCurrentPathLength())
					vec3 = pathentity.getPosition(this);

				calculateRotationYaw(vec3.xCoord, vec3.zCoord);
				doMovementAction(moveType);
			}
		} else if (!rabbitjumphelper.func_180065_d())
			func_175518_cr();
	}

	field_175537_bp = onGround;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:45,代码来源:EntityRabbit.java


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