当前位置: 首页>>代码示例>>Java>>正文


Java InventoryCrafting.getStackInRowAndColumn方法代码示例

本文整理汇总了Java中net.minecraft.inventory.InventoryCrafting.getStackInRowAndColumn方法的典型用法代码示例。如果您正苦于以下问题:Java InventoryCrafting.getStackInRowAndColumn方法的具体用法?Java InventoryCrafting.getStackInRowAndColumn怎么用?Java InventoryCrafting.getStackInRowAndColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.inventory.InventoryCrafting的用法示例。


在下文中一共展示了InventoryCrafting.getStackInRowAndColumn方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = inv.getStackInRowAndColumn(1, 1);

    if (itemstack.getItem() != Items.LINGERING_POTION)
    {
        return ItemStack.field_190927_a;
    }
    else
    {
        ItemStack itemstack1 = new ItemStack(Items.TIPPED_ARROW, 8);
        PotionUtils.addPotionToItemStack(itemstack1, PotionUtils.getPotionFromItem(itemstack));
        PotionUtils.appendEffects(itemstack1, PotionUtils.getFullEffectsFromItem(itemstack));
        return itemstack1;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:RecipeTippedArrow.java

示例2: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
 * Returns an Item that is the result of this recipe
 */
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = inv.getStackInRowAndColumn(1, 1);

    if (itemstack != null && itemstack.getItem() == Items.LINGERING_POTION)
    {
        ItemStack itemstack1 = new ItemStack(Items.TIPPED_ARROW, 8);
        PotionUtils.addPotionToItemStack(itemstack1, PotionUtils.getPotionFromItem(itemstack));
        PotionUtils.appendEffects(itemstack1, PotionUtils.getFullEffectsFromItem(itemstack));
        return itemstack1;
    }
    else
    {
        return null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:RecipeTippedArrow.java

示例3: extractReduceMirror

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public List<ItemStack[][]> extractReduceMirror(InventoryCrafting inv) {
    ItemStack[][] grid = new ItemStack[inv.getHeight()][inv.getWidth()];
    for (int y = 0; y < inv.getHeight(); y++) {
        for (int x = 0; x < inv.getWidth(); x++) {
            grid[y][x] = inv.getStackInRowAndColumn(x, y);
        }
    }
    return mirror(reduceBlank(grid));
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:10,代码来源:RandoresItemRecipe.java

示例4: 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.newArrayList(this.recipeItems);

    for (int i = 0; i < inv.getHeight(); ++i)
    {
        for (int j = 0; j < inv.getWidth(); ++j)
        {
            ItemStack itemstack = inv.getStackInRowAndColumn(j, i);

            if (itemstack != null)
            {
                boolean flag = false;

                for (ItemStack itemstack1 : list)
                {
                    if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata()))
                    {
                        flag = true;
                        list.remove(itemstack1);
                        break;
                    }
                }

                if (!flag)
                {
                    return false;
                }
            }
        }
    }

    return list.isEmpty();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:ShapelessRecipes.java

示例5: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting grid) {
	ItemStack potion = grid.getStackInRowAndColumn(1, 1);
	List<PotionEffect> effects = ((LingeringPotion) ModItems.lingering_potion).getEffects(potion);

	ItemStack stack = new ItemStack(ModItems.tipped_arrow, 8);
	if (!effects.isEmpty()) {
		PotionEffect effect = effects.get(0);
		TippedArrow.setEffect(stack, Potion.potionTypes[effect.getPotionID()], effect.getDuration());
	}

	return stack;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:14,代码来源:RecipeTippedArrow.java

示例6: checkMatch

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
protected boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror)
{
    int[] amounts = getAmounts(mirror);

    for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
    {
        for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
        {
            int subX = x - startX;
            int subY = y - startY;
            int damage = 0;
            Ingredient target = Ingredient.EMPTY;

            if (subX >= 0 && subY >= 0 && subX < width && subY < height)
            {
                damage = amounts[subX + width * subY];

                if (mirror)
                {
                    target = input.get(width - subX - 1 + subY * width);
                } else
                {
                    target = input.get(subX + subY * width);
                }
            }

            ItemStack slot = inv.getStackInRowAndColumn(x, y);

            if (!target.apply(slot) || damage > slot.getMaxDamage() - slot.getItemDamage() + 1)
            {
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:39,代码来源:DamageableShapedOreRecipe.java

示例7: 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 (inv.getWidth() == 3 && inv.getHeight() == 3)
    {
        for (int i = 0; i < inv.getWidth(); ++i)
        {
            for (int j = 0; j < inv.getHeight(); ++j)
            {
                ItemStack itemstack = inv.getStackInRowAndColumn(i, j);

                if (itemstack.func_190926_b())
                {
                    return false;
                }

                Item item = itemstack.getItem();

                if (i == 1 && j == 1)
                {
                    if (item != Items.LINGERING_POTION)
                    {
                        return false;
                    }
                }
                else if (item != Items.ARROW)
                {
                    return false;
                }
            }
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:42,代码来源:RecipeTippedArrow.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)
{
    List<ItemStack> list = Lists.newArrayList(this.recipeItems);

    for (int i = 0; i < inv.getHeight(); ++i)
    {
        for (int j = 0; j < inv.getWidth(); ++j)
        {
            ItemStack itemstack = inv.getStackInRowAndColumn(j, i);

            if (!itemstack.func_190926_b())
            {
                boolean flag = false;

                for (ItemStack itemstack1 : list)
                {
                    if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata()))
                    {
                        flag = true;
                        list.remove(itemstack1);
                        break;
                    }
                }

                if (!flag)
                {
                    return false;
                }
            }
        }
    }

    return list.isEmpty();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:38,代码来源:ShapelessRecipes.java

示例9: checkMatch

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
/**
 * Checks if the region of a crafting inventory is match for the recipe.
 */
private boolean checkMatch(InventoryCrafting p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_)
{
    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            int k = i - p_77573_2_;
            int l = j - p_77573_3_;
            ItemStack itemstack = null;

            if (k >= 0 && l >= 0 && k < this.recipeWidth && l < this.recipeHeight)
            {
                if (p_77573_4_)
                {
                    itemstack = this.recipeItems[this.recipeWidth - k - 1 + l * this.recipeWidth];
                }
                else
                {
                    itemstack = this.recipeItems[k + l * this.recipeWidth];
                }
            }

            ItemStack itemstack1 = p_77573_1_.getStackInRowAndColumn(i, j);

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

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

                if (itemstack.getMetadata() != 32767 && itemstack.getMetadata() != itemstack1.getMetadata())
                {
                    return false;
                }
            }
        }
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:50,代码来源:ShapedRecipes.java

示例10: matches

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@Override
public boolean matches(InventoryCrafting matrix, World world)
   {
       ArrayList arraylist = new ArrayList(this.recipeItems);

       for (int column = 0; column < 3; ++column)
       {
           for (int row = 0; row < 3; ++row)
           {
               ItemStack itemstack = matrix.getStackInRowAndColumn(row, column);

               if (itemstack != null)
               {
                   boolean flag = false;
                   Iterator<ItemStack> iterator = arraylist.iterator();

                   while (iterator.hasNext())
                   {
                       ItemStack requiredItemStack = iterator.next();

                       if (itemstack.getItem() == requiredItemStack.getItem() && (requiredItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || itemstack.getItemDamage() == requiredItemStack.getItemDamage()))
                       {
                           flag = true;
                           arraylist.remove(requiredItemStack);
                           break;
                       }
                   }

                   if (!flag)
                   {
                       return false;
                   }
               }
               // else, there's nothing in that slot
           }
       }

       if (arraylist.isEmpty() && world.isRemote)
       {
       	if (this.getRecipeOutput().getItem() instanceof PaymentOrder && this.hasPaymentOrderInMatrix(matrix))
		{
           	return true;	// Only leaders can craft this item, but refilling is free
		}
       	else
       	{
       		// All items were found and we're on client side. Asking the server now if you're a leader (Can't craft this if you aren't)
       		return ClientHelper.isPlayerLeader(Minecraft.getMinecraft().thePlayer.dimension, Minecraft.getMinecraft().thePlayer.getEntityId());
       		//return false;
       	}
       }
       else if (!world.isRemote)
       {
       	// Server side. How do I get the player instance?
       	// Answer: I don't. :|
       	// I could get the player list and see which one has a container open and THEN seeing which one has the items in the matrix listed here?
       	Main.console("[Territorial Dealings - Server] Can't check if this player is allowed to craft this item, since I don't know who asked for this recipe on this side. :/");
       }

       return arraylist.isEmpty();
   }
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:61,代码来源:Recipe_LeaderRequired.java

示例11: checkMatch

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
private boolean checkMatch(InventoryCrafting crafting, InventoryWorkbenchAdditionalMaterials materials, int startX,
                           int startY, boolean mirror)
{
	for (int k = 0; k < 3; ++k)
	{
		for (int l = 0; l < 3; ++l)
		{
			int i1 = k - startX;
			int j1 = l - startY;
			RecipeElement neededCraftingStack = null;

			if (i1 >= 0 && j1 >= 0 && i1 < recipeWidth && j1 < recipeHeight)
			{
				if (mirror)
				{
					neededCraftingStack = recipeItems[recipeWidth - i1 - 1 + j1 * recipeWidth];
				}
				else
				{
					neededCraftingStack = recipeItems[i1 + j1 * recipeWidth];
				}
			}

			ItemStack craftingStackInQuestion = crafting.getStackInRowAndColumn(k, l);

			if (craftingStackInQuestion != null && neededCraftingStack != null)
			{
				if (!neededCraftingStack.matches(craftingStackInQuestion))
				{
					return false;
				}
			}
			else if ((craftingStackInQuestion == null) ^ (neededCraftingStack == null))
			{
				return false;
			}
		}
	}

	if(addedMaterials.length > materials.getSizeInventory())
	{
		LogUtil.log(Level.ERROR, "Recipe for " + this.recipeOutput.getDisplayName() + " has too many catalysts required.");
		return false;
	}
	
	for (RecipeElement requiredMatStack : addedMaterials)
	{
		boolean foundIt = false;
		for (int i2 = 0; i2 < materials.getSizeInventory(); ++i2)
		{
			ItemStack testedMatStack = materials.getStackInSlot(i2);
			if (testedMatStack != null)
			{
				foundIt = requiredMatStack.matchesCheckSize(testedMatStack);
			}

			if (foundIt)
			{
				break;
			}
		}

		if (!foundIt)
		{
			return false;
		}
	}

	return true;
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:71,代码来源:AdvancedRecipe.java

示例12: checkMatchMostly

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
public boolean checkMatchMostly(InventoryCrafting crafting, int width, int height, boolean flag4)
{
	for (int k = 0; k < 3; ++k)
	{
		for (int l = 0; l < 3; ++l)
		{
			int i1 = k - width;
			int j1 = l - height;
			RecipeElement neededCraftingStack = null;

			if (i1 >= 0 && j1 >= 0 && i1 < recipeWidth && j1 < recipeHeight)
			{
				if (flag4)
				{
					neededCraftingStack = recipeItems[recipeWidth - i1 - 1 + j1 * recipeWidth];
				}
				else
				{
					neededCraftingStack = recipeItems[i1 + j1 * recipeWidth];
				}
			}

			ItemStack craftingStackInQuestion = crafting.getStackInRowAndColumn(k, l);

			if (craftingStackInQuestion != null && neededCraftingStack != null)
			{
				if (!neededCraftingStack.matches(craftingStackInQuestion))
				{
					return false;
				}
			}
			else if ((craftingStackInQuestion == null) ^ (neededCraftingStack == null))
			{
				return false;
			}

		}
	}

	return true;
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:42,代码来源:AdvancedRecipe.java

示例13: checkMatch

import net.minecraft.inventory.InventoryCrafting; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror)
{
    for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
    {
        for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
        {
            int subX = x - startX;
            int subY = y - startY;
            Object target = null;

            if (subX >= 0 && subY >= 0 && subX < width && subY < height)
            {
                if (mirror)
                {
                    target = input[width - subX - 1 + subY * width];
                }
                else
                {
                    target = input[subX + subY * width];
                }
            }

            ItemStack slot = inv.getStackInRowAndColumn(x, y);

            if (target instanceof ItemStack)
            {
                if (!OreDictionary.itemMatches((ItemStack)target, slot, false))
                {
                    return false;
                }
            }
            else if (target instanceof List)
            {
                boolean matched = false;

                Iterator<ItemStack> itr = ((List<ItemStack>)target).iterator();
                while (itr.hasNext() && !matched)
                {
                    matched = OreDictionary.itemMatches(itr.next(), slot, false);
                }

                if (!matched)
                {
                    return false;
                }
            }
            else if (target == null && slot != null)
            {
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:57,代码来源:ShapedOreRecipe.java


注:本文中的net.minecraft.inventory.InventoryCrafting.getStackInRowAndColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。