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


Java WorldInfo.setCleanWeatherTime方法代碼示例

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


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

示例1: setMissionWeather

import net.minecraft.world.storage.WorldInfo; //導入方法依賴的package包/類
public static void setMissionWeather(MissionInit minit)
{
    ServerSection ss = minit.getMission().getServerSection();
    ServerInitialConditions sic = (ss != null) ? ss.getServerInitialConditions() : null;
    if (sic != null && sic.getWeather() != null && !sic.getWeather().equalsIgnoreCase("normal"))
    {
        int maxtime = 1000000 * 20; // Max allowed by Minecraft's own Weather Command.
        int cleartime = (sic.getWeather().equalsIgnoreCase("clear")) ? maxtime : 0;
        int raintime = (sic.getWeather().equalsIgnoreCase("rain")) ? maxtime : 0;
        int thundertime = (sic.getWeather().equalsIgnoreCase("thunder")) ? maxtime : 0;

        WorldServer worldserver = MinecraftServer.getServer().worldServers[0];
        WorldInfo worldinfo = worldserver.getWorldInfo();

        worldinfo.setCleanWeatherTime(cleartime);
        worldinfo.setRainTime(raintime);
        worldinfo.setThunderTime(thundertime);
        worldinfo.setRaining(raintime + thundertime > 0);
        worldinfo.setThundering(thundertime > 0);
    }
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:22,代碼來源:EnvironmentHelper.java

示例2: processCommand

import net.minecraft.world.storage.WorldInfo; //導入方法依賴的package包/類
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args.length <= 2)
    {
        int i = (300 + (new Random()).nextInt(600)) * 20;

        if (args.length >= 2)
        {
            i = parseInt(args[1], 1, 1000000) * 20;
        }

        World world = MinecraftServer.getServer().worldServers[0];
        WorldInfo worldinfo = world.getWorldInfo();

        if ("clear".equalsIgnoreCase(args[0]))
        {
            worldinfo.setCleanWeatherTime(i);
            worldinfo.setRainTime(0);
            worldinfo.setThunderTime(0);
            worldinfo.setRaining(false);
            worldinfo.setThundering(false);
            notifyOperators(sender, this, "commands.weather.clear", new Object[0]);
        }
        else if ("rain".equalsIgnoreCase(args[0]))
        {
            worldinfo.setCleanWeatherTime(0);
            worldinfo.setRainTime(i);
            worldinfo.setThunderTime(i);
            worldinfo.setRaining(true);
            worldinfo.setThundering(false);
            notifyOperators(sender, this, "commands.weather.rain", new Object[0]);
        }
        else
        {
            if (!"thunder".equalsIgnoreCase(args[0]))
            {
                throw new WrongUsageException("commands.weather.usage", new Object[0]);
            }

            worldinfo.setCleanWeatherTime(0);
            worldinfo.setRainTime(i);
            worldinfo.setThunderTime(i);
            worldinfo.setRaining(true);
            worldinfo.setThundering(true);
            notifyOperators(sender, this, "commands.weather.thunder", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.weather.usage", new Object[0]);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:56,代碼來源:CommandWeather.java

示例3: execute

import net.minecraft.world.storage.WorldInfo; //導入方法依賴的package包/類
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args.length <= 2)
    {
        int i = (300 + (new Random()).nextInt(600)) * 20;

        if (args.length >= 2)
        {
            i = parseInt(args[1], 1, 1000000) * 20;
        }

        World world = server.worldServers[0];
        WorldInfo worldinfo = world.getWorldInfo();

        if ("clear".equalsIgnoreCase(args[0]))
        {
            worldinfo.setCleanWeatherTime(i);
            worldinfo.setRainTime(0);
            worldinfo.setThunderTime(0);
            worldinfo.setRaining(false);
            worldinfo.setThundering(false);
            notifyCommandListener(sender, this, "commands.weather.clear", new Object[0]);
        }
        else if ("rain".equalsIgnoreCase(args[0]))
        {
            worldinfo.setCleanWeatherTime(0);
            worldinfo.setRainTime(i);
            worldinfo.setThunderTime(i);
            worldinfo.setRaining(true);
            worldinfo.setThundering(false);
            notifyCommandListener(sender, this, "commands.weather.rain", new Object[0]);
        }
        else
        {
            if (!"thunder".equalsIgnoreCase(args[0]))
            {
                throw new WrongUsageException("commands.weather.usage", new Object[0]);
            }

            worldinfo.setCleanWeatherTime(0);
            worldinfo.setRainTime(i);
            worldinfo.setThunderTime(i);
            worldinfo.setRaining(true);
            worldinfo.setThundering(true);
            notifyCommandListener(sender, this, "commands.weather.thunder", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.weather.usage", new Object[0]);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:56,代碼來源:CommandWeather.java


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