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


Java NonNullList.isEmpty方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:24,代碼來源:HarshenStack.java

示例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);
}
 
開發者ID:iChun,項目名稱:Torched,代碼行數:18,代碼來源:RecipeTorchGun.java

示例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);
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:33,代碼來源:DamageableShapelessOreRecipe.java

示例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));
		}
	}
}
 
開發者ID:elytra,項目名稱:Thermionics,代碼行數:15,代碼來源:ThermionicsRecipes.java


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