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


Java IRecipe.matches方法代码示例

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


在下文中一共展示了IRecipe.matches方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRecipe

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
public static IRecipe getRecipe(World world, ICraftingWidget widget) {
    InventoryCrafting craftingGrid = widget.getCraftingGrid();
    for (IRecipe recipe : CraftingManager.REGISTRY) {
        if (recipe.matches(craftingGrid, world)) {
            return recipe;
        }
    }
    return null;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:ProgWidgetCrafting.java

示例2: findMatchingRecipe

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
public static ItemStack findMatchingRecipe(Iterable<IRecipe> recipes, InventoryCrafting craftMatrix, World worldIn)
{
    for (IRecipe irecipe : recipes)
    {
        if (irecipe.matches(craftMatrix, worldIn))
        {
            return irecipe.getCraftingResult(craftMatrix);
        }
    }

    return ItemStack.EMPTY;
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:13,代码来源:CraftingManagerCS4.java

示例3: findMatchingRecipe

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
 * Retrieves an ItemStack that has multiple recipes for it.
 */
@Nullable
public ItemStack findMatchingRecipe(InventoryCrafting craftMatrix, World worldIn) {
	for (IRecipe irecipe : this.recipes)
		if (irecipe.matches(craftMatrix, worldIn))
			return irecipe.getCraftingResult(craftMatrix);

	return ItemStack.EMPTY;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:12,代码来源:TF2CraftingManager.java

示例4: getRemainingItems

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的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

示例5: matches

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
	int countSocks = 0;
	int countDyes = 0;

	for (int i = 0; i < inv.getSizeInventory(); i++) {
		ItemStack s = inv.getStackInSlot(i);
		if (!s.isEmpty()) {
			if (s.getItem() instanceof ItemSock && PonySocks.sock.isColorable(s)) {
				countSocks++;
			} else if (hasColor(s)) {
				countDyes++;
			} else {
				return false;
			}
		}
	}

	if (countSocks == 1 && countDyes > 0) {
		for (IRecipe recipe : PonySocks.specialDyeRecipes) {
			if (recipe.matches(inv, worldIn)) {
				return false;
			}
		}

		return true;
	} else {
		return false;
	}
}
 
开发者ID:asiekierka,项目名称:PonySocks2,代码行数:31,代码来源:RecipeSockPaint.java

示例6: shouldExecute

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
@Override
public boolean shouldExecute() {
    IRecipe recipe = ProgWidgetCrafting.getRecipe(drone.world(), widget);
    if (recipe == null) return false;
    InventoryCrafting craftingGrid = widget.getCraftingGrid();
    for (int crafted = 0; !((ICountWidget) widget).useCount() || crafted < ((ICountWidget) widget).getCount(); crafted++) {
        List<ItemStack>[] equivalentsList = new List[9];
        for (int i = 0; i < equivalentsList.length; i++) {
            ItemStack originalStack = craftingGrid.getStackInSlot(i);
            if (!originalStack.isEmpty()) {
                List<ItemStack> equivalents = new ArrayList<>();
                for (int j = 0; j < drone.getInv().getSlots(); j++) {
                    ItemStack droneStack = drone.getInv().getStackInSlot(j);
                    if (!droneStack.isEmpty() && (droneStack.getItem() == originalStack.getItem() || PneumaticCraftUtils.isSameOreDictStack(droneStack, originalStack))) {
                        equivalents.add(droneStack);
                    }
                }
                if (equivalents.isEmpty()) return false;
                equivalentsList[i] = equivalents;
            }
        }

        int[] curIndexes = new int[9];
        boolean first = true;
        boolean hasCrafted = false;
        while (first || count(curIndexes, equivalentsList)) {
            first = false;
            InventoryCrafting craftMatrix = new InventoryCrafting(new Container() {
                @Override
                public boolean canInteractWith(EntityPlayer p_75145_1_) {
                    return false;
                }

            }, 3, 3);
            for (int i = 0; i < 9; i++) {
                ItemStack stack = equivalentsList[i] == null ? ItemStack.EMPTY : equivalentsList[i].get(curIndexes[i]);
                craftMatrix.setInventorySlotContents(i, stack);
            }
            if (recipe.matches(craftMatrix, drone.world())) {
                if (craft(recipe.getCraftingResult(craftMatrix), craftMatrix)) {
                    hasCrafted = true;
                    break;
                }
            }
        }
        if (!hasCrafted) return false;
    }
    return false;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:50,代码来源:ProgWidgetCrafting.java

示例7: isRecipeMatch

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
public static boolean isRecipeMatch(IRecipe recipe, InventoryCrafting grid) {
    return recipe.matches(grid, getWorld());
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:4,代码来源:ZWrapper.java


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