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


Java NonNullList.size方法代碼示例

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


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

示例1: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
    NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);

    for (int i = 0; i < nonnulllist.size(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (!itemstack.func_190926_b())
        {
            if (itemstack.getItem().hasContainerItem())
            {
                nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
            }
            else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
            {
                ItemStack itemstack1 = itemstack.copy();
                itemstack1.func_190920_e(1);
                nonnulllist.set(i, itemstack1);
            }
        }
    }

    return nonnulllist;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:26,代碼來源:RecipesBanners.java

示例2: Ritual

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * Constructs a new ritual. To be registered within the registry
 *
 * @param input       a NonNullList<ItemStack> with all and every itemstack required to be a valid ritual
 * @param output      a NonNullList<ItemStack> with all and every itemstack that should get dropped on the ground when the ritual stops
 * @param timeInTicks the time in ticks that the ritual takes to stop. Negative values will have the ritual going on indefinitely. Zero means that the effect/crafting is applied immediately
 * @param circles     is the byte annotation to define what circles are needed. It follows this pattern 332211TT where 33, 22, 11 are the glyph type of the nth circle, and TT the number of required circles, 0 being 1, 2 being 3. 3 (11) will always return a failed circle
 */
public Ritual(ResourceLocation registryName, @Nonnull NonNullList<Ingredient> input, @Nonnull NonNullList<ItemStack> output, int timeInTicks, int circles, int altarStartingPower, int powerPerTick) {
	this.time = timeInTicks;

	for (int i = 0; i < input.size(); i++) {
		Ingredient ing = input.get(i);
		if (ing.getMatchingStacks().length == 0)
			throw new IllegalArgumentException("Ritual inputs must be valid: ingredient #" + i + " for " + registryName + " has no matching items");
	}

	this.input = input;
	this.output = output;
	this.circles = circles;
	this.altarStartingPower = altarStartingPower;
	this.tickPower = powerPerTick;
	setRegistryName(registryName);
	if (input.size() == 0) throw new IllegalArgumentException("Cannot have an empty input in a ritual");
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:26,代碼來源:Ritual.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");
    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

示例4: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
    NonNullList<ItemStack> nonnulllist = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);

    for (int i = 0; i < nonnulllist.size(); ++i) {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack.isItemEqual(new ItemStack(Items.POTIONITEM))) {
            nonnulllist.set(i, new ItemStack(Items.GLASS_BOTTLE, 1));
            continue;
        }

        nonnulllist.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
    }

    return nonnulllist;
}
 
開發者ID:TeamCovertDragon,項目名稱:MooncakeCraft,代碼行數:19,代碼來源:RemainBottleRecipeFactory.java

示例5: onInputChanged

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public void onInputChanged() {
    ItemStack input = this.input.getStackInSlot(0);
    if (!input.isEmpty()) {
        List<CraftiniumConvert> recipes = CraftiniumConvertRegistry.findMatching(input, this.world, this.converter, this.player);
        NonNullList<ItemStack> allResults = NonNullList.create();
        for (CraftiniumConvert convert : recipes) {
            allResults.addAll(convert.conversions(input, this.world, this.converter, this.player));
        }

        NonNullList<ItemStack> toDisplay = NonNullList.withSize(Math.max(9, allResults.size()), ItemStack.EMPTY);
        for (int i = 0; i < allResults.size(); i++) {
            toDisplay.set(i, allResults.get(i));
        }

        PagedItemStackHandler handler = new PagedItemStackHandler(toDisplay, this.handler.getIndex());
        this.handler = handler;
        this.delegate.setHandler(handler);

        this.detectAndSendChanges();
    }
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:22,代碼來源:CraftiniumConverterContainer.java

示例6: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
    NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);

    for (int i = 0; i < nonnulllist.size(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack.getItem().hasContainerItem())
        {
            nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
        }
    }

    return nonnulllist;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:17,代碼來源:RecipeRepairItem.java

示例7: getStackInSlot

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * Returns the stack in the given slot.
 */
public ItemStack getStackInSlot(int index)
{
    List<ItemStack> list = null;

    for (NonNullList<ItemStack> nonnulllist : this.allInventories)
    {
        if (index < nonnulllist.size())
        {
            list = nonnulllist;
            break;
        }

        index -= nonnulllist.size();
    }

    return list == null ? ItemStack.field_190927_a : (ItemStack)list.get(index);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:InventoryPlayer.java

示例8: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
    NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);

    for (int i = 0; i < nonnulllist.size(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack.getItem() instanceof ItemWrittenBook)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.func_190920_e(1);
            nonnulllist.set(i, itemstack1);
            break;
        }
    }

    return nonnulllist;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:RecipeBookCloning.java

示例9: asItemStackArray

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
private static ItemStack[] asItemStackArray(NonNullList<ItemStack> stacks) {
    ItemStack[] result = new ItemStack[stacks.size()];
    for (int i = 0; i < stacks.size(); i++) {
        result[i] = stacks.get(i);
    }
    return result;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:8,代碼來源:EntityTrackHandler.java

示例10: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * Copied from ShapedRecipes
 */
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
    NonNullList<ItemStack> aitemstack = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);

    for (int i = 0; i < aitemstack.size(); ++i) {
        ItemStack itemstack = inv.getStackInSlot(i);
        aitemstack.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
    }

    return aitemstack;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:15,代碼來源:AbstractRecipe.java

示例11: generateCrushedRecipes

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public static void generateCrushedRecipes() {
    crushedRecipes.put(new ItemStack(Blocks.STONE), new ItemStack(Blocks.COBBLESTONE));
    crushedRecipes.put(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Blocks.GRAVEL));
    crushedRecipes.put(new ItemStack(Blocks.GRAVEL), new ItemStack(Blocks.SAND));
    ItemStack latest = new ItemStack(Blocks.SAND);
    if (Loader.isModLoaded("exnihilocreatio")) {
        Block dust = Block.REGISTRY.getObject(new ResourceLocation("exnihilocreatio:block_dust"));
        crushedRecipes.put(new ItemStack(Blocks.SAND), latest = new ItemStack(dust));
    }
    NonNullList<ItemStack> items = OreDictionary.getOres("itemSilicon");
    if (items.size() > 0) crushedRecipes.put(latest, items.get(0));
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:13,代碼來源:CraftingUtils.java

示例12: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
	// TODO Auto-generated method stub
	NonNullList<ItemStack> aitemstack = NonNullList.withSize(inv.getSizeInventory(),ItemStack.EMPTY);

	for (int i = 0; i < aitemstack.size(); ++i) {
		ItemStack itemstack = inv.getStackInSlot(i);
		aitemstack.set(i,net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
	}

	return aitemstack;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:13,代碼來源:JumperRecipe.java

示例13: func_190901_a

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_)
{
    this.onCrafting(p_190901_2_);
    NonNullList<ItemStack> nonnulllist = CraftingManager.getInstance().getRemainingItems(this.craftMatrix, p_190901_1_.world);

    for (int i = 0; i < nonnulllist.size(); ++i)
    {
        ItemStack itemstack = this.craftMatrix.getStackInSlot(i);
        ItemStack itemstack1 = (ItemStack)nonnulllist.get(i);

        if (!itemstack.func_190926_b())
        {
            this.craftMatrix.decrStackSize(i, 1);
            itemstack = this.craftMatrix.getStackInSlot(i);
        }

        if (!itemstack1.func_190926_b())
        {
            if (itemstack.func_190926_b())
            {
                this.craftMatrix.setInventorySlotContents(i, itemstack1);
            }
            else if (ItemStack.areItemsEqual(itemstack, itemstack1) && ItemStack.areItemStackTagsEqual(itemstack, itemstack1))
            {
                itemstack1.func_190917_f(itemstack.func_190916_E());
                this.craftMatrix.setInventorySlotContents(i, itemstack1);
            }
            else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack1))
            {
                this.thePlayer.dropItem(itemstack1, false);
            }
        }
    }

    return p_190901_2_;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:37,代碼來源:SlotCrafting.java

示例14: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
    NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>withSize(inv.getSizeInventory(), ItemStack.EMPTY);

    for (int i = 0; i < nonnulllist.size(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);
        nonnulllist.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
    }

    return nonnulllist;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:13,代碼來源:RecipeToScrap.java

示例15: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting craftMatrix, World worldIn) {
	for (IRecipe irecipe : this.recipes)
		if (irecipe.matches(craftMatrix, worldIn))
			return irecipe.getRemainingItems(craftMatrix);

	NonNullList<ItemStack> aitemstack = NonNullList.withSize(craftMatrix.getSizeInventory(),ItemStack.EMPTY);

	for (int i = 0; i < aitemstack.size(); ++i)
		aitemstack.set(i,craftMatrix.getStackInSlot(i));

	return aitemstack;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:13,代碼來源:TF2CraftingManager.java


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