當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。