use of com.minecolonies.coremod.colony.buildings.modules.SimpleCraftingModule in project minecolonies by Minecolonies.
the class CraftingTagAuditor method doRecipeAudit.
private static void doRecipeAudit(@NotNull final BufferedWriter writer, @NotNull final MinecraftServer server, @NotNull final CustomRecipeManager customRecipeManager) throws IOException {
final Map<CraftingType, List<IGenericRecipe>> vanillaRecipesMap = RecipeAnalyzer.buildVanillaRecipesMap(server.getRecipeManager(), server.overworld());
final List<ICraftingBuildingModule> crafters = getCraftingModules().stream().sorted(Comparator.comparing(m -> m instanceof SimpleCraftingModule).reversed()).collect(// sort the simple modules first (2x2 crafting, personal only)
Collectors.toList());
final Map<ItemStorage, Map<ICraftingBuildingModule, List<IGenericRecipe>>> craftingMap = new HashMap<>();
// initially map every vanilla craftable
for (final List<IGenericRecipe> recipeList : vanillaRecipesMap.values()) {
for (final IGenericRecipe recipe : recipeList) {
add(customRecipeManager, craftingMap, null, recipe);
}
}
writeItemHeaders(writer);
writer.write(",player");
for (final ICraftingBuildingModule crafter : crafters) {
writer.write(',');
writer.write(crafter.getCustomRecipeKey());
final List<IGenericRecipe> recipes = RecipeAnalyzer.findRecipes(vanillaRecipesMap, crafter);
for (final IGenericRecipe recipe : recipes) {
add(customRecipeManager, craftingMap, crafter, recipe);
}
}
writer.newLine();
for (final ItemStack item : getAllItems()) {
writeItemData(writer, item);
final Map<ICraftingBuildingModule, List<IGenericRecipe>> crafterMap = craftingMap.getOrDefault(new ItemStorage(item, true, false), Collections.emptyMap());
writeCrafterValue(writer, crafterMap, null);
for (final ICraftingBuildingModule crafter : crafters) {
writeCrafterValue(writer, crafterMap, crafter);
}
writer.newLine();
}
}
Aggregations