本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getDistanceSqToCenter方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getDistanceSqToCenter方法的具体用法?Java EntityPlayer.getDistanceSqToCenter怎么用?Java EntityPlayer.getDistanceSqToCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.getDistanceSqToCenter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findNewTarget
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void findNewTarget()
{
if (this.currentPath != null && this.currentPath.isFinished())
{
BlockPos blockpos = this.dragon.world.getTopSolidOrLiquidBlock(new BlockPos(WorldGenEndPodium.END_PODIUM_LOCATION));
int i = this.dragon.getFightManager() == null ? 0 : this.dragon.getFightManager().getNumAliveCrystals();
if (this.dragon.getRNG().nextInt(i + 3) == 0)
{
this.dragon.getPhaseManager().setPhase(PhaseList.LANDING_APPROACH);
return;
}
double d0 = 64.0D;
EntityPlayer entityplayer = this.dragon.world.getNearestAttackablePlayer(blockpos, d0, d0);
if (entityplayer != null)
{
d0 = entityplayer.getDistanceSqToCenter(blockpos) / 512.0D;
}
if (entityplayer != null && (this.dragon.getRNG().nextInt(MathHelper.abs((int)d0) + 2) == 0 || this.dragon.getRNG().nextInt(i + 2) == 0))
{
this.strafePlayer(entityplayer);
return;
}
}
if (this.currentPath == null || this.currentPath.isFinished())
{
int j = this.dragon.initPathPoints();
int k = j;
if (this.dragon.getRNG().nextInt(8) == 0)
{
this.clockwise = !this.clockwise;
k = j + 6;
}
if (this.clockwise)
{
++k;
}
else
{
--k;
}
if (this.dragon.getFightManager() != null && this.dragon.getFightManager().getNumAliveCrystals() >= 0)
{
k = k % 12;
if (k < 0)
{
k += 12;
}
}
else
{
k = k - 12;
k = k & 7;
k = k + 12;
}
this.currentPath = this.dragon.findPath(j, k, (PathPoint)null);
if (this.currentPath != null)
{
this.currentPath.incrementPathIndex();
}
}
this.navigateToNextPathNode();
}
示例2: findNewTarget
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void findNewTarget()
{
if (this.currentPath != null && this.currentPath.isFinished())
{
BlockPos blockpos = this.dragon.worldObj.getTopSolidOrLiquidBlock(new BlockPos(WorldGenEndPodium.END_PODIUM_LOCATION));
int i = this.dragon.getFightManager() == null ? 0 : this.dragon.getFightManager().getNumAliveCrystals();
if (this.dragon.getRNG().nextInt(i + 3) == 0)
{
this.dragon.getPhaseManager().setPhase(PhaseList.LANDING_APPROACH);
return;
}
double d0 = 64.0D;
EntityPlayer entityplayer = this.dragon.worldObj.getNearestAttackablePlayer(blockpos, d0, d0);
if (entityplayer != null)
{
d0 = entityplayer.getDistanceSqToCenter(blockpos) / 512.0D;
}
if (entityplayer != null && (this.dragon.getRNG().nextInt(MathHelper.abs_int((int)d0) + 2) == 0 || this.dragon.getRNG().nextInt(i + 2) == 0))
{
this.strafePlayer(entityplayer);
return;
}
}
if (this.currentPath == null || this.currentPath.isFinished())
{
int j = this.dragon.initPathPoints();
int k = j;
if (this.dragon.getRNG().nextInt(8) == 0)
{
this.clockwise = !this.clockwise;
k = j + 6;
}
if (this.clockwise)
{
++k;
}
else
{
--k;
}
if (this.dragon.getFightManager() != null && this.dragon.getFightManager().getNumAliveCrystals() >= 0)
{
k = k % 12;
if (k < 0)
{
k += 12;
}
}
else
{
k = k - 12;
k = k & 7;
k = k + 12;
}
this.currentPath = this.dragon.findPath(j, k, (PathPoint)null);
if (this.currentPath != null)
{
this.currentPath.incrementPathIndex();
}
}
this.navigateToNextPathNode();
}