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


Java ShapelessRecipes類代碼示例

本文整理匯總了Java中net.minecraft.item.crafting.ShapelessRecipes的典型用法代碼示例。如果您正苦於以下問題:Java ShapelessRecipes類的具體用法?Java ShapelessRecipes怎麽用?Java ShapelessRecipes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: registerRecipes

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
@SubscribeEvent
public static void registerRecipes(final RegistryEvent.Register<IRecipe> event) {
  NonNullList<Ingredient> lst = NonNullList.create();
  lst.add(Ingredient.fromItem(Items.WRITABLE_BOOK));
  lst.add(Ingredient.fromItem(BlockMinecoprocessor.ITEM_INSTANCE));
  event.getRegistry().register(new ShapelessRecipes("", new ItemStack(ItemBookCode.INSTANCE), lst) {
    @Override
    public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
      NonNullList<ItemStack> l = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);

      for (int i = 0; i < l.size(); ++i) {
        ItemStack stack = inv.getStackInSlot(i);

        if (stack.getItem() == BlockMinecoprocessor.ITEM_INSTANCE) {
          ItemStack returnStack = stack.copy();
          returnStack.setCount(1);
          l.set(i, returnStack);
          return l;
        }
      }

      throw new RuntimeException("Item to return not found in inventory");
    }
  }.setRegistryName(ItemBookCode.REGISTRY_NAME));
}
 
開發者ID:ToroCraft,項目名稱:Minecoprocessors,代碼行數:26,代碼來源:ItemBookCode.java

示例2: matchesInput

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
private boolean matchesInput(ShapelessRecipes recipe)
{
    if (isOreRecipe())
        return false;
    if (recipe.recipeItems.size() != getRecipeSize())
        return false;

    Object[] input = getRecipeInput();

    for (int i = 0; i < recipe.recipeItems.size(); i++)
    {
        Ingredient target = recipe.recipeItems.get(i);
        ItemStack source = (ItemStack) input[i];

        if (!target.apply(source))
            return false;
    }

    return true;
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:21,代碼來源:ShapelessRecipe.java

示例3: ShapelessOreRecipe

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
ShapelessOreRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.getRecipeOutput();

    for(ItemStack ingredient : recipe.recipeItems)
    {
        Object finalObj = ingredient;
        for(Entry<ItemStack, String> replace : replacements.entrySet())
        {
            if(OreDictionary.itemMatches(replace.getKey(), ingredient, false))
            {
                finalObj = OreDictionary.getOres(replace.getValue());
                break;
            }
        }
        input.add(finalObj);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:ShapelessOreRecipe.java

示例4: RecipeSorter

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
private RecipeSorter()
{
    register("minecraft:shaped",       ShapedRecipes.class,       SHAPED,    "before:minecraft:shapeless");
    register("minecraft:mapextending", RecipesMapExtending.class, SHAPED,    "after:minecraft:shaped before:minecraft:shapeless");
    register("minecraft:shapeless",    ShapelessRecipes.class,    SHAPELESS, "after:minecraft:shaped");
    register("minecraft:shield_deco",  ShieldRecipes.Decoration.class, SHAPELESS, "after:minecraft:shapeless"); //Size 2
    register("minecraft:repair",       RecipeRepairItem.class,    SHAPELESS, "after:minecraft:shapeless"); //Size 4
    register("minecraft:bookcloning",  RecipeBookCloning.class,   SHAPELESS, "after:minecraft:shapeless"); //Size 9
    register("minecraft:tippedarrow",  RecipeTippedArrow.class,   SHAPELESS, "after:minecraft:shapeless"); //Size 9
    register("minecraft:fireworks",    RecipeFireworks.class,     SHAPELESS, "after:minecraft:shapeless"); //Size 10
    register("minecraft:armordyes",    RecipesArmorDyes.class,    SHAPELESS, "after:minecraft:shapeless"); //Size 10
    register("minecraft:mapcloning",   RecipesMapCloning.class,   SHAPELESS, "after:minecraft:shapeless"); //Size 10
    register("minecraft:pattern_dupe", RecipeDuplicatePattern.class, SHAPELESS, "after:minecraft:shapeless"); //Size 2
    register("minecraft:pattern_add",  RecipeAddPattern.class,       SHAPELESS, "after:minecraft:shapeless"); //Size 10

    register("forge:shapedore",     ShapedOreRecipe.class,    SHAPED,    "after:minecraft:shaped before:minecraft:shapeless");
    register("forge:shapelessore",  ShapelessOreRecipe.class, SHAPELESS, "after:minecraft:shapeless");
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:RecipeSorter.java

示例5: registerRecipe

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
public static void registerRecipe(final Class<? extends IRecipe> recipe) {
    if (ExtraUtils.registeredRecipes.contains(recipe)) {
        return;
    }
    if (!recipe.getName().startsWith("com.rwtema.")) {
        return;
    }
    ExtraUtils.registeredRecipes.add(recipe);
    LogHelper.fine("Registering " + recipe.getSimpleName() + " to RecipeSorter", new Object[0]);
    if (ShapedOreRecipe.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:forge:shapedore");
    }
    else if (ShapelessOreRecipe.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore");
    }
    else if (ShapedRecipes.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless");
    }
    else if (ShapelessRecipes.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless before:minecraft:bookcloning");
    }
    else {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore");
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:26,代碼來源:ExtraUtils.java

示例6: loadCraftingRecipes

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的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

示例7: loadUsageRecipes

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的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

示例8: ShapelessOreRecipe

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
@SuppressWarnings("unchecked")
ShapelessOreRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.func_77571_b();

    for(ItemStack ingred : ((List<ItemStack>)recipe.field_77579_b))
    {
        Object finalObj = ingred;
        for(Entry<ItemStack, String> replace : replacements.entrySet())
        {
            if(OreDictionary.itemMatches(replace.getKey(), ingred, false))
            {
                finalObj = OreDictionary.getOres(replace.getValue());
                break;
            }
        }
        input.add(finalObj);
    }
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:20,代碼來源:ShapelessOreRecipe.java

示例9: buildHandlerMap

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
private static void buildHandlerMap()
{
	// RecipesMapExtending extends ShapedRecipes, and causes a crash when attempting to uncraft a map
	HANDLERS.put(RecipesMapExtending.class, null);

	// vanilla Minecraft recipe handlers
	HANDLERS.put(ShapedRecipes.class, new ShapedRecipeHandler());
	HANDLERS.put(ShapelessRecipes.class, new ShapelessRecipeHandler());
	HANDLERS.put(RecipeFireworks.class, new FireworksRecipeHandler());
	HANDLERS.put(RecipeTippedArrow.class, new TippedArrowRecipeHandler());

	// Forge Ore Dictionary recipe handlers
	HANDLERS.put(ShapedOreRecipe.class, new ShapedOreRecipeHandler());
	HANDLERS.put(ShapelessOreRecipe.class, new ShapelessOreRecipeHandler());

	// cofh recipe handlers
	if (CoFHRecipeHandlers.CoverRecipeHandler.recipeClass != null) HANDLERS.put(CoFHRecipeHandlers.CoverRecipeHandler.recipeClass, new CoFHRecipeHandlers.CoverRecipeHandler());

	// industrialcraft 2 recipe handlers
	if (ShapedIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapedIC2RecipeHandler.recipeClass, new ShapedIC2RecipeHandler());
	if (ShapelessIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapelessIC2RecipeHandler.recipeClass, new ShapelessIC2RecipeHandler());

	// tinker's construct recipe handlers
	if (TinkersRecipeHandlers.TableRecipeHandler.recipeClass != null) HANDLERS.put(TinkersRecipeHandlers.TableRecipeHandler.recipeClass, new TinkersRecipeHandlers.TableRecipeHandler());
}
 
開發者ID:crazysnailboy,項目名稱:UncraftingTable,代碼行數:26,代碼來源:RecipeHandlers.java

示例10: addTeambattleRecipes

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
public static void addTeambattleRecipes() {
	ArrayList<CommonGuiRecipe> stacks = new ArrayList<CommonGuiRecipe>();
	List<IRecipe> re = CraftingManager.getInstance().getRecipeList();
	for (IRecipe r : re) {
		if (r.getRecipeOutput() != null && r.getRecipeOutput().getItem() != null && r.getRecipeOutput().getItem().getRegistryName().startsWith(TeambattleReference.modid)) {
			if (r instanceof ShapedRecipes) {
				ShapedRecipes rep = (ShapedRecipes) r;
				stacks.add(new CommonGuiRecipe(RecipeUtil.matches(rep), rep.getRecipeOutput()));
			} else if (r instanceof ShapelessRecipes) {
				List<ItemStack> rs = ((ShapelessRecipes) r).recipeItems;
				ItemStack[] ar = new ItemStack[rs.size()];
				for (int i = 0; i < ar.length; i++) {
					ar[i] = rs.get(i);
				}
				stacks.add(new CommonGuiRecipe(ar, r.getRecipeOutput()));
			} else {
				continue;
			}
		}
	}
	guirecipes.addAll(stacks);
}
 
開發者ID:HyCraftHD,項目名稱:TeambattleMod,代碼行數:23,代碼來源:ClientRegistryUtil.java

示例11: setup

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
static void setup() {
    if (is_setup) return;
    is_setup = true;
    reg(ItemStack.class, new WriteItemStack());
    reg(Item.class, new WriteItem());
    reg(Block.class, new WriteBlock());
    reg(String.class, new WriteStringOreDictionary());
    reg(Number.class, new WriteObjectToString());
    reg(NBTBase.class, new WriteObjectToString());
    reg(FluidStack.class, new WriteFluidStack());
    reg(Fluid.class, new WriteFluid());
    reg(Collection.class, new WriteCollection());
    // IRecipe: "embedded IRecipe"; haven't seen it crop up tho
    reg(ShapedOreRecipe.class, new WriteShapedOreRecipe());
    reg(ShapedRecipes.class, new WriteShapedRecipe());
    reg(ShapelessOreRecipe.class, new WriteShapelessOreRecipe());
    reg(ShapelessRecipes.class, new WriteShapelessRecipe());
    reg(Map.Entry.class, new WriteEntry());

    IObjectWriter.adapter.register(new ArrayAdapter());
    IObjectWriter.adapter.setFallbackAdapter(new GenericAdapter<Object, IObjectWriter>(Object.class, new ReflectionWriter()));
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:23,代碼來源:StandardObjectWriters.java

示例12: loadCraftingRecipes

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的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:TheCBProject,項目名稱:NotEnoughItems,代碼行數:23,代碼來源:ShapelessRecipeHandler.java

示例13: loadUsageRecipes

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的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:TheCBProject,項目名稱:NotEnoughItems,代碼行數:22,代碼來源:ShapelessRecipeHandler.java

示例14: removeShapelessRecipe

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
public static void removeShapelessRecipe (ItemStack resultItem)
{
    Preconditions.checkNotNull(resultItem);
    List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
    for (int i = 0; i < recipes.size(); i++)
    {
        IRecipe tmpRecipe = recipes.get(i);
        if (tmpRecipe instanceof ShapelessRecipes)
        {
            ShapelessRecipes recipe = (ShapelessRecipes) tmpRecipe;
            ItemStack recipeResult = recipe.getRecipeOutput();

            if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
            {
                recipes.remove(i--);
            }
        }
    }
}
 
開發者ID:dmaster8,項目名稱:DMTweaks,代碼行數:20,代碼來源:RecipeRemover.java

示例15: compareRecipes

import net.minecraft.item.crafting.ShapelessRecipes; //導入依賴的package包/類
public int compareRecipes(IRecipe irecipe, IRecipe irecipe1)
{
	if (irecipe instanceof ShapelessRecipes && irecipe1 instanceof ShapedRecipes)
	{
		return 1;
	}
	if (irecipe1 instanceof ShapelessRecipes && irecipe instanceof ShapedRecipes)
	{
		return -1;
	}
	if (irecipe1.getRecipeSize() < irecipe.getRecipeSize())
	{
		return -1;
	}
	return irecipe1.getRecipeSize() <= irecipe.getRecipeSize() ? 0 : 1;
}
 
開發者ID:Deadrik,項目名稱:TFC2,代碼行數:17,代碼來源:RecipeSorterTFC.java


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