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


Java CraftingManager类代码示例

本文整理汇总了Java中net.minecraft.item.crafting.CraftingManager的典型用法代码示例。如果您正苦于以下问题:Java CraftingManager类的具体用法?Java CraftingManager怎么用?Java CraftingManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: removeRecipe

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
/**
 * Removes all recipes that produce a given item.
 * @param itemToRemove The item whose recipes are to be removed.
 */
private static void removeRecipe(Item itemToRemove) {
    Iterator<IRecipe> iter = CraftingManager.getInstance().getRecipeList().iterator();
    while (iter.hasNext()) {
        IRecipe recipe = iter.next();
        ItemStack out = recipe.getRecipeOutput();
        if (out != ItemStack.EMPTY && out.getItem() == itemToRemove) {
            FMLLog.info("Removing recipe for " + out);
            iter.remove();
        }
    }
}
 
开发者ID:elifoster,项目名称:MakeClayValuableAgain,代码行数:16,代码来源:MakeClayValuableAgain.java

示例2: getDyeColorMixFromParents

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:EntitySheep.java

示例3: loadElements

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
@Override
public IGuideElement[] loadElements() {
    String[] txt = new String[]{"Heyo", "This is just a test of a new algorithm for my little guide :D", "", "Nice to meet ya", "Ya boi", "", "", "Hehehehe", ""};
    return new IGuideElement[]{
            /*new TextElement(Arrays.asList(txt)),
            new TextElement(Arrays.asList(txt)),
            new TextElement(Arrays.asList(txt)),*/
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
    };
}
 
开发者ID:Guichaguri,项目名称:ProjectEon,代码行数:19,代码来源:GuideArticle.java

示例4: getRecipesForRequestedOutput

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
/** Attempt to find all recipes that result in an item of the requested output.
 * @param output the desired item, eg from Types.xsd - "diamond_pickaxe" etc - or as a Minecraft name - eg "tile.woolCarpet.blue"
 * @return a list of IRecipe objects that result in this item.
 */
public static List<IRecipe> getRecipesForRequestedOutput(String output)
{
    List<IRecipe> matchingRecipes = new ArrayList<IRecipe>();
    ItemStack target = MinecraftTypeHelper.getItemStackFromParameterString(output);
    List<?> recipes = CraftingManager.getInstance().getRecipeList();
    for (Object obj : recipes)
    {
        if (obj == null)
            continue;
        if (obj instanceof IRecipe)
        {
            ItemStack is = ((IRecipe)obj).getRecipeOutput();
            if (is == null)
                continue;
            if (ItemStack.areItemsEqual(is, target))
            {
                matchingRecipes.add((IRecipe)obj);
            }
        }
    }
    return matchingRecipes;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:27,代码来源:CraftingHelper.java

示例5: onCraftingMatrixChanged

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
@Override
public void onCraftingMatrixChanged() {
    if (currentRecipe == null || !currentRecipe.matches(matrix, DimensionManager.getWorld(controllerDimension))) {
        currentRecipe = CraftingManager.findMatchingRecipe(matrix, DimensionManager.getWorld(controllerDimension));
    }

    if (currentRecipe == null) {
        result.setInventorySlotContents(0, ItemStack.EMPTY);
    } else {
        result.setInventorySlotContents(0, currentRecipe.getCraftingResult(matrix));
    }

    if (!getStack().hasTagCompound()) {
        getStack().setTagCompound(new NBTTagCompound());
    }

    StackUtils.writeItems(matrix, 1, getStack().getTagCompound());
}
 
开发者ID:raoulvdberge,项目名称:refinedstorageaddons,代码行数:19,代码来源:WirelessCraftingGrid.java

示例6: getDyeColorMixFromParents

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).world);
    int k;

    if (itemstack.getItem() == Items.DYE)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.world.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:EntitySheep.java

示例7: getSmeltingResult

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
public ItemStack[] getSmeltingResult(InventoryCrafting inv, World world, Tier tier) {
	return new ItemStack[] { CraftingManager.getInstance().findMatchingRecipe(inv, world) };
	/*
	@SuppressWarnings("unchecked")
	List<IRecipe> recipeList = CraftingManager.getInstance().getRecipeList();

	Iterator<IRecipe> iterator = recipeList.iterator();
	while(iterator.hasNext()) {
		IRecipe recipe = iterator.next();
		if(recipe != null && inv != null) {
			if(recipe.getCraftingResult(inv) != null)
				FMLLog.log(Level.INFO, "result: " + recipe.getCraftingResult(inv));
			else
				FMLLog.log(Level.INFO, "result: null");
			if(recipe.matches(inv, world)) {
				return new ItemStack[] { recipe.getCraftingResult(inv) };
			}
		} else {
			FMLLog.log(Level.INFO, "_null");
		}
	}
	return null;
	*/
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:25,代码来源:AutoWorkBenchRecipes.java

示例8: sortCraftManager

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
public static void sortCraftManager()
{
    bake();
    FMLLog.fine("Sorting recipes");
    warned.clear();
    Collections.sort(CraftingManager.getInstance().getRecipeList(), INSTANCE);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:RecipeSorter.java

示例9: getDyeColorMixFromParents

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.DYE)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:EntitySheep.java

示例10: loadUsageRecipes

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
        CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes) {
            recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
        } else if (irecipe instanceof ShapedOreRecipe) {
            recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
        }

        if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) {
            continue;
        }

        recipe.computeVisuals();
        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:22,代码来源:ShapedRecipeHandler.java

示例11: SC2RecipeTweaks

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void SC2RecipeTweaks()
{
	if(Loader.isModLoaded("steamcraft2"))
	{
		if(!ConfigSettings.FleshBlockRecipe)
		{
			List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
			for (int i = 0; i < recipes.size(); i++)
			{
				if (recipes.get(i) != null)
				{
					ItemStack recipeResult = recipes.get(i).getRecipeOutput();
					
					if (recipeResult != null && recipeResult.getItem() == Item.getItemFromBlock(InitBlocks.blockFlesh))
					{
						recipes.remove(i--);
					}
				}
			}
		}
		
		//OreDictionary.registerOre("itemAxe", new ItemStack(InitItems.axeSteam, 1, OreDictionary.WILDCARD_VALUE));
	}
}
 
开发者ID:StrayWolfe,项目名称:TerrafirmaPunk-Tweaks,代码行数:26,代码来源:RecipeTweaks.java

示例12: loadCraftingRecipes

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) {
        List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
        for (IRecipe irecipe : allrecipes) {
            CachedShapelessRecipe recipe = null;
            if (irecipe instanceof ShapelessRecipes)
                recipe = shapelessRecipe((ShapelessRecipes) irecipe);
            else if (irecipe instanceof ShapelessOreRecipe)
                recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

            if (recipe == null)
                continue;

            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:21,代码来源:ShapelessRecipeHandler.java

示例13: loadCraftingRecipes

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
        for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes) {
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            } else if (irecipe instanceof ShapedOreRecipe) {
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
            }

            if (recipe == null) {
                continue;
            }

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:23,代码来源:ShapedRecipeHandler.java

示例14: loadUsageRecipes

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        CachedShapelessRecipe recipe = null;
        if (irecipe instanceof ShapelessRecipes)
            recipe = shapelessRecipe((ShapelessRecipes) irecipe);
        else if (irecipe instanceof ShapelessOreRecipe)
            recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

        if (recipe == null)
            continue;

        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:20,代码来源:ShapelessRecipeHandler.java

示例15: loadCraftingRecipes

import net.minecraft.item.crafting.CraftingManager; //导入依赖的package包/类
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
        for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes)
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            else if (irecipe instanceof ShapedOreRecipe)
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

            if (recipe == null)
                continue;

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:21,代码来源:ShapedRecipeHandler.java


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