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


Java WorldInfo.getDifficulty方法代碼示例

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


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

示例1: tick

import net.minecraft.world.storage.WorldInfo; //導入方法依賴的package包/類
/**
 * 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);
                    }
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:61,代碼來源:IntegratedServer.java

示例2: tick

import net.minecraft.world.storage.WorldInfo; //導入方法依賴的package包/類
/**
 * 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);
                    }
                }
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:63,代碼來源:IntegratedServer.java

示例3: tick

import net.minecraft.world.storage.WorldInfo; //導入方法依賴的package包/類
/**
 * 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);
                    }
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:61,代碼來源:IntegratedServer.java

示例4: tick

import net.minecraft.world.storage.WorldInfo; //導入方法依賴的package包/類
/**
 * 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);
                    }
                }
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:61,代碼來源:IntegratedServer.java


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