Update buildscript & apply automatic formatting rules

This commit is contained in:
Raven Szewczyk authored and Jason Mitchell committed 2022-06-27 10:23:18 -07:00
1 parent a7683b885d
commit f7a900e910
173 files changed
+4581 -5321

No files matched your search

@@ -4,6 +4,9 @@ import codechicken.core.TaskProfiler;
import codechicken.nei.ItemList;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
@@ -11,12 +14,7 @@ import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
public class GuiUsageRecipe extends GuiRecipe
{
public class GuiUsageRecipe extends GuiRecipe {
public static boolean openRecipeGui(String inputId, Object... ingredients) {
Minecraft mc = NEIClientUtils.mc();
GuiContainer prevscreen = mc.currentScreen instanceof GuiContainer ? (GuiContainer) mc.currentScreen : null;
@@ -29,14 +27,17 @@ public class GuiUsageRecipe extends GuiRecipe
profiler.start("recipe.concurrent.usage");
try {
handlers = serialUsageHandlers.stream().map(h -> getUsageOrCatalystHandler(h, inputId, ingredients))
.filter(h -> h.numRecipes() > 0)
.collect(Collectors.toCollection(ArrayList::new));
handlers = serialUsageHandlers.stream()
.map(h -> getUsageOrCatalystHandler(h, inputId, ingredients))
.filter(h -> h.numRecipes() > 0)
.collect(Collectors.toCollection(ArrayList::new));
handlers.addAll(ItemList.forkJoinPool.submit(() -> usagehandlers.parallelStream()
.map(h -> getUsageOrCatalystHandler(h, inputId, ingredients))
.filter(h -> h.numRecipes() > 0)
.collect(Collectors.toCollection(ArrayList::new))).get());
handlers.addAll(ItemList.forkJoinPool
.submit(() -> usagehandlers.parallelStream()
.map(h -> getUsageOrCatalystHandler(h, inputId, ingredients))
.filter(h -> h.numRecipes() > 0)
.collect(Collectors.toCollection(ArrayList::new)))
.get());
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
@@ -50,8 +51,7 @@ public class GuiUsageRecipe extends GuiRecipe
profiler.end();
}
if (handlers.isEmpty())
return false;
if (handlers.isEmpty()) return false;
handlers.sort(NEIClientConfig.HANDLER_COMPARATOR);
@@ -61,7 +61,7 @@ public class GuiUsageRecipe extends GuiRecipe
recipeId = (((GuiRecipe) prevscreen).recipeId).copy();
}
GuiUsageRecipe gui = new GuiUsageRecipe(prevscreen, handlers, recipeId);
GuiUsageRecipe gui = new GuiUsageRecipe(prevscreen, handlers, recipeId);
mc.displayGuiScreen(gui);
@@ -72,8 +72,7 @@ public class GuiUsageRecipe extends GuiRecipe
return true;
}
private GuiUsageRecipe(GuiContainer prevgui, ArrayList<IUsageHandler> handlers, BookmarkRecipeId recipeId)
{
private GuiUsageRecipe(GuiContainer prevgui, ArrayList<IUsageHandler> handlers, BookmarkRecipeId recipeId) {
this(prevgui, handlers);
this.recipeId = recipeId;
}
@@ -85,20 +84,19 @@ public class GuiUsageRecipe extends GuiRecipe
public static void registerUsageHandler(IUsageHandler handler) {
final String handlerId = handler.getHandlerId();
if(usagehandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId)) || serialUsageHandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId)))
return;
if (usagehandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId))
|| serialUsageHandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId))) return;
if(NEIClientConfig.serialHandlers.contains(handlerId))
serialUsageHandlers.add(handler);
else
usagehandlers.add(handler);
if (NEIClientConfig.serialHandlers.contains(handlerId)) serialUsageHandlers.add(handler);
else usagehandlers.add(handler);
}
public ArrayList<? extends IRecipeHandler> getCurrentRecipeHandlers() {
return currenthandlers;
}
private static IUsageHandler getUsageOrCatalystHandler(IUsageHandler handler, String inputId, Object... ingredients) {
private static IUsageHandler getUsageOrCatalystHandler(
IUsageHandler handler, String inputId, Object... ingredients) {
boolean skipCatalyst = NEIClientUtils.controlKey();
if (NEIClientConfig.areJEIStyleRecipeCatalystsVisible() && !skipCatalyst) {
return handler.getUsageAndCatalystHandler(inputId, ingredients);