当前位置: 首页>>代码示例>>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;未经允许,请勿转载。