本文整理匯總了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();
}
}
}
示例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_;
}
示例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);
}
}
示例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_);
}