use of com.minecolonies.api.compatibility.ICompatibilityManager in project minecolonies by Minecolonies.
the class CraftingTagAuditor method getAllItems.
private static List<ItemStack> getAllItems() {
final ICompatibilityManager compatibility = IColonyManager.getInstance().getCompatibilityManager();
final List<ItemStack> items = new ArrayList<>(compatibility.getListOfAllItems());
items.sort(Comparator.comparing(stack -> stack.getItem().getRegistryName().toString()));
return items;
}
use of com.minecolonies.api.compatibility.ICompatibilityManager in project minecolonies by Minecolonies.
the class BrewingCraftingType method findRecipes.
@Override
@NotNull
public List<IGenericRecipe> findRecipes(@NotNull RecipeManager recipeManager, @Nullable World world) {
final List<IGenericRecipe> recipes = new ArrayList<>();
final ICompatibilityManager compatibilityManager = MinecoloniesAPIProxy.getInstance().getColonyManager().getCompatibilityManager();
for (final IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) {
final List<ItemStack> inputs = compatibilityManager.getListOfAllItems().stream().filter(recipe::isInput).collect(Collectors.toList());
final List<ItemStack> ingredients = compatibilityManager.getListOfAllItems().stream().filter(recipe::isIngredient).collect(Collectors.toList());
for (final ItemStack input : inputs) {
for (final ItemStack ingredient : ingredients) {
final ItemStack output = recipe.getOutput(input, ingredient);
if (!output.isEmpty()) {
final ItemStack actualInput = input.copy();
actualInput.setCount(3);
final ItemStack actualOutput = output.copy();
actualOutput.setCount(3);
recipes.add(new GenericRecipe(null, actualOutput, Collections.emptyList(), Arrays.asList(Collections.singletonList(ingredient), Collections.singletonList(actualInput)), 1, Blocks.BREWING_STAND, null, Collections.emptyList(), -1));
}
}
}
}
return recipes;
}
Aggregations