Search in sources :

Example 1 with Category

use of net.minecraftforge.oredict.RecipeSorter.Category in project MinecraftForge by MinecraftForge.

the class RecipeSorter method compare.

@Override
public int compare(IRecipe r1, IRecipe r2) {
    Category c1 = getCategory(r1);
    Category c2 = getCategory(r2);
    int categoryComparison = -c1.compareTo(c2);
    if (categoryComparison != 0) {
        return categoryComparison;
    } else {
        if (r2.getRecipeSize() < r1.getRecipeSize())
            return -1;
        if (r2.getRecipeSize() > r1.getRecipeSize())
            return 1;
        // high priority value first!
        return getPriority(r2) - getPriority(r1);
    }
}
Also used : Category(net.minecraftforge.oredict.RecipeSorter.Category)

Example 2 with Category

use of net.minecraftforge.oredict.RecipeSorter.Category in project MinecraftForge by MinecraftForge.

the class RecipeSorter method getCategory.

public static Category getCategory(Class<?> recipe) {
    Class<?> cls = recipe;
    Category ret = categories.get(cls);
    if (ret == null) {
        while (cls != Object.class) {
            cls = cls.getSuperclass();
            ret = categories.get(cls);
            if (ret != null) {
                categories.put(recipe, ret);
                return ret;
            }
        }
    }
    return ret == null ? UNKNOWN : ret;
}
Also used : Category(net.minecraftforge.oredict.RecipeSorter.Category)

Aggregations

Category (net.minecraftforge.oredict.RecipeSorter.Category)2