當前位置: 首頁>>代碼示例>>Java>>正文


Java ChunkCoordinates.getDistanceSquaredToChunkCoordinates方法代碼示例

本文整理匯總了Java中net.minecraft.util.ChunkCoordinates.getDistanceSquaredToChunkCoordinates方法的典型用法代碼示例。如果您正苦於以下問題:Java ChunkCoordinates.getDistanceSquaredToChunkCoordinates方法的具體用法?Java ChunkCoordinates.getDistanceSquaredToChunkCoordinates怎麽用?Java ChunkCoordinates.getDistanceSquaredToChunkCoordinates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.ChunkCoordinates的用法示例。


在下文中一共展示了ChunkCoordinates.getDistanceSquaredToChunkCoordinates方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findPlayers

import net.minecraft.util.ChunkCoordinates; //導入方法依賴的package包/類
/**
 * Find all players in a specified range and narrowing down by other parameters
 */
public List findPlayers(ChunkCoordinates par1ChunkCoordinates, int par2, int par3, int par4, int par5, int par6, int par7, Map par8Map, String par9Str, String par10Str, World par11World)
{
    if (this.playerEntityList.isEmpty())
    {
        return null;
    }
    else
    {
        Object var12 = new ArrayList();
        boolean var13 = par4 < 0;
        boolean var14 = par9Str != null && par9Str.startsWith("!");
        boolean var15 = par10Str != null && par10Str.startsWith("!");
        int var16 = par2 * par2;
        int var17 = par3 * par3;
        par4 = MathHelper.abs_int(par4);

        if (var14)
        {
            par9Str = par9Str.substring(1);
        }

        if (var15)
        {
            par10Str = par10Str.substring(1);
        }

        for (int var18 = 0; var18 < this.playerEntityList.size(); ++var18)
        {
            EntityPlayerMP var19 = (EntityPlayerMP)this.playerEntityList.get(var18);

            if ((par11World == null || var19.worldObj == par11World) && (par9Str == null || var14 != par9Str.equalsIgnoreCase(var19.getCommandSenderName())))
            {
                if (par10Str != null)
                {
                    Team var20 = var19.getTeam();
                    String var21 = var20 == null ? "" : var20.getRegisteredName();

                    if (var15 == par10Str.equalsIgnoreCase(var21))
                    {
                        continue;
                    }
                }

                if (par1ChunkCoordinates != null && (par2 > 0 || par3 > 0))
                {
                    float var22 = par1ChunkCoordinates.getDistanceSquaredToChunkCoordinates(var19.getPlayerCoordinates());

                    if (par2 > 0 && var22 < (float)var16 || par3 > 0 && var22 > (float)var17)
                    {
                        continue;
                    }
                }

                if (this.func_96457_a(var19, par8Map) && (par5 == WorldSettings.GameType.NOT_SET.getID() || par5 == var19.theItemInWorldManager.getGameType().getID()) && (par6 <= 0 || var19.experienceLevel >= par6) && var19.experienceLevel <= par7)
                {
                    ((List)var12).add(var19);
                }
            }
        }

        if (par1ChunkCoordinates != null)
        {
            Collections.sort((List)var12, new PlayerPositionComparator(par1ChunkCoordinates));
        }

        if (var13)
        {
            Collections.reverse((List)var12);
        }

        if (par4 > 0)
        {
            var12 = ((List)var12).subList(0, Math.min(par4, ((List)var12).size()));
        }

        return (List)var12;
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:82,代碼來源:ServerConfigurationManager.java


注:本文中的net.minecraft.util.ChunkCoordinates.getDistanceSquaredToChunkCoordinates方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。