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


Java PathPoint.distanceTo方法代码示例

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


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

示例1: findPathOptions

import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance)
{
    int i = 0;

    for (EnumFacing enumfacing : EnumFacing.values())
    {
        PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord + enumfacing.getFrontOffsetX(), currentPoint.yCoord + enumfacing.getFrontOffsetY(), currentPoint.zCoord + enumfacing.getFrontOffsetZ());

        if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance)
        {
            pathOptions[i++] = pathpoint;
        }
    }

    return i;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:SwimNodeProcessor.java

示例2: findPathOptions

import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
@Override
public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) {
    int i = 0;
    
    for (EnumFacing facing : EnumFacing.values()) {
        PathPoint point = getSafePoint(entity,
            currentPoint.xCoord + facing.getFrontOffsetX(),
            currentPoint.yCoord + facing.getFrontOffsetY(),
            currentPoint.zCoord + facing.getFrontOffsetZ()
        );

        if (point != null && !point.visited && point.distanceTo(targetPoint) < maxDistance) {
            pathOptions[i++] = point;
        }
    }

    return i;
}
 
开发者ID:ata4,项目名称:dragon-mounts,代码行数:19,代码来源:NodeProcessorFlying.java

示例3: findPathOptions

import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
/**
 * Override this, because the super method adds diagonals, this is fancy but doesn't work well with drones (drones stuck behind a wall).
 */
@Override
public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance)
{
    int i = 0;
    
    for(EnumFacing dir : EnumFacing.VALUES){
        PathPoint point = openPoint(currentPoint.x + dir.getFrontOffsetX(), currentPoint.y + dir.getFrontOffsetY(), currentPoint.z + dir.getFrontOffsetZ());
        if(point != null && !point.visited && point.distanceTo(targetPoint) < maxDistance){
            pathOptions[i++] = point;
        }
    }

    return i;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:18,代码来源:NodeProcessorDrone.java

示例4: findPathOptions

import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance)
{
    int i = 0;
    int j = 0;

    if (this.getVerticalOffset(entityIn, currentPoint.xCoord, currentPoint.yCoord + 1, currentPoint.zCoord) == 1)
    {
        j = 1;
    }

    PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord + 1, j);
    PathPoint pathpoint1 = this.getSafePoint(entityIn, currentPoint.xCoord - 1, currentPoint.yCoord, currentPoint.zCoord, j);
    PathPoint pathpoint2 = this.getSafePoint(entityIn, currentPoint.xCoord + 1, currentPoint.yCoord, currentPoint.zCoord, j);
    PathPoint pathpoint3 = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord - 1, j);

    if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance)
    {
        pathOptions[i++] = pathpoint;
    }

    if (pathpoint1 != null && !pathpoint1.visited && pathpoint1.distanceTo(targetPoint) < maxDistance)
    {
        pathOptions[i++] = pathpoint1;
    }

    if (pathpoint2 != null && !pathpoint2.visited && pathpoint2.distanceTo(targetPoint) < maxDistance)
    {
        pathOptions[i++] = pathpoint2;
    }

    if (pathpoint3 != null && !pathpoint3.visited && pathpoint3.distanceTo(targetPoint) < maxDistance)
    {
        pathOptions[i++] = pathpoint3;
    }

    return i;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:WalkNodeProcessor.java

示例5: findPathOptions

import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
@Override
public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) {
  EntityLiving entityIn = entity;
  int i = 0;
  for (EnumFacing enumfacing : EnumFacing.values()) {
    PathPoint pathpoint = getSafePoint(entityIn, currentPoint.x + enumfacing.getFrontOffsetX(), currentPoint.y + enumfacing.getFrontOffsetY(),
        currentPoint.z + enumfacing.getFrontOffsetZ());
    if (pathpoint != null && !pathpoint.visited && (pathpoint.distanceTo(targetPoint) < maxDistance)) {
      pathOptions[i++] = pathpoint;
    }
  }
  return i;
}
 
开发者ID:SleepyTrousers,项目名称:EnderZoo,代码行数:14,代码来源:FlyNodeProcessor.java


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