本文整理汇总了C#中CraftyServer.Core.World.getClosestPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# World.getClosestPlayer方法的具体用法?C# World.getClosestPlayer怎么用?C# World.getClosestPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CraftyServer.Core.World
的用法示例。
在下文中一共展示了World.getClosestPlayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: performSpawning
public static int performSpawning(World var0, bool var1, bool var2)
{
if (!var1 && !var2)
{
return 0;
}
else
{
eligibleChunksForSpawning.clear();
int var3;
int var6;
for (var3 = 0; var3 < var0.playerEntities.size(); ++var3)
{
var var4 = (EntityPlayer) var0.playerEntities.get(var3);
int var5 = MathHelper.floor_double(var4.posX/16.0D);
var6 = MathHelper.floor_double(var4.posZ/16.0D);
byte var7 = 8;
for (int var8 = -var7; var8 <= var7; ++var8)
{
for (int var9 = -var7; var9 <= var7; ++var9)
{
eligibleChunksForSpawning.add(new ChunkCoordIntPair(var8 + var5, var9 + var6));
}
}
}
var3 = 0;
ChunkCoordinates var33 = var0.func_22078_l();
EnumCreatureType[] var34 = EnumCreatureType.values();
var6 = var34.Length;
for (int var35 = 0; var35 < var6; ++var35)
{
EnumCreatureType var36 = var34[var35];
if ((!var36.func_21103_d() || var2) && (var36.func_21103_d() || var1) &&
var0.countEntities(var36.getCreatureClass()) <=
var36.getMaxNumberOfCreature()*eligibleChunksForSpawning.size()/256)
{
Iterator var37 = eligibleChunksForSpawning.iterator();
while (var37.hasNext())
{
var var10 = (ChunkCoordIntPair) var37.next();
MobSpawnerBase var11 = var0.getWorldChunkManager().func_4066_a(var10);
Class[] var12 = var11.getEntitiesForType(var36);
if (var12 != null && var12.Length != 0)
{
int var13 = var0.rand.nextInt(var12.Length);
ChunkPosition var14 = getRandomSpawningPointInChunk(var0, var10.chunkXPos*16,
var10.chunkZPos*16);
int var15 = var14.x;
int var16 = var14.y;
int var17 = var14.z;
if (!var0.isBlockOpaqueCube(var15, var16, var17) &&
var0.getBlockMaterial(var15, var16, var17) == var36.getCreatureMaterial())
{
int var18 = 0;
for (int var19 = 0; var19 < 3; ++var19)
{
int var20 = var15;
int var21 = var16;
int var22 = var17;
byte var23 = 6;
for (int var24 = 0; var24 < 4; ++var24)
{
var20 += var0.rand.nextInt(var23) - var0.rand.nextInt(var23);
var21 += var0.rand.nextInt(1) - var0.rand.nextInt(1);
var22 += var0.rand.nextInt(var23) - var0.rand.nextInt(var23);
if (func_21167_a(var36, var0, var20, var21, var22))
{
float var25 = var20 + 0.5F;
float var26 = var21;
float var27 = var22 + 0.5F;
if (
var0.getClosestPlayer(var25, var26, var27,
24.0D) == null)
{
float var28 = var25 - var33.posX;
float var29 = var26 - var33.posY;
float var30 = var27 - var33.posZ;
float var31 = var28*var28 + var29*var29 + var30*var30;
if (var31 >= 576.0F)
{
EntityLiving var38;
try
{
var38 =
(EntityLiving)
var12[var13].getConstructor(new Class[] {typeof (World)})
.newInstance(new object[] {var0});
}
catch (Exception var32)
{
var32.printStackTrace();
return var3;
}
//.........这里部分代码省略.........