当前位置: 首页>>代码示例>>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;未经允许,请勿转载。