Java 类net.minecraft.item.crafting.ShapelessRecipes 实例源码

项目:Minecoprocessors    文件:ItemBookCode.java   
@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));
}
项目:customstuff4    文件:ShapelessRecipe.java   
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;
}
项目:CustomWorldGen    文件:ShapelessOreRecipe.java   
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);
    }
}
项目:CustomWorldGen    文件:RecipeSorter.java   
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");
}
项目:ExtraUtilities    文件:ExtraUtils.java   
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");
    }
}
项目:4Space-5    文件:ShapelessRecipeHandler.java   
@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);
    }
}
项目:4Space-5    文件:ShapelessRecipeHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            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);
        }
    }
}
项目:4Space-5    文件:ShapelessRecipeHandler.java   
@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);
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:ShapelessOreRecipe.java   
@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);
    }
}
项目:BIGB    文件:ShapelessRecipeHandler.java   
@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);
    }
}
项目:BIGB    文件:ShapelessRecipeHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            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);
        }
    }
}
项目:BIGB    文件:ShapelessRecipeHandler.java   
@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);
        }
    }
}
项目:UncraftingTable    文件:RecipeHandlers.java   
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());
}
项目:TeambattleMod    文件:ClientRegistryUtil.java   
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);
}
项目:Factorization    文件:StandardObjectWriters.java   
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()));
}
项目:NotEnoughItems    文件:ShapelessRecipeHandler.java   
@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);
    }
}
项目:NotEnoughItems    文件:ShapelessRecipeHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            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);
        }
    }
}
项目:NotEnoughItems    文件:ShapelessRecipeHandler.java   
@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);
        }
    }
}
项目:DMTweaks    文件:RecipeRemover.java   
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--);
            }
        }
    }
}
项目:TFC2    文件:RecipeSorterTFC.java   
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;
}
项目:TFC2    文件:ShapelessOreRecipeTFC.java   
ShapelessOreRecipeTFC(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);
    }
}
项目:CauldronGit    文件:ShapelessOreRecipe.java   
@SuppressWarnings("unchecked")
ShapelessOreRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.getRecipeOutput();

    for(ItemStack ingred : ((List<ItemStack>)recipe.recipeItems))
    {
        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);
    }
}
项目:AetherCraft2    文件:ShapelessCraftingHandler.java   
@Override
public List<RecipeLink> getRecipes() {
    List<RecipeLink> a = new ArrayList<RecipeLink>();

    for (Object obj : RecipeRegistry.vanillaCrafting.get(ShapelessRecipes.class)) {
        ShapelessRecipes recipe = (ShapelessRecipes) obj;
        RecipeLink link = new RecipeLink();

        for (Object stack : recipe.recipeItems) {
            if (stack!=null) {
                link.inputs.add(new ItemDataStack(RecipeRegistry.flatten(stack)));
            }
        }

        link.outputs.add(new ItemDataStack(recipe.getRecipeOutput()));

        a.add(link);
    }

    return a;
}
项目:Cyclic    文件:RecipeRegistry.java   
/**
 * wrapper for Forge addShapeless recipe, except the difference is this returns it after registering it
 * 
 * so
 * 
 * @param output
 * @param recipeComponents
 * @return
 */
public static IRecipe addShapelessRecipe(ItemStack output, Object... recipeComponents) {
  List<ItemStack> list = Lists.<ItemStack> newArrayList();
  for (Object object : recipeComponents) {
    if (object instanceof String) {
      return addShapelessOreRecipe(output, recipeComponents);
    }
    if (object instanceof ItemStack) {
      list.add(((ItemStack) object).copy());
    }
    else if (object instanceof Item) {
      list.add(new ItemStack((Item) object));
    }
    else {
      if (!(object instanceof Block)) {
        throw new IllegalArgumentException("Invalid shapeless recipe: unknown type " + object.getClass().getName() + "!");
      }
      list.add(new ItemStack((Block) object));
    }
  }
  ResourceLocation location = Util1pt12.buildName(output);
  ShapelessRecipes recipe = new ShapelessRecipes(location.getResourceDomain(), output, Util1pt12.convertToNonNullList(recipeComponents));
  add(recipe, location);
  return recipe;
}
项目:AMTweaker    文件:LargeFurnace.java   
private static IRecipe findRecipe(ItemStack stack, int type) {
    final IRecipe[] recipe = {null};
    FurnaceCraftingManager.getInstance().getRecipeList().stream()
    .filter(xRecipe -> {
        if (type == TYPE_SHAPELESS) {
            return xRecipe instanceof ShapelessOreRecipe || xRecipe instanceof ShapelessRecipes;
        } else if (type == TYPE_SHAPED) {
            return xRecipe instanceof ShapedOreRecipe;
        }
        return xRecipe instanceof IRecipe;
    })        
    .forEachOrdered(xRecipe -> {
        if (areEqual(stack, ((IRecipe) xRecipe).getRecipeOutput())) {
            recipe[0] = (IRecipe) xRecipe;
        }
    });
    return recipe[0];
}
项目:AMTweaker    文件:LargeFurnace.java   
public FurnaceRemove(ItemStack output, int type) {
    this.output = output;
    FurnaceCraftingManager.getInstance().getRecipeList().stream().filter(xRecipe -> xRecipe instanceof IRecipe)
    .filter(xRecipe -> {
        if (type == TYPE_SHAPELESS) {
            return xRecipe instanceof ShapelessOreRecipe || xRecipe instanceof ShapelessRecipes;
        } else if (type == TYPE_SHAPED) {
            return xRecipe instanceof ShapedOreRecipe;
        }
        return xRecipe instanceof IRecipe;
    })
    .forEachOrdered(xRecipe -> {
        if (areEqual(output, ((IRecipe) xRecipe).getRecipeOutput())) {
            recipes.add((IRecipe) xRecipe);
        }
    });

}
项目:TFCWaterCompatibility    文件:RecipeSorterTFC.java   
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;
}
项目:NeptuneCommon    文件:NeptuneRecipe.java   
public static NeptuneRecipe of(IRecipe recipe) {
    if (recipe instanceof ShapedRecipes) {
        return new NeptuneShapedRecipe((ShapedRecipes) recipe);
    } else if(recipe instanceof ShapelessRecipes) {
        return new NeptuneShapelessRecipe((ShapelessRecipes) recipe);
    }
    return new NeptuneRecipe(recipe) {
        @Override
        public boolean isShapeless() {
            return false;
        }

        @Override
        public boolean isShaped() {
            return false;
        }
    };
}
项目:SpaceCore    文件:RecipeSimplifier.java   
private static void handleShapeless( List< DisplayStack > items, ShapelessRecipes recipe, int craftLeft, int craftTop )
{
    for ( int i = 0; i < recipe.recipeItems.size(); ++i )
    {
        int ix = i % 3;
        int iy = i / 3;

        ItemStack stack = ( ItemStack ) recipe.recipeItems.get( i );
        if ( stack == null )
        {
            continue;
        }

        ItemStack[] displayItems = getAliases( stack );

        int x = craftLeft + 1 + ix * 18;
        int y = craftTop + 1 + iy * 18;

        items.add( new DisplayStack( x, y, stack ) );
    }

    items.add( new DisplayStack( craftLeft + 18 - 4 + 5, craftTop + 90 + 5, recipe.getRecipeOutput() ) );
}
项目:Framez    文件:ShapelessBloodOrbRecipe.java   
@SuppressWarnings("unchecked")
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.getRecipeOutput();

    for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems))
    {
        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);
    }
}
项目:SecureCraftProtect    文件:DocumentManager.java   
void addShapelessRecipe(ItemStack itemstack, Object objects[]) {
    ArrayList<ItemStack> list = new ArrayList<ItemStack>();

    for (Object obj : objects) {
        if (obj instanceof ItemStack) {
            list.add(((ItemStack) obj).copy());
            continue;
        }

        if (obj instanceof Item) {
            list.add(new ItemStack((Item) obj));
            continue;
        }

        if (obj instanceof Block) {
            list.add(new ItemStack((Block) obj));
        } else {
            throw new RuntimeException("Invalid shapeless recipe!");
        }
    }

    recipes.add(new ShapelessRecipes(itemstack, list));
}
项目:CrayCrafting    文件:ShapelessRecipesType.java   
@Override
public NBTTagCompound getNBTFromRecipe(ShapelessRecipes recipe, ItemStack newOutput) throws IllegalAccessException
{
    NBTTagCompound nbtRecipe = new NBTTagCompound();
    NBTTagList NBTInput = new NBTTagList();
    for (Object is : recipe.recipeItems)
    {
        if (is == null) NBTInput.appendTag(new NBTTagCompound());
        else NBTInput.appendTag(((ItemStack) is).writeToNBT(new NBTTagCompound()));
    }
    nbtRecipe.setTag(NBT_input, NBTInput);
    nbtRecipe.setTag(NBT_newOutput, newOutput.writeToNBT(new NBTTagCompound()));
    nbtRecipe.setTag(NBT_oldOutput, recipe.getRecipeOutput().writeToNBT(new NBTTagCompound()));

    return nbtRecipe;
}
项目:CraftingManager    文件:WorkbenchHelper.java   
public static String getRecipeCategoryString(Object object)
{
    if(object instanceof BetterShapedRecipe)
    {
        return "shapedore";
    }
    else if(object instanceof ShapedRecipes)
    {
        return "shaped";
    }
    else if(object instanceof BetterShapelessRecipe)
    {
        return "shapelessore";
    }   
    else if(object instanceof ShapelessRecipes)
    {
        return "shapeless";
    }   
    else if(object instanceof IRecipe)
    {
        return "irecipe";
    }
    return "other";
}
项目:MiscUtils    文件:CraftingTableType.java   
@Override
public int GetRecipesAmountFor(ItemStack stack) {
    int i = 0;

    for(Object r : CraftingManager.getInstance().getRecipeList()){
        if(r instanceof IRecipe) {
            IRecipe res = (IRecipe) r;

            if(res instanceof ShapelessOreRecipe || res instanceof ShapedOreRecipe || res instanceof ShapedRecipes || res instanceof ShapelessRecipes)
            if(StackUtils.AreStacksEqualIgnoreData(res.getRecipeOutput(), stack)){
                i += 1;
            }

        }
    }


    return i;
}
项目:TFC2    文件:RecipeSorterTFC.java   
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;
}
项目:TFC2    文件:ShapelessOreRecipeTFC.java   
ShapelessOreRecipeTFC(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);
    }
}
项目:MoarSigns    文件:ShapelessMoarSignRecipe.java   
public ShapelessMoarSignRecipe(IRecipe recipe, Map<ItemStack, Object> replacements) {
    output = recipe.getRecipeOutput();

    for (Object ingred : (recipe instanceof ShapelessRecipes ? ((ShapelessRecipes) recipe).recipeItems : ((ShapelessOreRecipe) recipe).getInput())) {
        Object finalObj = ingred;
        for (Entry<ItemStack, Object> replace : replacements.entrySet()) {
            if (ingred instanceof ItemStack && OreDictionary.itemMatches(replace.getKey(), (ItemStack) ingred, false)) {
                if (replace.getValue() instanceof String) {
                    finalObj = OreDictionary.getOres(String.valueOf(replace.getValue()));
                } else if (replace.getValue() instanceof MatchType || replace.getValue() instanceof MaterialInfo) {
                    finalObj = replace.getValue();
                }
                break;
            }
        }
        input.add(finalObj);
    }
}
项目:Cauldron    文件:ShapelessOreRecipe.java   
@SuppressWarnings("unchecked")
ShapelessOreRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.getRecipeOutput();

    for(ItemStack ingred : ((List<ItemStack>)recipe.recipeItems))
    {
        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);
    }
}
项目:Cauldron    文件:ShapelessOreRecipe.java   
@SuppressWarnings("unchecked")
ShapelessOreRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
    vanillaRecipe = recipe; // Cauldron - bukkit compatibility
    output = recipe.getRecipeOutput();

    for(ItemStack ingred : ((List<ItemStack>)recipe.recipeItems))
    {
        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);
    }
}
项目:Cauldron    文件:ShapelessOreRecipe.java   
@SuppressWarnings("unchecked")
ShapelessOreRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.getRecipeOutput();

    for(ItemStack ingred : ((List<ItemStack>)recipe.recipeItems))
    {
        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);
    }
}