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


Java Path.getPathPointFromIndex方法代码示例

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


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

示例1: renderPathLine

import net.minecraft.pathfinding.Path; //导入方法依赖的package包/类
public void renderPathLine(float p_190067_1_, Path p_190067_2_)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);

    for (int i = 0; i < p_190067_2_.getCurrentPathLength(); ++i)
    {
        PathPoint pathpoint = p_190067_2_.getPathPointFromIndex(i);

        if (this.addDistanceToPlayer(pathpoint) <= 40.0F)
        {
            float f = (float)i / (float)p_190067_2_.getCurrentPathLength() * 0.33F;
            int j = i == 0 ? 0 : MathHelper.hsvToRGB(f, 0.9F, 0.9F);
            int k = j >> 16 & 255;
            int l = j >> 8 & 255;
            int i1 = j & 255;
            vertexbuffer.pos((double)pathpoint.xCoord - this.xo + 0.5D, (double)pathpoint.yCoord - this.yo + 0.5D, (double)pathpoint.zCoord - this.zo + 0.5D).color(k, l, i1, 255).endVertex();
        }
    }

    tessellator.draw();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:DebugRendererPathfinding.java

示例2: updateTask

import net.minecraft.pathfinding.Path; //导入方法依赖的package包/类
@Override
public void updateTask()
{
	Path path = this.slime.getNavigator().getPath();
	if (path == null)
	{
		this.slime.getNavigator().clearPathEntity();
		return;
	}
	PathPoint point = path.getPathPointFromIndex(path.getCurrentPathIndex());
	double xDir = (point.x+ 0.5) - this.slime.posX;
	double zDir = (point.z+ 0.5) - this.slime.posZ;
	MobSlime.SlimeMoveHelper moveHelper = (MobSlime.SlimeMoveHelper) this.slime.getMoveHelper();
	moveHelper.setDirection((float) MathHelper.atan2(zDir, xDir), false);
	moveHelper.setSpeed(1);
	Minecraft.getMinecraft().player.sendMessage(new TextComponentString(""));
	Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Target X: " + Integer.toString(point.x)));
	Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Target Z: " + Integer.toString(point.z)));
	Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Current X: " + Integer.toString((int) this.slime.posX)));
	Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Current Z: " + Integer.toString((int) this.slime.posZ)));
}
 
开发者ID:murapix,项目名称:Inhuman-Resources,代码行数:22,代码来源:MobSlime.java

示例3: func_190067_a

import net.minecraft.pathfinding.Path; //导入方法依赖的package包/类
public void func_190067_a(float p_190067_1_, Path p_190067_2_)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);

    for (int i = 0; i < p_190067_2_.getCurrentPathLength(); ++i)
    {
        PathPoint pathpoint = p_190067_2_.getPathPointFromIndex(i);

        if (this.func_190066_a(pathpoint) <= 40.0F)
        {
            float f = (float)i / (float)p_190067_2_.getCurrentPathLength() * 0.33F;
            int j = i == 0 ? 0 : MathHelper.hsvToRGB(f, 0.9F, 0.9F);
            int k = j >> 16 & 255;
            int l = j >> 8 & 255;
            int i1 = j & 255;
            vertexbuffer.pos((double)pathpoint.xCoord - this.field_190069_f + 0.5D, (double)pathpoint.yCoord - this.field_190070_g + 0.5D, (double)pathpoint.zCoord - this.field_190071_h + 0.5D).color(k, l, i1, 255).endVertex();
        }
    }

    tessellator.draw();
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:24,代码来源:DebugRendererPathfinding.java

示例4: shouldExecute

import net.minecraft.pathfinding.Path; //导入方法依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (!this.theEntity.isCollidedHorizontally)
    {
        return false;
    }
    else
    {
        PathNavigateGround pathnavigateground = (PathNavigateGround)this.theEntity.getNavigator();
        Path path = pathnavigateground.getPath();

        if (path != null && !path.isFinished() && pathnavigateground.getEnterDoors())
        {
            for (int i = 0; i < Math.min(path.getCurrentPathIndex() + 2, path.getCurrentPathLength()); ++i)
            {
                PathPoint pathpoint = path.getPathPointFromIndex(i);
                this.doorPosition = new BlockPos(pathpoint.xCoord, pathpoint.yCoord + 1, pathpoint.zCoord);

                if (this.theEntity.getDistanceSq((double)this.doorPosition.getX(), this.theEntity.posY, (double)this.doorPosition.getZ()) <= 2.25D)
                {
                    this.doorBlock = this.getBlockDoor(this.doorPosition);

                    if (this.doorBlock != null)
                    {
                        return true;
                    }
                }
            }

            this.doorPosition = (new BlockPos(this.theEntity)).up();
            this.doorBlock = this.getBlockDoor(this.doorPosition);
            return this.doorBlock != null;
        }
        else
        {
            return false;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:43,代码来源:EntityAIDoorInteract.java


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