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


Java InventoryCrafting.getStackInSlot方法代碼示例

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


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

示例1: getRemainingItems

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的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,代碼來源:RecipeFireworks.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:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:RecipesMapCloning.java

示例3: getAAFromMatrix

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
private ItemStack getAAFromMatrix(InventoryCrafting matrix)
{
	int counter = 0;
	
	while (counter < matrix.getSizeInventory())
	{
		if (matrix.getStackInSlot(counter) != null && matrix.getStackInSlot(counter).getItem() instanceof PackedUpAA)
		{
			return matrix.getStackInSlot(counter);	// Found it
		}
		
		counter += 1;
	}
	
	return null;
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:17,代碼來源:Recipe_AA_Plating.java

示例4: getRemainingItems

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的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

示例5: matches

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
	int slots = inv.getHeight() * inv.getWidth();
	int center = (int) ((float)slots / 2F);
	ItemStack checked = inv.getStackInSlot(center);
	if(checked.isEmpty() || !checked.hasTagCompound()) return false;
	int amount = 0;

	for(int j = 0; j < slots; j++) {
		ItemStack stack = inv.getStackInSlot(j);
		if(!stack.isEmpty() && (!hasTag(stack) || stack.getItem() != checked.getItem())) return false;
		if(!stack.isEmpty() && j != center) {
			amount++;
		}
	}

	return amount > 0;
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:19,代碼來源:EntangledCloningRecipe.java

示例6: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
	ItemStack inputSlaw = inv.getStackInSlot(0);

	byte additions = 0;
	if (inputSlaw.hasTagCompound()) {
		additions = inputSlaw.getTagCompound().getByte("additions");
	}
	additions += 1;

	ItemStack outputStack = new ItemStack(ModItems.simic_slaw);
	outputStack.setTagCompound(new NBTTagCompound());
	outputStack.getTagCompound().setByte("additions", additions);

	return outputStack;
}
 
開發者ID:DarkMorford,項目名稱:BetterThanWeagles,代碼行數:17,代碼來源:RecipeSimicSlaw.java

示例7: matches

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
    int count = 0;
    boolean forge = false;
    for (int i = 0; i < inv.getSizeInventory(); i++) {
        ItemStack stack = inv.getStackInSlot(i);
        if(!stack.isEmpty()) {
            if(stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof CraftiniumForge) {
                if(forge && !this.combining) {
                    return false;
                } else {
                    forge = true;
                    if(!stack.hasTagCompound() || stack.getSubCompound("randores") == null || !stack.getSubCompound("randores").hasKey("furnace_speed")) {
                        return false;
                    }
                }
            } else if (this.upgrades.keySet().stream().noneMatch(k -> k.apply(stack))) {
                return false;
            }
            count++;
        }
    }
    return count >= 2 && forge;
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:25,代碼來源:RandoresForgeUpgradeRecipe.java

示例8: matches

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
@Override
public boolean matches(InventoryCrafting inv, World worldIn)
{
	ItemStack tempStack = ItemStack.EMPTY;
	if (VALID_ITEMS == null) buildValidItemsArray();

	int potionEffects = 0;
	for (int i = 0; i < inv.getSizeInventory(); i++)
	{
		ItemStack stack = inv.getStackInSlot(i);
		if (!stack.isEmpty())
		{
			Item item = stack.getItem();
			if (!ArrayUtils.contains(VALID_ITEMS, item)) return false;

			if (tempStack.isEmpty())
			{
				tempStack = stack.copy();
			}
			else
			{
				if (!canCombineItems(tempStack, stack)) return false;
			}

			if (ModConfiguration.maxPotionEffects >= 0)
			{
				potionEffects += getEffectsFromStack(stack).size();
				if (potionEffects > ModConfiguration.maxPotionEffects) return false;
			}
		}
	}

	return true;
}
 
開發者ID:crazysnailboy,項目名稱:CombinedPotions,代碼行數:35,代碼來源:RecipeCombinedPotions2.java

示例9: matches

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    if (!super.matches(inv, worldIn))
    {
        return false;
    }
    else
    {
        ItemStack itemstack = ItemStack.field_190927_a;

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

            if (itemstack1.getItem() == Items.FILLED_MAP)
            {
                itemstack = itemstack1;
            }
        }

        if (itemstack.func_190926_b())
        {
            return false;
        }
        else
        {
            MapData mapdata = Items.FILLED_MAP.getMapData(itemstack, worldIn);
            return mapdata == null ? false : (this.func_190934_a(mapdata) ? false : mapdata.scale < 4);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:35,代碼來源:RecipesMapExtending.java

示例10: 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:SkidJava,項目名稱:BaseClient,代碼行數:38,代碼來源:RecipesMapCloning.java

示例11: matches

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

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

            if (itemstack1 != null && itemstack1.getItem() == Items.filled_map)
            {
                itemstack = itemstack1;
            }
        }

        if (itemstack == null)
        {
            return false;
        }
        else
        {
            MapData mapdata = Items.filled_map.getMapData(itemstack, worldIn);
            return mapdata == null ? false : mapdata.scale < 4;
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:35,代碼來源:RecipesMapExtending.java

示例12: 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

示例13: findHelmet

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
private ItemStack findHelmet(InventoryCrafting inv) {
    for (int i = 0; i < inv.getSizeInventory(); i++) {
        if (inv.getStackInSlot(i).getItem() == Itemss.PNEUMATIC_HELMET) {
            return inv.getStackInSlot(i);
        }
    }
    return ItemStack.EMPTY;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:9,代碼來源:RecipeOneProbe.java

示例14: matches

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

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

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() instanceof ItemArmor)
            {
                ItemArmor itemarmor = (ItemArmor)itemstack1.getItem();

                if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null)
                {
                    return false;
                }

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

                list.add(itemstack1);
            }
        }
    }

    return itemstack != null && !list.isEmpty();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:40,代碼來源:RecipesArmorDyes.java

示例15: matches

import net.minecraft.inventory.InventoryCrafting; //導入方法依賴的package包/類
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    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().isDamageable())
                {
                    return false;
                }
            }
        }
    }

    return list.size() == 2;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:30,代碼來源:RecipeRepairItem.java


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