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


Java InventoryCrafting.getSizeInventory方法代碼示例

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


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

示例1: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = this.getRecipeOutput().copy();

    if (this.copyIngredientNBT)
    {
        for (int i = 0; i < inv.getSizeInventory(); ++i)
        {
            ItemStack itemstack1 = inv.getStackInSlot(i);

            if (itemstack1 != null && itemstack1.hasTagCompound())
            {
                itemstack.setTagCompound((NBTTagCompound)itemstack1.getTagCompound().copy());
            }
        }
    }

    return itemstack;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:ShapedRecipes.java

示例2: getRemainingItems

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

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

        if (itemstack != null && itemstack.getItem().hasContainerItem())
        {
            aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
        }
    }

    return aitemstack;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:RecipesArmorDyes.java

示例3: getRemainingItems

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

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

        if (itemstack != null && itemstack.getItem() instanceof ItemEditableBook)
        {
            aitemstack[i] = itemstack;
            break;
        }
    }

    return aitemstack;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:18,代碼來源:RecipeBookCloning.java

示例4: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Returns an Item that is the result of this recipe
 */
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.stackSize = 1;
            return itemstack1;
        }
    }

    return null;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:21,代碼來源:RecipesBanners.java

示例5: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = this.getRecipeOutput().copy();

    if (this.copyIngredientNBT)
    {
        for (int i = 0; i < inv.getSizeInventory(); ++i)
        {
            ItemStack itemstack1 = inv.getStackInSlot(i);

            if (!itemstack1.func_190926_b() && itemstack1.hasTagCompound())
            {
                itemstack.setTagCompound(itemstack1.getTagCompound().copy());
            }
        }
    }

    return itemstack;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:23,代碼來源:ShapedRecipes.java

示例6: func_180303_b

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
public ItemStack[] func_180303_b(InventoryCrafting p_180303_1_, World worldIn)
{
    for (IRecipe irecipe : this.recipes)
    {
        if (irecipe.matches(p_180303_1_, worldIn))
        {
            return irecipe.getRemainingItems(p_180303_1_);
        }
    }

    ItemStack[] aitemstack = new ItemStack[p_180303_1_.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        aitemstack[i] = p_180303_1_.getStackInSlot(i);
    }

    return aitemstack;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:20,代碼來源:CraftingManager.java

示例7: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (!itemstack.func_190926_b() && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.func_190920_e(1);
            return itemstack1;
        }
    }

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

示例8: matches

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    int i = 0;
    ItemStack itemstack = null;

    for (int j = 0; j < inv.getSizeInventory(); ++j)
    {
        ItemStack itemstack1 = inv.getStackInSlot(j);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() == Items.FILLED_MAP)
            {
                if (itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.MAP)
                {
                    return false;
                }

                ++i;
            }
        }
    }

    return itemstack != null && i > 0;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:38,代碼來源:RecipesMapCloning.java

示例9: isInMatrix

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
private boolean isInMatrix(InventoryCrafting matrix, Item item) 
{
	if (item == null) { return false; }	// Can't find what doesn't exist
	
	int counter = 0;
	
	ItemStack stack = matrix.getStackInSlot(counter);
	
	while (counter < matrix.getSizeInventory())	// scouring through the entire thing
	{
		if (stack != null && stack.getItem().getClass() == item.getClass()) // Found one!
		{ 
			if (stack.getItem() instanceof _WeaponBase)	// Is a weapon, so need to ensure that it's empty
			{
				if (stack.getItemDamage() == stack.getMaxDamage()) { return true; }
				// else, isn't empty
			}
			else if (stack.getItem() instanceof _AmmoBase)	// is ammo
			{
				this.metadata = stack.getItemDamage();	// Keeping track of what this is gonna make, so I don't have to constantly recheck
				return true; 
			}
			// else, don't care what this is
		}
		// else, empty. That's fine
		
		// Next!
		counter += 1;
		stack = matrix.getStackInSlot(counter);
	}
	
	return false;	// Fallback. Didn't find what I'm looking for
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:34,代碼來源:Recipe_Ammo.java

示例10: getRemainingItems

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);
        aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
    }

    return aitemstack;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:13,代碼來源:ShapedRecipes.java

示例11: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    int i = 0;
    ItemStack itemstack = ItemStack.field_190927_a;

    for (int j = 0; j < inv.getSizeInventory(); ++j)
    {
        ItemStack itemstack1 = inv.getStackInSlot(j);

        if (!itemstack1.func_190926_b())
        {
            if (itemstack1.getItem() == Items.WRITTEN_BOOK)
            {
                if (!itemstack.func_190926_b())
                {
                    return ItemStack.field_190927_a;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.WRITABLE_BOOK)
                {
                    return ItemStack.field_190927_a;
                }

                ++i;
            }
        }
    }

    if (!itemstack.func_190926_b() && itemstack.hasTagCompound() && i >= 1 && ItemWrittenBook.getGeneration(itemstack) < 2)
    {
        ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK, i);
        itemstack2.setTagCompound(itemstack.getTagCompound().copy());
        itemstack2.getTagCompound().setInteger("generation", ItemWrittenBook.getGeneration(itemstack) + 1);

        if (itemstack.hasDisplayName())
        {
            itemstack2.setStackDisplayName(itemstack.getDisplayName());
        }

        return itemstack2;
    }
    else
    {
        return ItemStack.field_190927_a;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:54,代碼來源:RecipeBookCloning.java

示例12: matches

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    ItemStack itemstack1 = null;

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack2 = inv.getStackInSlot(i);

        if (itemstack2 != null)
        {
            if (itemstack2.getItem() != Items.banner)
            {
                return false;
            }

            if (itemstack != null && itemstack1 != null)
            {
                return false;
            }

            int j = TileEntityBanner.getBaseColor(itemstack2);
            boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0;

            if (itemstack != null)
            {
                if (flag)
                {
                    return false;
                }

                if (j != TileEntityBanner.getBaseColor(itemstack))
                {
                    return false;
                }

                itemstack1 = itemstack2;
            }
            else if (itemstack1 != null)
            {
                if (!flag)
                {
                    return false;
                }

                if (j != TileEntityBanner.getBaseColor(itemstack1))
                {
                    return false;
                }

                itemstack = itemstack2;
            }
            else if (flag)
            {
                itemstack = itemstack2;
            }
            else
            {
                itemstack1 = itemstack2;
            }
        }
    }

    return itemstack != null && itemstack1 != null;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:66,代碼來源:RecipesBanners.java

示例13: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    int i = 0;
    ItemStack itemstack = ItemStack.field_190927_a;

    for (int j = 0; j < inv.getSizeInventory(); ++j)
    {
        ItemStack itemstack1 = inv.getStackInSlot(j);

        if (!itemstack1.func_190926_b())
        {
            if (itemstack1.getItem() == Items.FILLED_MAP)
            {
                if (!itemstack.func_190926_b())
                {
                    return ItemStack.field_190927_a;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.MAP)
                {
                    return ItemStack.field_190927_a;
                }

                ++i;
            }
        }
    }

    if (!itemstack.func_190926_b() && i >= 1)
    {
        ItemStack itemstack2 = new ItemStack(Items.FILLED_MAP, i + 1, itemstack.getMetadata());

        if (itemstack.hasDisplayName())
        {
            itemstack2.setStackDisplayName(itemstack.getDisplayName());
        }

        if (itemstack.hasTagCompound())
        {
            itemstack2.setTagCompound(itemstack.getTagCompound());
        }

        return itemstack2;
    }
    else
    {
        return ItemStack.field_190927_a;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:57,代碼來源:RecipesMapCloning.java

示例14: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Returns an Item that is the result of this recipe
 */
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

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

        if (itemstack != null)
        {
            list.add(itemstack);

            if (list.size() > 1)
            {
                ItemStack itemstack1 = (ItemStack)list.get(0);

                if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable())
                {
                    return null;
                }
            }
        }
    }

    if (list.size() == 2)
    {
        ItemStack itemstack2 = (ItemStack)list.get(0);
        ItemStack itemstack3 = (ItemStack)list.get(1);

        if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable())
        {
            // FORGE: Make itemstack sensitive // Item item = itemstack2.getItem();
            int j = itemstack2.getMaxDamage() - itemstack2.getItemDamage();
            int k = itemstack2.getMaxDamage() - itemstack3.getItemDamage();
            int l = j + k + itemstack2.getMaxDamage() * 5 / 100;
            int i1 = itemstack2.getMaxDamage() - l;

            if (i1 < 0)
            {
                i1 = 0;
            }

            return new ItemStack(itemstack2.getItem(), 1, i1);
        }
    }

    return null;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:53,代碼來源:RecipeRepairItem.java


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