aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java6
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index 27386eeda..24991284b 100644
--- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -39,6 +39,9 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
public class RoughlyEnoughItemsCore implements ClientModInitializer {
@@ -48,6 +51,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
private static final ItemRegistry ITEM_REGISTRY = new ItemRegistryImpl();
private static final DisplayHelper DISPLAY_HELPER = new DisplayHelperImpl();
private static final Map<Identifier, REIPluginEntry> plugins = Maps.newHashMap();
+ private static final ExecutorService SYNC_RECIPES = Executors.newSingleThreadScheduledExecutor(r -> new Thread(r, "REI-SyncRecipes"));
private static ConfigManagerImpl configManager;
static {
@@ -156,7 +160,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
private void registerClothEvents() {
ClothClientHooks.SYNC_RECIPES.register((minecraftClient, recipeManager, synchronizeRecipesS2CPacket) -> {
if (RoughlyEnoughItemsCore.getConfigManager().getConfig().registerRecipesInAnotherThread)
- CompletableFuture.runAsync(() -> ((RecipeHelperImpl) RoughlyEnoughItemsCore.getRecipeHelper()).recipesLoaded(recipeManager));
+ CompletableFuture.runAsync(() -> ((RecipeHelperImpl) RoughlyEnoughItemsCore.getRecipeHelper()).recipesLoaded(recipeManager), SYNC_RECIPES);
else
((RecipeHelperImpl) RoughlyEnoughItemsCore.getRecipeHelper()).recipesLoaded(recipeManager);
});
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
index 6f3649952..cda1acb3e 100644
--- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
@@ -279,8 +279,8 @@ public class RecipeViewingScreen extends Screen {
int displayWidth = selectedCategory.getDisplayWidth(displaySupplier.get());
final Rectangle displayBounds = new Rectangle((int) getBounds().getCenterX() - displayWidth / 2, getBounds().y + 40 + recipeHeight * i + 7 * i, displayWidth, recipeHeight);
widgets.addAll(selectedCategory.setupDisplay(displaySupplier, displayBounds));
- if (supplier.isPresent())
- widgets.add(new AutoCraftingButtonWidget(supplier.get().get(displayBounds), supplier.get().getButtonText(), displaySupplier));
+ if (supplier.isPresent() && supplier.get().get(displayBounds) != null)
+ widgets.add(new SpeedCraftingButtonWidget(supplier.get().get(displayBounds), supplier.get().getButtonText(), functional, displaySupplier));
}
if (choosePageActivated)
recipeChoosePageWidget = new RecipeChoosePageWidget(this, page, getTotalPages(selectedCategory));