Java 类net.minecraft.util.Util 实例源码

项目:BaseClient    文件:Minecraft.java   
private void setWindowIcon() {
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX) {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try {
            inputstream = this.mcDefaultResourcePack
                    .getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack
                    .getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null) {
                Display.setIcon(new ByteBuffer[] { this.readImageToBuffer(inputstream),
                        this.readImageToBuffer(inputstream1) });
            }
        } catch (IOException ioexception) {
            logger.error((String) "Couldn\'t set icon", (Throwable) ioexception);
        } finally {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
项目:Backmemed    文件:ShaderMacros.java   
public static String getOs()
{
    Util.EnumOS util$enumos = Util.getOSType();

    switch (util$enumos)
    {
        case WINDOWS:
            return "MC_OS_WINDOWS";

        case OSX:
            return "MC_OS_MAC";

        case LINUX:
            return "MC_OS_LINUX";

        default:
            return "MC_OS_OTHER";
    }
}
项目:DecompiledMinecraft    文件:Minecraft.java   
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
项目:BaseClient    文件:Minecraft.java   
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
项目:Zombe-Modpack    文件:Minecraft.java   
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
项目:Backmemed    文件:Minecraft.java   
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
项目:Backmemed    文件:EnchantmentHelper.java   
public static List<EnchantmentData> buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int p_77513_2_, boolean allowTreasure)
{
    List<EnchantmentData> list = Lists.<EnchantmentData>newArrayList();
    Item item = itemStackIn.getItem();
    int i = item.getItemEnchantability();

    if (i <= 0)
    {
        return list;
    }
    else
    {
        p_77513_2_ = p_77513_2_ + 1 + randomIn.nextInt(i / 4 + 1) + randomIn.nextInt(i / 4 + 1);
        float f = (randomIn.nextFloat() + randomIn.nextFloat() - 1.0F) * 0.15F;
        p_77513_2_ = MathHelper.clamp(Math.round((float)p_77513_2_ + (float)p_77513_2_ * f), 1, Integer.MAX_VALUE);
        List<EnchantmentData> list1 = getEnchantmentDatas(p_77513_2_, itemStackIn, allowTreasure);

        if (!list1.isEmpty())
        {
            list.add(WeightedRandom.getRandomItem(randomIn, list1));

            while (randomIn.nextInt(50) <= p_77513_2_)
            {
                removeIncompatible(list1, (EnchantmentData)Util.getLastElement(list));

                if (list1.isEmpty())
                {
                    break;
                }

                list.add(WeightedRandom.getRandomItem(randomIn, list1));
                p_77513_2_ /= 2;
            }
        }

        return list;
    }
}
项目:Backmemed    文件:DataFixer.java   
public void registerFix(IFixType type, IFixableData fixable)
{
    List<IFixableData> list = this.<IFixableData>getTypeList(this.fixMap, type);
    int i = fixable.getFixVersion();

    if (i > this.version)
    {
        LOGGER.warn("Ignored fix registered for version: {} as the DataVersion of the game is: {}", new Object[] {Integer.valueOf(i), Integer.valueOf(this.version)});
    }
    else
    {
        if (!list.isEmpty() && ((IFixableData)Util.getLastElement(list)).getFixVersion() > i)
        {
            for (int j = 0; j < list.size(); ++j)
            {
                if (((IFixableData)list.get(j)).getFixVersion() > i)
                {
                    list.add(j, fixable);
                    break;
                }
            }
        }
        else
        {
            list.add(fixable);
        }
    }
}
项目:CustomWorldGen    文件:Minecraft.java   
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
项目:CustomWorldGen    文件:EnchantmentHelper.java   
public static List<EnchantmentData> buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int p_77513_2_, boolean allowTreasure)
{
    List<EnchantmentData> list = Lists.<EnchantmentData>newArrayList();
    Item item = itemStackIn.getItem();
    int i = item.getItemEnchantability(itemStackIn);

    if (i <= 0)
    {
        return list;
    }
    else
    {
        p_77513_2_ = p_77513_2_ + 1 + randomIn.nextInt(i / 4 + 1) + randomIn.nextInt(i / 4 + 1);
        float f = (randomIn.nextFloat() + randomIn.nextFloat() - 1.0F) * 0.15F;
        p_77513_2_ = MathHelper.clamp_int(Math.round((float)p_77513_2_ + (float)p_77513_2_ * f), 1, Integer.MAX_VALUE);
        List<EnchantmentData> list1 = getEnchantmentDatas(p_77513_2_, itemStackIn, allowTreasure);

        if (!list1.isEmpty())
        {
            list.add(WeightedRandom.getRandomItem(randomIn, list1));

            while (randomIn.nextInt(50) <= p_77513_2_)
            {
                removeIncompatible(list1, (EnchantmentData)Util.getLastElement(list));

                if (list1.isEmpty())
                {
                    break;
                }

                list.add(WeightedRandom.getRandomItem(randomIn, list1));
                p_77513_2_ /= 2;
            }
        }

        return list;
    }
}
项目:CustomWorldGen    文件:DataFixer.java   
public void registerFix(IFixType type, IFixableData fixable)
{
    List<IFixableData> list = this.<IFixableData>getTypeList(this.fixMap, type);
    int i = fixable.getFixVersion();

    if (i > this.version)
    {
        LOGGER.warn("Ignored fix registered for version: {} as the DataVersion of the game is: {}", new Object[] {Integer.valueOf(i), Integer.valueOf(this.version)});
    }
    else
    {
        if (!list.isEmpty() && ((IFixableData)Util.getLastElement(list)).getFixVersion() > i)
        {
            for (int j = 0; j < list.size(); ++j)
            {
                if (((IFixableData)list.get(j)).getFixVersion() > i)
                {
                    list.add(j, fixable);
                    break;
                }
            }
        }
        else
        {
            list.add(fixable);
        }
    }
}
项目:Resilience-Client-Source    文件:EntityPlayer.java   
public static UUID func_146094_a(GameProfile p_146094_0_)
{
    UUID var1 = Util.tryGetUUIDFromString(p_146094_0_.getId());

    if (var1 == null)
    {
        var1 = UUID.nameUUIDFromBytes(("OfflinePlayer:" + p_146094_0_.getName()).getBytes(Charsets.UTF_8));
    }

    return var1;
}
项目:multishot    文件:StringHelper.java   
public static String fixPath(String str)
{
    if (Util.getOSType() == EnumOS.WINDOWS)
    {
        return str.replace('/', '\\').replace("\\.\\", "\\").replace("\\\\", "\\");
    }

    return str.replace('\\', '/').replace("/./", "/").replace("//", "/");
}
项目:ExpandedRailsMod    文件:Minecraft.java   
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
项目:ExpandedRailsMod    文件:EnchantmentHelper.java   
public static List<EnchantmentData> buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int p_77513_2_, boolean allowTreasure)
{
    List<EnchantmentData> list = Lists.<EnchantmentData>newArrayList();
    Item item = itemStackIn.getItem();
    int i = item.getItemEnchantability(itemStackIn);

    if (i <= 0)
    {
        return list;
    }
    else
    {
        p_77513_2_ = p_77513_2_ + 1 + randomIn.nextInt(i / 4 + 1) + randomIn.nextInt(i / 4 + 1);
        float f = (randomIn.nextFloat() + randomIn.nextFloat() - 1.0F) * 0.15F;
        p_77513_2_ = MathHelper.clamp_int(Math.round((float)p_77513_2_ + (float)p_77513_2_ * f), 1, Integer.MAX_VALUE);
        List<EnchantmentData> list1 = getEnchantmentDatas(p_77513_2_, itemStackIn, allowTreasure);

        if (!list1.isEmpty())
        {
            list.add(WeightedRandom.getRandomItem(randomIn, list1));

            while (randomIn.nextInt(50) <= p_77513_2_)
            {
                removeIncompatible(list1, (EnchantmentData)Util.getLastElement(list));

                if (list1.isEmpty())
                {
                    break;
                }

                list.add(WeightedRandom.getRandomItem(randomIn, list1));
                p_77513_2_ /= 2;
            }
        }

        return list;
    }
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

    synchronized (this.futureTaskQueue)
    {
        while (!this.futureTaskQueue.isEmpty())
        {
            Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
        }
    }

    this.theProfiler.endStartSection("levels");

    for (int j = 0; j < this.worldServers.length; ++j)
    {
        long i = System.nanoTime();

        if (j == 0 || this.getAllowNether())
        {
            WorldServer worldserver = this.worldServers[j];
            this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());

            if (this.tickCounter % 20 == 0)
            {
                this.theProfiler.startSection("timeSync");
                this.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionId());
                this.theProfiler.endSection();
            }

            this.theProfiler.startSection("tick");

            try
            {
                worldserver.tick();
            }
            catch (Throwable throwable1)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
                worldserver.addWorldInfoToCrashReport(crashreport);
                throw new ReportedException(crashreport);
            }

            try
            {
                worldserver.updateEntities();
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
                worldserver.addWorldInfoToCrashReport(crashreport1);
                throw new ReportedException(crashreport1);
            }

            this.theProfiler.endSection();
            this.theProfiler.startSection("tracker");
            worldserver.getEntityTracker().updateTrackedEntities();
            this.theProfiler.endSection();
            this.theProfiler.endSection();
        }

        this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.serverConfigManager.onTick();
    this.theProfiler.endStartSection("tickables");

    for (int k = 0; k < this.playersOnline.size(); ++k)
    {
        ((ITickable)this.playersOnline.get(k)).update();
    }

    this.theProfiler.endSection();
}
项目:DecompiledMinecraft    文件:GuiStreamUnavailable.java   
public static void func_152321_a(GuiScreen p_152321_0_)
{
    Minecraft minecraft = Minecraft.getMinecraft();
    IStream istream = minecraft.getTwitchStream();

    if (!OpenGlHelper.framebufferSupported)
    {
        List<ChatComponentTranslation> list = Lists.<ChatComponentTranslation>newArrayList();
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.version", new Object[] {GL11.glGetString(GL11.GL_VERSION)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.blend", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_blend_func_separate)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.arb", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_ARB_framebuffer_object)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.ext", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_framebuffer_object)}));
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.NO_FBO, list));
    }
    else if (istream instanceof NullStream)
    {
        if (((NullStream)istream).func_152937_a().getMessage().contains("Can\'t load AMD 64-bit .dll on a IA 32-bit platform"))
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_ARCH_MISMATCH));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_FAILURE));
        }
    }
    else if (!istream.func_152928_D() && istream.func_152912_E() == ErrorCode.TTV_EC_OS_TOO_OLD)
    {
        switch (Util.getOSType())
        {
            case WINDOWS:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_WINDOWS));
                break;

            case OSX:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_MAC));
                break;

            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_OTHER));
        }
    }
    else if (!minecraft.getTwitchDetails().containsKey("twitch_access_token"))
    {
        if (minecraft.getSession().getSessionType() == Session.Type.LEGACY)
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_MIGRATED));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_BOUND));
        }
    }
    else if (!istream.func_152913_F())
    {
        switch (istream.func_152918_H())
        {
            case INVALID_TOKEN:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH));
                break;

            case ERROR:
            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH_ERROR));
        }
    }
    else if (istream.func_152912_E() != null)
    {
        List<ChatComponentTranslation> list1 = Arrays.<ChatComponentTranslation>asList(new ChatComponentTranslation[] {new ChatComponentTranslation("stream.unavailable.initialization_failure.extra", new Object[]{ErrorCode.getString(istream.func_152912_E())})});
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.INITIALIZATION_FAILURE, list1));
    }
    else
    {
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNKNOWN));
    }
}
项目:DecompiledMinecraft    文件:IntegratedServer.java   
/**
 * Main function called by run() every loop.
 */
public void tick()
{
    boolean flag = this.isGamePaused;
    this.isGamePaused = Minecraft.getMinecraft().getNetHandler() != null && Minecraft.getMinecraft().isGamePaused();

    if (!flag && this.isGamePaused)
    {
        logger.info("Saving and pausing game...");
        this.getConfigurationManager().saveAllPlayerData();
        this.saveAllWorlds(false);
    }

    if (this.isGamePaused)
    {
        synchronized (this.futureTaskQueue)
        {
            while (!this.futureTaskQueue.isEmpty())
            {
                Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
            }
        }
    }
    else
    {
        super.tick();

        if (this.mc.gameSettings.renderDistanceChunks != this.getConfigurationManager().getViewDistance())
        {
            logger.info("Changing view distance to {}, from {}", new Object[] {Integer.valueOf(this.mc.gameSettings.renderDistanceChunks), Integer.valueOf(this.getConfigurationManager().getViewDistance())});
            this.getConfigurationManager().setViewDistance(this.mc.gameSettings.renderDistanceChunks);
        }

        if (this.mc.theWorld != null)
        {
            WorldInfo worldinfo1 = this.worldServers[0].getWorldInfo();
            WorldInfo worldinfo = this.mc.theWorld.getWorldInfo();

            if (!worldinfo1.isDifficultyLocked() && worldinfo.getDifficulty() != worldinfo1.getDifficulty())
            {
                logger.info("Changing difficulty to {}, from {}", new Object[] {worldinfo.getDifficulty(), worldinfo1.getDifficulty()});
                this.setDifficultyForAllWorlds(worldinfo.getDifficulty());
            }
            else if (worldinfo.isDifficultyLocked() && !worldinfo1.isDifficultyLocked())
            {
                logger.info("Locking difficulty to {}", new Object[] {worldinfo.getDifficulty()});

                for (WorldServer worldserver : this.worldServers)
                {
                    if (worldserver != null)
                    {
                        worldserver.getWorldInfo().setDifficultyLocked(true);
                    }
                }
            }
        }
    }
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

    synchronized (this.futureTaskQueue)
    {
        while (!this.futureTaskQueue.isEmpty())
        {
            Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
        }
    }

    this.theProfiler.endStartSection("levels");

    for (int j = 0; j < this.worldServers.length; ++j)
    {
        long i = System.nanoTime();

        if (j == 0 || this.getAllowNether())
        {
            WorldServer worldserver = this.worldServers[j];
            this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());

            if (this.tickCounter % 20 == 0)
            {
                this.theProfiler.startSection("timeSync");
                this.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionId());
                this.theProfiler.endSection();
            }

            this.theProfiler.startSection("tick");

            try
            {
                worldserver.tick();
            }
            catch (Throwable throwable1)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
                worldserver.addWorldInfoToCrashReport(crashreport);
                throw new ReportedException(crashreport);
            }

            try
            {
                worldserver.updateEntities();
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
                worldserver.addWorldInfoToCrashReport(crashreport1);
                throw new ReportedException(crashreport1);
            }

            this.theProfiler.endSection();
            this.theProfiler.startSection("tracker");
            worldserver.getEntityTracker().updateTrackedEntities();
            this.theProfiler.endSection();
            this.theProfiler.endSection();
        }

        this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.serverConfigManager.onTick();
    this.theProfiler.endStartSection("tickables");

    for (int k = 0; k < this.playersOnline.size(); ++k)
    {
        ((ITickable)this.playersOnline.get(k)).update();
    }

    this.theProfiler.endSection();
}
项目:Wurst-MC-1.12    文件:MiscUtils.java   
public static void openFile(String path)
{
    File file = new File(path);
    String apath = file.getAbsolutePath();

    try
    {
        Desktop.getDesktop().open(file);
    }catch(IOException e)
    {
        logger.error("Failed to open file via Desktop.", e);
    }

    if(Util.getOSType() == Util.EnumOS.WINDOWS)
    {
        String command = String.format(
            "cmd.exe /C start \"Open file\" \"%s\"", new Object[]{apath});

        try
        {
            Runtime.getRuntime().exec(command);
            return;
        }catch(IOException var8)
        {
            logger.error("Failed to open file", var8);
        }
    }else if(Util.getOSType() == Util.EnumOS.OSX)
        try
        {
            logger.info(apath);
            Runtime.getRuntime().exec(new String[]{"/usr/bin/open", apath});
            return;
        }catch(IOException var9)
        {
            logger.error("Failed to open file", var9);
        }

    boolean browserFailed = false;

    try
    {
        Desktop.getDesktop().browse(file.toURI());
    }catch(Throwable var7)
    {
        logger.error("Failed to open file", var7);
        browserFailed = true;
    }

    if(browserFailed)
    {
        logger.info("Opening via system class!");
        Sys.openURL("file://" + apath);
    }
}
项目:BaseClient    文件:GuiStreamUnavailable.java   
public static void func_152321_a(GuiScreen p_152321_0_)
{
    Minecraft minecraft = Minecraft.getMinecraft();
    IStream istream = minecraft.getTwitchStream();

    if (!OpenGlHelper.framebufferSupported)
    {
        List<ChatComponentTranslation> list = Lists.<ChatComponentTranslation>newArrayList();
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.version", new Object[] {GL11.glGetString(GL11.GL_VERSION)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.blend", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_blend_func_separate)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.arb", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_ARB_framebuffer_object)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.ext", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_framebuffer_object)}));
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.NO_FBO, list));
    }
    else if (istream instanceof NullStream)
    {
        if (((NullStream)istream).func_152937_a().getMessage().contains("Can\'t load AMD 64-bit .dll on a IA 32-bit platform"))
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_ARCH_MISMATCH));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_FAILURE));
        }
    }
    else if (!istream.func_152928_D() && istream.func_152912_E() == ErrorCode.TTV_EC_OS_TOO_OLD)
    {
        switch (Util.getOSType())
        {
            case WINDOWS:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_WINDOWS));
                break;

            case OSX:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_MAC));
                break;

            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_OTHER));
        }
    }
    else if (!minecraft.getTwitchDetails().containsKey("twitch_access_token"))
    {
        if (minecraft.getSession().getSessionType() == Session.Type.LEGACY)
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_MIGRATED));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_BOUND));
        }
    }
    else if (!istream.func_152913_F())
    {
        switch (istream.func_152918_H())
        {
            case INVALID_TOKEN:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH));
                break;

            case ERROR:
            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH_ERROR));
        }
    }
    else if (istream.func_152912_E() != null)
    {
        List<ChatComponentTranslation> list1 = Arrays.<ChatComponentTranslation>asList(new ChatComponentTranslation[] {new ChatComponentTranslation("stream.unavailable.initialization_failure.extra", new Object[]{ErrorCode.getString(istream.func_152912_E())})});
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.INITIALIZATION_FAILURE, list1));
    }
    else
    {
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNKNOWN));
    }
}
项目:BaseClient    文件:IntegratedServer.java   
/**
 * Main function called by run() every loop.
 */
public void tick()
{
    boolean flag = this.isGamePaused;
    this.isGamePaused = Minecraft.getMinecraft().getNetHandler() != null && Minecraft.getMinecraft().isGamePaused();

    if (!flag && this.isGamePaused)
    {
        logger.info("Saving and pausing game...");
        this.getConfigurationManager().saveAllPlayerData();
        this.saveAllWorlds(false);
    }

    if (this.isGamePaused)
    {
        Queue var3 = this.futureTaskQueue;

        synchronized (this.futureTaskQueue)
        {
            while (!this.futureTaskQueue.isEmpty())
            {
                Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
            }
        }
    }
    else
    {
        super.tick();

        if (this.mc.gameSettings.renderDistanceChunks != this.getConfigurationManager().getViewDistance())
        {
            logger.info("Changing view distance to {}, from {}", new Object[] {Integer.valueOf(this.mc.gameSettings.renderDistanceChunks), Integer.valueOf(this.getConfigurationManager().getViewDistance())});
            this.getConfigurationManager().setViewDistance(this.mc.gameSettings.renderDistanceChunks);
        }

        if (this.mc.theWorld != null)
        {
            WorldInfo worldinfo = this.worldServers[0].getWorldInfo();
            WorldInfo worldinfo1 = this.mc.theWorld.getWorldInfo();

            if (!worldinfo.isDifficultyLocked() && worldinfo1.getDifficulty() != worldinfo.getDifficulty())
            {
                logger.info("Changing difficulty to {}, from {}", new Object[] {worldinfo1.getDifficulty(), worldinfo.getDifficulty()});
                this.setDifficultyForAllWorlds(worldinfo1.getDifficulty());
            }
            else if (worldinfo1.isDifficultyLocked() && !worldinfo.isDifficultyLocked())
            {
                logger.info("Locking difficulty to {}", new Object[] {worldinfo1.getDifficulty()});

                for (WorldServer worldserver : this.worldServers)
                {
                    if (worldserver != null)
                    {
                        worldserver.getWorldInfo().setDifficultyLocked(true);
                    }
                }
            }
        }
    }
}
项目:BaseClient    文件:MinecraftServer.java   
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

    synchronized (this.futureTaskQueue)
    {
        while (!this.futureTaskQueue.isEmpty())
        {
            Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
        }
    }

    this.theProfiler.endStartSection("levels");

    for (int j = 0; j < this.worldServers.length; ++j)
    {
        long i = System.nanoTime();

        if (j == 0 || this.getAllowNether())
        {
            WorldServer worldserver = this.worldServers[j];
            this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());

            if (this.tickCounter % 20 == 0)
            {
                this.theProfiler.startSection("timeSync");
                this.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionId());
                this.theProfiler.endSection();
            }

            this.theProfiler.startSection("tick");

            try
            {
                worldserver.tick();
            }
            catch (Throwable throwable1)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
                worldserver.addWorldInfoToCrashReport(crashreport);
                throw new ReportedException(crashreport);
            }

            try
            {
                worldserver.updateEntities();
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
                worldserver.addWorldInfoToCrashReport(crashreport1);
                throw new ReportedException(crashreport1);
            }

            this.theProfiler.endSection();
            this.theProfiler.startSection("tracker");
            worldserver.getEntityTracker().updateTrackedEntities();
            this.theProfiler.endSection();
            this.theProfiler.endSection();
        }

        this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.serverConfigManager.onTick();
    this.theProfiler.endStartSection("tickables");

    for (int k = 0; k < this.playersOnline.size(); ++k)
    {
        ((ITickable)this.playersOnline.get(k)).update();
    }

    this.theProfiler.endSection();
}
项目:BaseClient    文件:GuiStreamUnavailable.java   
public static void func_152321_a(GuiScreen p_152321_0_)
{
    Minecraft minecraft = Minecraft.getMinecraft();
    IStream istream = minecraft.getTwitchStream();

    if (!OpenGlHelper.framebufferSupported)
    {
        List<ChatComponentTranslation> list = Lists.<ChatComponentTranslation>newArrayList();
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.version", new Object[] {GL11.glGetString(GL11.GL_VERSION)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.blend", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_blend_func_separate)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.arb", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_ARB_framebuffer_object)}));
        list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.ext", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_framebuffer_object)}));
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.NO_FBO, list));
    }
    else if (istream instanceof NullStream)
    {
        if (((NullStream)istream).func_152937_a().getMessage().contains("Can\'t load AMD 64-bit .dll on a IA 32-bit platform"))
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_ARCH_MISMATCH));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_FAILURE));
        }
    }
    else if (!istream.func_152928_D() && istream.func_152912_E() == ErrorCode.TTV_EC_OS_TOO_OLD)
    {
        switch (Util.getOSType())
        {
            case WINDOWS:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_WINDOWS));
                break;

            case OSX:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_MAC));
                break;

            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_OTHER));
        }
    }
    else if (!minecraft.getTwitchDetails().containsKey("twitch_access_token"))
    {
        if (minecraft.getSession().getSessionType() == Session.Type.LEGACY)
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_MIGRATED));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_BOUND));
        }
    }
    else if (!istream.func_152913_F())
    {
        switch (istream.func_152918_H())
        {
            case INVALID_TOKEN:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH));
                break;

            case ERROR:
            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH_ERROR));
        }
    }
    else if (istream.func_152912_E() != null)
    {
        List<ChatComponentTranslation> list1 = Arrays.<ChatComponentTranslation>asList(new ChatComponentTranslation[] {new ChatComponentTranslation("stream.unavailable.initialization_failure.extra", new Object[]{ErrorCode.getString(istream.func_152912_E())})});
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.INITIALIZATION_FAILURE, list1));
    }
    else
    {
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNKNOWN));
    }
}
项目:BaseClient    文件:IntegratedServer.java   
/**
 * Main function called by run() every loop.
 */
public void tick()
{
    boolean flag = this.isGamePaused;
    this.isGamePaused = Minecraft.getMinecraft().getNetHandler() != null && Minecraft.getMinecraft().isGamePaused();

    if (!flag && this.isGamePaused)
    {
        logger.info("Saving and pausing game...");
        this.getConfigurationManager().saveAllPlayerData();
        this.saveAllWorlds(false);
    }

    if (this.isGamePaused)
    {
        Queue var3 = this.futureTaskQueue;

        synchronized (this.futureTaskQueue)
        {
            while (!this.futureTaskQueue.isEmpty())
            {
                Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
            }
        }
    }
    else
    {
        super.tick();

        if (this.mc.gameSettings.renderDistanceChunks != this.getConfigurationManager().getViewDistance())
        {
            logger.info("Changing view distance to {}, from {}", new Object[] {Integer.valueOf(this.mc.gameSettings.renderDistanceChunks), Integer.valueOf(this.getConfigurationManager().getViewDistance())});
            this.getConfigurationManager().setViewDistance(this.mc.gameSettings.renderDistanceChunks);
        }

        if (this.mc.theWorld != null)
        {
            WorldInfo worldinfo = this.worldServers[0].getWorldInfo();
            WorldInfo worldinfo1 = this.mc.theWorld.getWorldInfo();

            if (!worldinfo.isDifficultyLocked() && worldinfo1.getDifficulty() != worldinfo.getDifficulty())
            {
                logger.info("Changing difficulty to {}, from {}", new Object[] {worldinfo1.getDifficulty(), worldinfo.getDifficulty()});
                this.setDifficultyForAllWorlds(worldinfo1.getDifficulty());
            }
            else if (worldinfo1.isDifficultyLocked() && !worldinfo.isDifficultyLocked())
            {
                logger.info("Locking difficulty to {}", new Object[] {worldinfo1.getDifficulty()});

                for (WorldServer worldserver : this.worldServers)
                {
                    if (worldserver != null)
                    {
                        worldserver.getWorldInfo().setDifficultyLocked(true);
                    }
                }
            }
        }
    }
}
项目:BaseClient    文件:MinecraftServer.java   
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

    synchronized (this.futureTaskQueue)
    {
        while (!this.futureTaskQueue.isEmpty())
        {
            Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
        }
    }

    this.theProfiler.endStartSection("levels");

    for (int j = 0; j < this.worldServers.length; ++j)
    {
        long i = System.nanoTime();

        if (j == 0 || this.getAllowNether())
        {
            WorldServer worldserver = this.worldServers[j];
            this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());

            if (this.tickCounter % 20 == 0)
            {
                this.theProfiler.startSection("timeSync");
                this.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionId());
                this.theProfiler.endSection();
            }

            this.theProfiler.startSection("tick");

            try
            {
                worldserver.tick();
            }
            catch (Throwable throwable1)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
                worldserver.addWorldInfoToCrashReport(crashreport);
                throw new ReportedException(crashreport);
            }

            try
            {
                worldserver.updateEntities();
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
                worldserver.addWorldInfoToCrashReport(crashreport1);
                throw new ReportedException(crashreport1);
            }

            this.theProfiler.endSection();
            this.theProfiler.startSection("tracker");
            worldserver.getEntityTracker().updateTrackedEntities();
            this.theProfiler.endSection();
            this.theProfiler.endSection();
        }

        this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.serverConfigManager.onTick();
    this.theProfiler.endStartSection("tickables");

    for (int k = 0; k < this.playersOnline.size(); ++k)
    {
        ((ITickable)this.playersOnline.get(k)).update();
    }

    this.theProfiler.endSection();
}
项目:Backmemed    文件:OpenGlHelper.java   
public static void openFile(File fileIn)
{
    String s = fileIn.getAbsolutePath();

    if (Util.getOSType() == Util.EnumOS.OSX)
    {
        try
        {
            LOGGER.info(s);
            Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
            return;
        }
        catch (IOException ioexception11)
        {
            LOGGER.error((String)"Couldn\'t open file", (Throwable)ioexception11);
        }
    }
    else if (Util.getOSType() == Util.EnumOS.WINDOWS)
    {
        String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});

        try
        {
            Runtime.getRuntime().exec(s1);
            return;
        }
        catch (IOException ioexception1)
        {
            LOGGER.error((String)"Couldn\'t open file", (Throwable)ioexception1);
        }
    }

    boolean flag = false;

    try
    {
        Class<?> oclass = Class.forName("java.awt.Desktop");
        Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
        oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {fileIn.toURI()});
    }
    catch (Throwable throwable)
    {
        LOGGER.error("Couldn\'t open link", throwable);
        flag = true;
    }

    if (flag)
    {
        LOGGER.info("Opening via system class!");
        Sys.openURL("file://" + s);
    }
}
项目:Backmemed    文件:IntegratedServer.java   
/**
 * Main function called by run() every loop.
 */
public void tick()
{
    boolean flag = this.isGamePaused;
    this.isGamePaused = Minecraft.getMinecraft().getConnection() != null && Minecraft.getMinecraft().isGamePaused();

    if (!flag && this.isGamePaused)
    {
        LOGGER.info("Saving and pausing game...");
        this.getPlayerList().saveAllPlayerData();
        this.saveAllWorlds(false);
    }

    if (this.isGamePaused)
    {
        synchronized (this.futureTaskQueue)
        {
            while (!this.futureTaskQueue.isEmpty())
            {
                Util.runTask((FutureTask)this.futureTaskQueue.poll(), LOGGER);
            }
        }
    }
    else
    {
        super.tick();

        if (this.mc.gameSettings.renderDistanceChunks != this.getPlayerList().getViewDistance())
        {
            LOGGER.info("Changing view distance to {}, from {}", new Object[] {Integer.valueOf(this.mc.gameSettings.renderDistanceChunks), Integer.valueOf(this.getPlayerList().getViewDistance())});
            this.getPlayerList().setViewDistance(this.mc.gameSettings.renderDistanceChunks);
        }

        if (this.mc.world != null)
        {
            WorldInfo worldinfo1 = this.worldServers[0].getWorldInfo();
            WorldInfo worldinfo = this.mc.world.getWorldInfo();

            if (!worldinfo1.isDifficultyLocked() && worldinfo.getDifficulty() != worldinfo1.getDifficulty())
            {
                LOGGER.info("Changing difficulty to {}, from {}", new Object[] {worldinfo.getDifficulty(), worldinfo1.getDifficulty()});
                this.setDifficultyForAllWorlds(worldinfo.getDifficulty());
            }
            else if (worldinfo.isDifficultyLocked() && !worldinfo1.isDifficultyLocked())
            {
                LOGGER.info("Locking difficulty to {}", new Object[] {worldinfo.getDifficulty()});

                for (WorldServer worldserver : this.worldServers)
                {
                    if (worldserver != null)
                    {
                        worldserver.getWorldInfo().setDifficultyLocked(true);
                    }
                }
            }
        }
    }
}
项目:Backmemed    文件:MinecraftServer.java   
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

    synchronized (this.futureTaskQueue)
    {
        while (!this.futureTaskQueue.isEmpty())
        {
            Util.runTask((FutureTask)this.futureTaskQueue.poll(), LOG);
        }
    }

    this.theProfiler.endStartSection("levels");

    for (int j = 0; j < this.worldServers.length; ++j)
    {
        long i = System.nanoTime();

        if (j == 0 || this.getAllowNether())
        {
            WorldServer worldserver = this.worldServers[j];
            this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());

            if (this.tickCounter % 20 == 0)
            {
                this.theProfiler.startSection("timeSync");
                this.playerList.sendPacketToAllPlayersInDimension(new SPacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionType().getId());
                this.theProfiler.endSection();
            }

            this.theProfiler.startSection("tick");

            try
            {
                worldserver.tick();
            }
            catch (Throwable throwable1)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
                worldserver.addWorldInfoToCrashReport(crashreport);
                throw new ReportedException(crashreport);
            }

            try
            {
                worldserver.updateEntities();
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
                worldserver.addWorldInfoToCrashReport(crashreport1);
                throw new ReportedException(crashreport1);
            }

            this.theProfiler.endSection();
            this.theProfiler.startSection("tracker");
            worldserver.getEntityTracker().updateTrackedEntities();
            this.theProfiler.endSection();
            this.theProfiler.endSection();
        }

        this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.playerList.onTick();
    this.theProfiler.endStartSection("tickables");

    for (int k = 0; k < this.tickables.size(); ++k)
    {
        ((ITickable)this.tickables.get(k)).update();
    }

    this.theProfiler.endSection();
}
项目:CustomWorldGen    文件:OpenGlHelper.java   
public static void openFile(File fileIn)
{
    String s = fileIn.getAbsolutePath();

    if (Util.getOSType() == Util.EnumOS.OSX)
    {
        try
        {
            LOGGER.info(s);
            Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
            return;
        }
        catch (IOException ioexception1)
        {
            LOGGER.error((String)"Couldn\'t open file", (Throwable)ioexception1);
        }
    }
    else if (Util.getOSType() == Util.EnumOS.WINDOWS)
    {
        String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});

        try
        {
            Runtime.getRuntime().exec(s1);
            return;
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t open file", (Throwable)ioexception);
        }
    }

    boolean flag = false;

    try
    {
        Class<?> oclass = Class.forName("java.awt.Desktop");
        Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
        oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {fileIn.toURI()});
    }
    catch (Throwable throwable)
    {
        LOGGER.error("Couldn\'t open link", throwable);
        flag = true;
    }

    if (flag)
    {
        LOGGER.info("Opening via system class!");
        Sys.openURL("file://" + s);
    }
}
项目:CustomWorldGen    文件:IntegratedServer.java   
/**
 * Main function called by run() every loop.
 */
public void tick()
{
    boolean flag = this.isGamePaused;
    this.isGamePaused = Minecraft.getMinecraft().getConnection() != null && Minecraft.getMinecraft().isGamePaused();

    if (!flag && this.isGamePaused)
    {
        LOGGER.info("Saving and pausing game...");
        this.getPlayerList().saveAllPlayerData();
        this.saveAllWorlds(false);
    }

    if (this.isGamePaused)
    {
        synchronized (this.futureTaskQueue)
        {
            while (!this.futureTaskQueue.isEmpty())
            {
                Util.runTask((FutureTask)this.futureTaskQueue.poll(), LOGGER);
            }
        }
    }
    else
    {
        super.tick();

        if (this.mc.gameSettings.renderDistanceChunks != this.getPlayerList().getViewDistance())
        {
            LOGGER.info("Changing view distance to {}, from {}", new Object[] {Integer.valueOf(this.mc.gameSettings.renderDistanceChunks), Integer.valueOf(this.getPlayerList().getViewDistance())});
            this.getPlayerList().setViewDistance(this.mc.gameSettings.renderDistanceChunks);
        }

        if (this.mc.theWorld != null)
        {
            WorldInfo worldinfo1 = this.worldServers[0].getWorldInfo();
            WorldInfo worldinfo = this.mc.theWorld.getWorldInfo();

            if (!worldinfo1.isDifficultyLocked() && worldinfo.getDifficulty() != worldinfo1.getDifficulty())
            {
                LOGGER.info("Changing difficulty to {}, from {}", new Object[] {worldinfo.getDifficulty(), worldinfo1.getDifficulty()});
                this.setDifficultyForAllWorlds(worldinfo.getDifficulty());
            }
            else if (worldinfo.isDifficultyLocked() && !worldinfo1.isDifficultyLocked())
            {
                LOGGER.info("Locking difficulty to {}", new Object[] {worldinfo.getDifficulty()});

                for (WorldServer worldserver : this.worldServers)
                {
                    if (worldserver != null)
                    {
                        worldserver.getWorldInfo().setDifficultyLocked(true);
                    }
                }
            }
        }
    }
}
项目:EvenWurse    文件:MiscUtils.java   
public static void openFile(String path) {
    File file = new File(path);
    String apath = file.getAbsolutePath();

    try {
        Desktop.getDesktop().open(file);
    } catch (IOException e) {
        logger.error("Failed to open file via Desktop.", e);
    }

    if (Util.getOSType() == Util.EnumOS.WINDOWS) {
        String command = String.format("cmd.exe /C start \"Open file\" \"%s\"", apath);

        try {
            Runtime.getRuntime().exec(command);
            return;
        } catch (IOException var8) {
            logger.error("Failed to open file", var8);
        }
    } else if (Util.getOSType() == Util.EnumOS.OSX) {
        try {
            logger.info(apath);
            Runtime.getRuntime().exec(new String[]{"/usr/bin/open", apath});
            return;
        } catch (IOException var9) {
            logger.error("Failed to open file", var9);
        }
    }

    boolean browserFailed = false;

    try {
        Desktop.getDesktop().browse(file.toURI());
    } catch (Throwable var7) {
        logger.error("Failed to open file", var7);
        browserFailed = true;
    }

    if (browserFailed) {
        logger.info("Opening via system class!");
        Sys.openURL("file://" + apath);
    }
}
项目:Resilience-Client-Source    文件:Config.java   
public static void checkDisplaySettings()
{
    if (getAntialiasingLevel() > 0)
    {
        int samples = getAntialiasingLevel();
        DisplayMode displayMode = Display.getDisplayMode();
        dbg("FSAA Samples: " + samples);

        try
        {
            Display.destroy();
            Display.setDisplayMode(displayMode);
            Display.create((new PixelFormat()).withDepthBits(24).withSamples(samples));
        }
        catch (LWJGLException var9)
        {
            warn("Error setting FSAA: " + samples + "x");
            var9.printStackTrace();

            try
            {
                Display.setDisplayMode(displayMode);
                Display.create((new PixelFormat()).withDepthBits(24));
            }
            catch (LWJGLException var8)
            {
                var8.printStackTrace();

                try
                {
                    Display.setDisplayMode(displayMode);
                    Display.create();
                }
                catch (LWJGLException var7)
                {
                    var7.printStackTrace();
                }
            }
        }

        if (Util.getOSType() != Util.EnumOS.MACOS)
        {
            try
            {
                File e = new File(minecraft.mcDataDir, "assets");
                ByteBuffer bufIcon16 = readIconImage(new File(e, "/icons/icon_16x16.png"));
                ByteBuffer bufIcon32 = readIconImage(new File(e, "/icons/icon_32x32.png"));
                ByteBuffer[] buf = new ByteBuffer[] {bufIcon16, bufIcon32};
                Display.setIcon(buf);
            }
            catch (IOException var6)
            {
                dbg(var6.getClass().getName() + ": " + var6.getMessage());
            }
        }
    }
}
项目:ExpandedRailsMod    文件:OpenGlHelper.java   
public static void openFile(File fileIn)
{
    String s = fileIn.getAbsolutePath();

    if (Util.getOSType() == Util.EnumOS.OSX)
    {
        try
        {
            LOGGER.info(s);
            Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
            return;
        }
        catch (IOException ioexception1)
        {
            LOGGER.error((String)"Couldn\'t open file", (Throwable)ioexception1);
        }
    }
    else if (Util.getOSType() == Util.EnumOS.WINDOWS)
    {
        String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});

        try
        {
            Runtime.getRuntime().exec(s1);
            return;
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t open file", (Throwable)ioexception);
        }
    }

    boolean flag = false;

    try
    {
        Class<?> oclass = Class.forName("java.awt.Desktop");
        Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
        oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {fileIn.toURI()});
    }
    catch (Throwable throwable)
    {
        LOGGER.error("Couldn\'t open link", throwable);
        flag = true;
    }

    if (flag)
    {
        LOGGER.info("Opening via system class!");
        Sys.openURL("file://" + s);
    }
}
项目:Cauldron    文件:GuiStreamUnavailable.java   
public static void func_152321_a(GuiScreen p_152321_0_)
{
    Minecraft minecraft = Minecraft.getMinecraft();
    IStream istream = minecraft.func_152346_Z();

    if (!OpenGlHelper.framebufferSupported)
    {
        ArrayList arraylist = Lists.newArrayList();
        arraylist.add(new ChatComponentTranslation("stream.unavailable.no_fbo.version", new Object[] {GL11.glGetString(GL11.GL_VERSION)}));
        arraylist.add(new ChatComponentTranslation("stream.unavailable.no_fbo.blend", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_blend_func_separate)}));
        arraylist.add(new ChatComponentTranslation("stream.unavailable.no_fbo.arb", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_ARB_framebuffer_object)}));
        arraylist.add(new ChatComponentTranslation("stream.unavailable.no_fbo.ext", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_framebuffer_object)}));
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.NO_FBO, arraylist));
    }
    else if (istream instanceof NullStream)
    {
        if (((NullStream)istream).func_152937_a().getMessage().contains("Can\'t load AMD 64-bit .dll on a IA 32-bit platform"))
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_ARCH_MISMATCH));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_FAILURE));
        }
    }
    else if (!istream.func_152928_D() && istream.func_152912_E() == ErrorCode.TTV_EC_OS_TOO_OLD)
    {
        switch (GuiStreamUnavailable.SwitchReason.field_152578_b[Util.getOSType().ordinal()])
        {
            case 1:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_WINDOWS));
                break;
            case 2:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_MAC));
                break;
            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_OTHER));
        }
    }
    else if (!minecraft.func_152341_N().containsKey("twitch_access_token"))
    {
        if (minecraft.getSession().func_152428_f() == Session.Type.LEGACY)
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_MIGRATED));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_BOUND));
        }
    }
    else if (!istream.func_152913_F())
    {
        switch (GuiStreamUnavailable.SwitchReason.field_152579_c[istream.func_152918_H().ordinal()])
        {
            case 1:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH));
                break;
            case 2:
            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH_ERROR));
        }
    }
    else if (istream.func_152912_E() != null)
    {
        List list = Arrays.asList(new ChatComponentTranslation[] {new ChatComponentTranslation("stream.unavailable.initialization_failure.extra", new Object[]{ErrorCode.getString(istream.func_152912_E())})});
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.INITIALIZATION_FAILURE, list));
    }
    else
    {
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNKNOWN));
    }
}
项目:Cauldron    文件:GuiStreamUnavailable.java   
public static void func_152321_a(GuiScreen p_152321_0_)
{
    Minecraft minecraft = Minecraft.getMinecraft();
    IStream istream = minecraft.func_152346_Z();

    if (!OpenGlHelper.framebufferSupported)
    {
        ArrayList arraylist = Lists.newArrayList();
        arraylist.add(new ChatComponentTranslation("stream.unavailable.no_fbo.version", new Object[] {GL11.glGetString(GL11.GL_VERSION)}));
        arraylist.add(new ChatComponentTranslation("stream.unavailable.no_fbo.blend", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_blend_func_separate)}));
        arraylist.add(new ChatComponentTranslation("stream.unavailable.no_fbo.arb", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_ARB_framebuffer_object)}));
        arraylist.add(new ChatComponentTranslation("stream.unavailable.no_fbo.ext", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_framebuffer_object)}));
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.NO_FBO, arraylist));
    }
    else if (istream instanceof NullStream)
    {
        if (((NullStream)istream).func_152937_a().getMessage().contains("Can\'t load AMD 64-bit .dll on a IA 32-bit platform"))
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_ARCH_MISMATCH));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_FAILURE));
        }
    }
    else if (!istream.func_152928_D() && istream.func_152912_E() == ErrorCode.TTV_EC_OS_TOO_OLD)
    {
        switch (GuiStreamUnavailable.SwitchReason.field_152578_b[Util.getOSType().ordinal()])
        {
            case 1:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_WINDOWS));
                break;
            case 2:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_MAC));
                break;
            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_OTHER));
        }
    }
    else if (!minecraft.func_152341_N().containsKey("twitch_access_token"))
    {
        if (minecraft.getSession().func_152428_f() == Session.Type.LEGACY)
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_MIGRATED));
        }
        else
        {
            minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_BOUND));
        }
    }
    else if (!istream.func_152913_F())
    {
        switch (GuiStreamUnavailable.SwitchReason.field_152579_c[istream.func_152918_H().ordinal()])
        {
            case 1:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH));
                break;
            case 2:
            default:
                minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH_ERROR));
        }
    }
    else if (istream.func_152912_E() != null)
    {
        List list = Arrays.asList(new ChatComponentTranslation[] {new ChatComponentTranslation("stream.unavailable.initialization_failure.extra", new Object[]{ErrorCode.getString(istream.func_152912_E())})});
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.INITIALIZATION_FAILURE, list));
    }
    else
    {
        minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNKNOWN));
    }
}
项目:RuneCraftery    文件:GuiScreenTemporaryResourcePackSelect.java   
protected void func_73875_a(GuiButton p_73875_1_) {
   if(p_73875_1_.field_73742_g) {
      if(p_73875_1_.field_73741_f == 5) {
         File var2 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).func_110612_e();
         String var3 = var2.getAbsolutePath();
         if(Util.func_110647_a() == EnumOS.MACOS) {
            try {
               this.field_73882_e.func_98033_al().func_98233_a(var3);
               Runtime.getRuntime().exec(new String[]{"/usr/bin/open", var3});
               return;
            } catch (IOException var9) {
               var9.printStackTrace();
            }
         } else if(Util.func_110647_a() == EnumOS.WINDOWS) {
            String var4 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[]{var3});

            try {
               Runtime.getRuntime().exec(var4);
               return;
            } catch (IOException var8) {
               var8.printStackTrace();
            }
         }

         boolean var10 = false;

         try {
            Class var5 = Class.forName("java.awt.Desktop");
            Object var6 = var5.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
            var5.getMethod("browse", new Class[]{URI.class}).invoke(var6, new Object[]{var2.toURI()});
         } catch (Throwable var7) {
            var7.printStackTrace();
            var10 = true;
         }

         if(var10) {
            this.field_73882_e.func_98033_al().func_98233_a("Opening via system class!");
            Sys.openURL("file://" + var3);
         }
      } else if(p_73875_1_.field_73741_f == 6) {
         this.field_73882_e.func_71373_a(this.field_110347_a);
      } else {
         this.field_110346_c.func_77219_a(p_73875_1_);
      }

   }
}
项目:RuneCraftery    文件:GuiScreenTemporaryResourcePackSelect.java   
/**
 * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
 */
protected void actionPerformed(GuiButton par1GuiButton)
{
    if (par1GuiButton.enabled)
    {
        if (par1GuiButton.id == 5)
        {
            File file1 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).getDirResourcepacks();
            String s = file1.getAbsolutePath();

            if (Util.getOSType() == EnumOS.MACOS)
            {
                try
                {
                    this.mc.getLogAgent().logInfo(s);
                    Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
                    return;
                }
                catch (IOException ioexception)
                {
                    ioexception.printStackTrace();
                }
            }
            else if (Util.getOSType() == EnumOS.WINDOWS)
            {
                String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});

                try
                {
                    Runtime.getRuntime().exec(s1);
                    return;
                }
                catch (IOException ioexception1)
                {
                    ioexception1.printStackTrace();
                }
            }

            boolean flag = false;

            try
            {
                Class oclass = Class.forName("java.awt.Desktop");
                Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
                oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {file1.toURI()});
            }
            catch (Throwable throwable)
            {
                throwable.printStackTrace();
                flag = true;
            }

            if (flag)
            {
                this.mc.getLogAgent().logInfo("Opening via system class!");
                Sys.openURL("file://" + s);
            }
        }
        else if (par1GuiButton.id == 6)
        {
            this.mc.displayGuiScreen(this.field_110347_a);
        }
        else
        {
            this.field_110346_c.actionPerformed(par1GuiButton);
        }
    }
}
项目:BetterNutritionMod    文件:GuiScreenTemporaryResourcePackSelect.java   
/**
 * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
 */
protected void actionPerformed(GuiButton par1GuiButton)
{
    if (par1GuiButton.enabled)
    {
        if (par1GuiButton.id == 5)
        {
            File file1 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).getDirResourcepacks();
            String s = file1.getAbsolutePath();

            if (Util.getOSType() == EnumOS.MACOS)
            {
                try
                {
                    this.mc.getLogAgent().logInfo(s);
                    Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
                    return;
                }
                catch (IOException ioexception)
                {
                    ioexception.printStackTrace();
                }
            }
            else if (Util.getOSType() == EnumOS.WINDOWS)
            {
                String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});

                try
                {
                    Runtime.getRuntime().exec(s1);
                    return;
                }
                catch (IOException ioexception1)
                {
                    ioexception1.printStackTrace();
                }
            }

            boolean flag = false;

            try
            {
                Class oclass = Class.forName("java.awt.Desktop");
                Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
                oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {file1.toURI()});
            }
            catch (Throwable throwable)
            {
                throwable.printStackTrace();
                flag = true;
            }

            if (flag)
            {
                this.mc.getLogAgent().logInfo("Opening via system class!");
                Sys.openURL("file://" + s);
            }
        }
        else if (par1GuiButton.id == 6)
        {
            this.mc.displayGuiScreen(this.field_110347_a);
        }
        else
        {
            this.field_110346_c.actionPerformed(par1GuiButton);
        }
    }
}
项目:BetterNutritionMod    文件:Minecraft.java   
private void updateDisplayMode() throws LWJGLException
{
    HashSet hashset = new HashSet();
    Collections.addAll(hashset, Display.getAvailableDisplayModes());
    DisplayMode displaymode = Display.getDesktopDisplayMode();

    if (!hashset.contains(displaymode) && Util.getOSType() == EnumOS.MACOS)
    {
        Iterator iterator = macDisplayModes.iterator();

        while (iterator.hasNext())
        {
            DisplayMode displaymode1 = (DisplayMode)iterator.next();
            boolean flag = true;
            Iterator iterator1 = hashset.iterator();
            DisplayMode displaymode2;

            while (iterator1.hasNext())
            {
                displaymode2 = (DisplayMode)iterator1.next();

                if (displaymode2.getBitsPerPixel() == 32 && displaymode2.getWidth() == displaymode1.getWidth() && displaymode2.getHeight() == displaymode1.getHeight())
                {
                    flag = false;
                    break;
                }
            }

            if (!flag)
            {
                iterator1 = hashset.iterator();

                while (iterator1.hasNext())
                {
                    displaymode2 = (DisplayMode)iterator1.next();

                    if (displaymode2.getBitsPerPixel() == 32 && displaymode2.getWidth() == displaymode1.getWidth() / 2 && displaymode2.getHeight() == displaymode1.getHeight() / 2)
                    {
                        displaymode = displaymode2;
                        break;
                    }
                }
            }
        }
    }

    Display.setDisplayMode(displaymode);
    this.displayWidth = displaymode.getWidth();
    this.displayHeight = displaymode.getHeight();
}