当前位置: 首页>>代码示例>>Java>>正文


Java MathHelper.parseIntWithDefault方法代码示例

本文整理汇总了Java中net.minecraft.util.MathHelper.parseIntWithDefault方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.parseIntWithDefault方法的具体用法?Java MathHelper.parseIntWithDefault怎么用?Java MathHelper.parseIntWithDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.MathHelper的用法示例。


在下文中一共展示了MathHelper.parseIntWithDefault方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFlatGeneratorFromString

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static FlatGeneratorInfo createFlatGeneratorFromString(String p_82651_0_)
{
    if (p_82651_0_ == null)
    {
        return getDefaultFlatGenerator();
    }
    else
    {
        String[] astring = p_82651_0_.split(";", -1);
        int i = astring.length == 1 ? 0 : MathHelper.parseIntWithDefault(astring[0], 0);

        if (i >= 0 && i <= 3)
        {
            FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo();
            int j = astring.length == 1 ? 0 : 1;
            List<FlatLayerInfo> list = func_180716_a(i, astring[j++]);

            if (list != null && !list.isEmpty())
            {
                flatgeneratorinfo.getFlatLayers().addAll(list);
                flatgeneratorinfo.func_82645_d();
                int k = BiomeGenBase.plains.biomeID;

                if (i > 0 && astring.length > j)
                {
                    k = MathHelper.parseIntWithDefault(astring[j++], k);
                }

                flatgeneratorinfo.setBiome(k);

                if (i > 0 && astring.length > j)
                {
                    String[] astring1 = astring[j++].toLowerCase().split(",");

                    for (String s : astring1)
                    {
                        String[] astring2 = s.split("\\(", 2);
                        Map<String, String> map = Maps.<String, String>newHashMap();

                        if (astring2[0].length() > 0)
                        {
                            flatgeneratorinfo.getWorldFeatures().put(astring2[0], map);

                            if (astring2.length > 1 && astring2[1].endsWith(")") && astring2[1].length() > 1)
                            {
                                String[] astring3 = astring2[1].substring(0, astring2[1].length() - 1).split(" ");

                                for (int l = 0; l < astring3.length; ++l)
                                {
                                    String[] astring4 = astring3[l].split("=", 2);

                                    if (astring4.length == 2)
                                    {
                                        map.put(astring4[0], astring4[1]);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    flatgeneratorinfo.getWorldFeatures().put("village", Maps.<String, String>newHashMap());
                }

                return flatgeneratorinfo;
            }
            else
            {
                return getDefaultFlatGenerator();
            }
        }
        else
        {
            return getDefaultFlatGenerator();
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:79,代码来源:FlatGeneratorInfo.java

示例2: parseIntWithDefault

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private static int parseIntWithDefault(Map<String, String> p_179653_0_, String p_179653_1_, int p_179653_2_)
{
    return p_179653_0_.containsKey(p_179653_1_) ? MathHelper.parseIntWithDefault((String)p_179653_0_.get(p_179653_1_), p_179653_2_) : p_179653_2_;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:PlayerSelector.java

示例3: processCommand

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    List<ICommand> list = this.getSortedPossibleCommands(sender);
    int i = 7;
    int j = (list.size() - 1) / 7;
    int k = 0;

    try
    {
        k = args.length == 0 ? 0 : parseInt(args[0], 1, j + 1) - 1;
    }
    catch (NumberInvalidException numberinvalidexception)
    {
        Map<String, ICommand> map = this.getCommands();
        ICommand icommand = (ICommand)map.get(args[0]);

        if (icommand != null)
        {
            throw new WrongUsageException(icommand.getCommandUsage(sender), new Object[0]);
        }

        if (MathHelper.parseIntWithDefault(args[0], -1) != -1)
        {
            throw numberinvalidexception;
        }

        throw new CommandNotFoundException();
    }

    int l = Math.min((k + 1) * 7, list.size());
    ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.help.header", new Object[] {Integer.valueOf(k + 1), Integer.valueOf(j + 1)});
    chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
    sender.addChatMessage(chatcomponenttranslation1);

    for (int i1 = k * 7; i1 < l; ++i1)
    {
        ICommand icommand1 = (ICommand)list.get(i1);
        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(icommand1.getCommandUsage(sender), new Object[0]);
        chatcomponenttranslation.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/" + icommand1.getCommandName() + " "));
        sender.addChatMessage(chatcomponenttranslation);
    }

    if (k == 0 && sender instanceof EntityPlayer)
    {
        ChatComponentTranslation chatcomponenttranslation2 = new ChatComponentTranslation("commands.help.footer", new Object[0]);
        chatcomponenttranslation2.getChatStyle().setColor(EnumChatFormatting.GREEN);
        sender.addChatMessage(chatcomponenttranslation2);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:53,代码来源:CommandHelp.java

示例4: getInt

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static int getInt(String p_getInt_0_, int p_getInt_1_)
{
    return MathHelper.parseIntWithDefault(p_getInt_0_, p_getInt_1_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:RealmsMth.java


注:本文中的net.minecraft.util.MathHelper.parseIntWithDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。