本文整理汇总了Java中net.minecraft.pathfinding.Path.getCurrentPathLength方法的典型用法代码示例。如果您正苦于以下问题:Java Path.getCurrentPathLength方法的具体用法?Java Path.getCurrentPathLength怎么用?Java Path.getCurrentPathLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.pathfinding.Path
的用法示例。
在下文中一共展示了Path.getCurrentPathLength方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例3: 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;
}
}
示例4: 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();
}
示例5: 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;
}