本文整理匯總了Java中net.minecraft.util.NonNullList.isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java NonNullList.isEmpty方法的具體用法?Java NonNullList.isEmpty怎麽用?Java NonNullList.isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.NonNullList
的用法示例。
在下文中一共展示了NonNullList.isEmpty方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: HarshenStack
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
* Used to create a list of stacks, from oreDictionary
* @param oreDictName A list of OreDictionary value you want to use
*/
public HarshenStack(String... oreDictNames) {
for(String oreDictName : oreDictNames)
{
NonNullList<ItemStack> stackList = OreDictionary.getOres(oreDictName);
if(stackList.isEmpty())
new IllegalArgumentException("Oredictionary vaule " + oreDictName + " doesnt exist").printStackTrace(System.out);
else
for(ItemStack stack : stackList)
if(stack.getMetadata() == OreDictionary.WILDCARD_VALUE)
{
NonNullList<ItemStack> innerStacklist = NonNullList.create();
stack.getItem().getSubItems(CreativeTabs.SEARCH, innerStacklist);
for(ItemStack wildStack : innerStacklist)
this.stackList.add(stack.copy());
}
else
this.stackList.add(stack);
}
}
示例2: parse
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public IRecipe parse(JsonContext context, JsonObject json)
{
String group = JsonUtils.getString(json, "group", "");
NonNullList<Ingredient> ings = NonNullList.create();
for(JsonElement ele : JsonUtils.getJsonArray(json, "ingredients"))
ings.add(CraftingHelper.getIngredient(ele, context));
if(ings.isEmpty())
throw new JsonParseException("No ingredients for shapeless recipe");
if(ings.size() > 9)
throw new JsonParseException("Too many ingredients for shapeless recipe");
ItemStack itemstack = CraftingHelper.getItemStack(JsonUtils.getJsonObject(json, "result"), context);
return new RecipeTorchGun(group, itemstack, ings);
}
示例3: parse
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public IRecipe parse(JsonContext context, JsonObject json)
{
String group = JsonUtils.getString(json, "group", "");
NonNullList<Ingredient> ings = NonNullList.create();
for (JsonElement ele : JsonUtils.getJsonArray(json, "ingredients"))
ings.add(CraftingHelper.getIngredient(ele, context));
if (ings.isEmpty())
throw new JsonParseException("No ingredients for shapeless recipe");
ItemStack itemstack = CraftingHelper.getItemStack(JsonUtils.getJsonObject(json, "result"), context);
int[] damage = new int[ings.size()];
if (JsonUtils.hasField(json, "damage"))
{
JsonArray array = JsonUtils.getJsonArray(json, "damage");
if (array.size() > damage.length)
throw new JsonParseException("Too many values for damage array: got " + array.size() + ", expected " + damage.length);
for (int i = 0; i < array.size(); i++)
{
JsonElement element = array.get(i);
if (!element.isJsonPrimitive() || !element.getAsJsonPrimitive().isNumber())
throw new JsonSyntaxException("Entry in damage array is not a number, got " + element);
damage[i] = element.getAsJsonPrimitive().getAsInt();
}
}
return new DamageableShapelessOreRecipe(group.isEmpty() ? null : new ResourceLocation(group), damage, ings, itemstack);
}
示例4: millRecipes
import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public static void millRecipes(String key) {
if (OreDictionary.doesOreNameExist("dust"+key) && !OreDictionary.getOres("dust"+key).isEmpty()) {
//System.out.println("Found dust for "+key+". Registering mill recipes.");
NonNullList<ItemStack> dusts = OreDictionary.getOres("dust"+key);
if (!dusts.isEmpty()) {
ItemStack oneDust = dusts.get(0).copy();
ItemStack twoDust = oneDust.copy(); twoDust.setCount(2);
//if (OreDictionary.doesOreNameExist("ore"+key) && !OreDictionary.getOres("ore"+key).isEmpty()) {
HammerMillRecipes.registerRecipe(new RotaryOreRecipe("ore"+key, twoDust, 10f, 30f));
//}
HammerMillRecipes.registerRecipe(new RotaryOreRecipe("ingot"+key, oneDust, 10f, 10f));
}
}
}