当前位置: 首页>>代码示例>>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;未经允许,请勿转载。