mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-13 00:47:35 +00:00
Reuse the ForkJoinPool in ItemList
This commit is contained in:
1 parent
458947628c
commit
4c37971a2b
3 files changed
+4
-12
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import codechicken.core.TaskProfiler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -26,7 +27,7 @@ public class GuiCraftingRecipe extends GuiRecipe
|
||||
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
try {
|
||||
profiler.start("recipe.concurrent.crafting");
|
||||
handlers = forkJoinPool.submit(() -> getCraftingHandlers(outputId, results)).get();
|
||||
handlers = ItemList.forkJoinPool.submit(() -> getCraftingHandlers(outputId, results)).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
|
||||
@@ -29,16 +29,6 @@ import java.util.concurrent.ForkJoinPool;
|
||||
|
||||
public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOverlay, IGuiClientSide, IGuiHandleMouseWheel, IContainerTooltipHandler
|
||||
{
|
||||
protected static final ForkJoinPool forkJoinPool;
|
||||
|
||||
static {
|
||||
int poolSize = Runtime.getRuntime().availableProcessors() * 2 / 3;
|
||||
if (poolSize < 1)
|
||||
poolSize = 1;
|
||||
|
||||
forkJoinPool = new ForkJoinPool(poolSize);
|
||||
}
|
||||
|
||||
public ArrayList<? extends IRecipeHandler> currenthandlers = new ArrayList<>();
|
||||
|
||||
public int page;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import codechicken.core.TaskProfiler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -26,7 +27,7 @@ public class GuiUsageRecipe extends GuiRecipe
|
||||
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
try {
|
||||
profiler.start("recipe.concurrent.usage");
|
||||
handlers = forkJoinPool.submit(() -> getUsageHandlers(inputId, ingredients)).get();
|
||||
handlers = ItemList.forkJoinPool.submit(() -> getUsageHandlers(inputId, ingredients)).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user