From 95ea1663038362efb2bdb61d521ee6e4274a34f7 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sun, 18 Sep 2022 02:20:25 +0800 Subject: Fix #1034 --- .../java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'runtime/src/main/java/me/shedaniel') diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java index 83964e65c..f65e67dcb 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java @@ -425,6 +425,12 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { return advanced.search.asyncSearchPartitionSize; } + @Override + @ApiStatus.Experimental + public boolean isPatchingAsyncThreadCrash() { + return advanced.search.patchAsyncThreadCrash; + } + @Override @ApiStatus.Experimental public boolean doDebugSearchTimeRequired() { @@ -673,6 +679,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { @Comment("Declares whether REI should search async.") private boolean asyncSearch = true; @Comment("Declares how many entries should be grouped one async search.") @ConfigEntry.BoundedDiscrete(min = 25, max = 400) private int asyncSearchPartitionSize = 100; + private boolean patchAsyncThreadCrash = true; @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) private SearchMode tooltipSearch = SearchMode.ALWAYS; @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) -- cgit From 191745eb70de072a486ca799da177490616622d0 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 21 Oct 2022 16:28:34 +0800 Subject: Fix #1081 --- .../gui/screen/AbstractDisplayViewingScreen.java | 19 ++++++++++++++++++- .../gui/screen/CompositeDisplayViewingScreen.java | 10 +--------- .../gui/screen/DefaultDisplayViewingScreen.java | 10 +--------- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'runtime/src/main/java/me/shedaniel') diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java index b7a6493db..4c18502d2 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java @@ -31,6 +31,7 @@ import com.mojang.math.Matrix4f; import dev.architectury.fluid.FluidStack; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.REIRuntime; +import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.gui.screen.DisplayScreen; import me.shedaniel.rei.api.client.gui.widgets.Slot; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; @@ -48,10 +49,12 @@ import me.shedaniel.rei.api.common.entry.type.EntryType; import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.impl.client.ClientHelperImpl; +import me.shedaniel.rei.impl.client.REIRuntimeImpl; import me.shedaniel.rei.impl.client.gui.widget.EntryWidget; import me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListWidget; import me.shedaniel.rei.impl.display.DisplaySpec; import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.chat.NarratorChatListener; import net.minecraft.client.gui.components.events.GuiEventListener; @@ -372,7 +375,21 @@ public abstract class AbstractDisplayViewingScreen extends Screen implements Dis @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - return super.keyPressed(keyCode, scanCode, modifiers) || (getOverlay().keyPressed(keyCode, scanCode, modifiers) && handleFocuses()); + if (super.keyPressed(keyCode, scanCode, modifiers) || (getOverlay().keyPressed(keyCode, scanCode, modifiers) && handleFocuses())) + return true; + if (ConfigObject.getInstance().getPreviousScreenKeybind().matchesKey(keyCode, scanCode)) { + if (REIRuntimeImpl.getInstance().hasLastDisplayScreen()) { + minecraft.setScreen(REIRuntimeImpl.getInstance().getLastDisplayScreen()); + } else { + minecraft.setScreen(REIRuntime.getInstance().getPreviousScreen()); + } + return true; + } + if (this.minecraft.options.keyInventory.matches(keyCode, scanCode)) { + Minecraft.getInstance().setScreen(REIRuntime.getInstance().getPreviousScreen()); + return true; + } + return false; } @Override diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java index d035b5430..205cc9a23 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java @@ -451,18 +451,10 @@ public class CompositeDisplayViewingScreen extends AbstractDisplayViewingScreen for (GuiEventListener element : children()) if (element.keyPressed(keyCode, scanCode, modifiers)) return true; - if (keyCode == 256 || this.minecraft.options.keyInventory.matches(keyCode, scanCode)) { + if (keyCode == 256) { Minecraft.getInstance().setScreen(REIRuntime.getInstance().getPreviousScreen()); return true; } - if (ConfigObject.getInstance().getPreviousScreenKeybind().matchesKey(keyCode, scanCode)) { - if (REIRuntimeImpl.getInstance().hasLastDisplayScreen()) { - minecraft.setScreen(REIRuntimeImpl.getInstance().getLastDisplayScreen()); - } else { - minecraft.setScreen(REIRuntime.getInstance().getPreviousScreen()); - } - return true; - } return super.keyPressed(keyCode, scanCode, modifiers); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java index c84292c04..969716706 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java @@ -125,18 +125,10 @@ public class DefaultDisplayViewingScreen extends AbstractDisplayViewingScreen { for (GuiEventListener element : children()) if (element.keyPressed(keyCode, scanCode, modifiers)) return true; - if (keyCode == 256 || this.minecraft.options.keyInventory.matches(keyCode, scanCode)) { + if (keyCode == 256) { Minecraft.getInstance().setScreen(REIRuntime.getInstance().getPreviousScreen()); return true; } - if (ConfigObject.getInstance().getPreviousScreenKeybind().matchesKey(keyCode, scanCode)) { - if (REIRuntimeImpl.getInstance().hasLastDisplayScreen()) { - minecraft.setScreen(REIRuntimeImpl.getInstance().getLastDisplayScreen()); - } else { - minecraft.setScreen(REIRuntime.getInstance().getPreviousScreen()); - } - return true; - } return super.keyPressed(keyCode, scanCode, modifiers); } -- cgit From 486c6c981799bf515484891ecf1b7e7188da31e6 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 21 Oct 2022 16:43:38 +0800 Subject: Fix #1163 --- .../rei/impl/client/gui/widget/entrylist/EntryListStackEntry.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/src/main/java/me/shedaniel') diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListStackEntry.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListStackEntry.java index 31b03aca1..f0b0424d1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListStackEntry.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListStackEntry.java @@ -39,6 +39,8 @@ import me.shedaniel.rei.impl.client.gui.widget.CachedEntryListRender; import me.shedaniel.rei.impl.client.gui.widget.DisplayedEntryWidget; import me.shedaniel.rei.impl.common.entry.type.collapsed.CollapsedStack; import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.util.Mth; import net.minecraft.world.inventory.tooltip.TooltipComponent; @@ -148,7 +150,7 @@ public class EntryListStackEntry extends DisplayedEntryWidget { @Override protected boolean doAction(double mouseX, double mouseY, int button) { - if (collapsedStack != null) { + if (collapsedStack != null && button == 0 && Screen.hasAltDown()) { parent.updatedCount++; collapsedStack.setExpanded(!collapsedStack.isExpanded()); parent.updateEntriesPosition(); @@ -182,7 +184,7 @@ public class EntryListStackEntry extends DisplayedEntryWidget { if (!this.collapsedStack.isExpanded()) { Tooltip tooltip = Tooltip.create(point, new TranslatableComponent("text.rei.collapsed.entry", collapsedStack.getName())); tooltip.add((TooltipComponent) new CollapsedEntriesTooltip(collapsedStack)); - tooltip.add(new TranslatableComponent("text.rei.collapsed.entry.hint.expand", collapsedStack.getName(), collapsedStack.getIngredient().size()) + tooltip.add(new TranslatableComponent(Minecraft.ON_OSX ? "text.rei.collapsed.entry.hint.expand.macos" : "text.rei.collapsed.entry.hint.expand", collapsedStack.getName(), collapsedStack.getIngredient().size()) .withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC)); ClientHelper.getInstance().appendModIdToTooltips(tooltip, collapsedStack.getModId()); return tooltip; @@ -191,7 +193,7 @@ public class EntryListStackEntry extends DisplayedEntryWidget { Tooltip tooltip = super.getCurrentTooltip(point); if (tooltip != null && this.collapsedStack != null) { - tooltip.entries().add(Mth.clamp(tooltip.entries().size() - 1, 0, tooltip.entries().size() - 1), Tooltip.entry(new TranslatableComponent("text.rei.collapsed.entry.hint.collapse", collapsedStack.getName(), collapsedStack.getIngredient().size()) + tooltip.entries().add(Mth.clamp(tooltip.entries().size() - 1, 0, tooltip.entries().size() - 1), Tooltip.entry(new TranslatableComponent(Minecraft.ON_OSX ? "text.rei.collapsed.entry.hint.collapse.macos" : "text.rei.collapsed.entry.hint.collapse", collapsedStack.getName(), collapsedStack.getIngredient().size()) .withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC))); } return tooltip; -- cgit From a93dd5e110f30d8af7149d023e4168c027255229 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 21 Oct 2022 16:48:17 +0800 Subject: Set useCompactTabButtons as false as default --- .../main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/src/main/java/me/shedaniel') diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java index f65e67dcb..33c6e0490 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java @@ -671,7 +671,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { @Comment("Declares how the scrollbar in composite screen should act.") private boolean compositeScrollBarPermanent = false; private boolean toastDisplayedOnCopyIdentifier = true; @Comment("Declares whether REI should use compact tabs for categories.") private boolean useCompactTabs = true; - @Comment("Declares whether REI should use compact tab buttons for categories.") private boolean useCompactTabButtons = true; + @Comment("Declares whether REI should use compact tab buttons for categories.") private boolean useCompactTabButtons = false; } public static class Search { -- cgit From 068a78b6cfd88fec8af0d9a4edb81ad026ffabb2 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 21 Oct 2022 23:32:36 +0800 Subject: Fix shedaniel/REIPluginCompatibilities-Issues#15 --- .../me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'runtime/src/main/java/me/shedaniel') diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java index cba9a4bb1..67296e755 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java @@ -23,6 +23,7 @@ package me.shedaniel.rei.impl.client.gui.widget; +import com.google.common.base.Suppliers; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; import me.shedaniel.math.Point; @@ -54,6 +55,7 @@ import org.jetbrains.annotations.ApiStatus; import java.util.Collection; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.function.Supplier; @ApiStatus.Internal @@ -68,9 +70,14 @@ public final class InternalWidgets { AutoCraftingEvaluator.evaluateAutoCrafting(true, Screen.hasShiftDown(), displaySupplier.get(), idsSupplier); }); return new DelegateWidget(autoCraftingButton) { + final Supplier result = Suppliers.memoizeWithExpiration( + () -> AutoCraftingEvaluator.evaluateAutoCrafting(false, false, displaySupplier.get(), idsSupplier), + 1000, TimeUnit.MILLISECONDS + ); + @Override public void render(PoseStack poses, int mouseX, int mouseY, float delta) { - AutoCraftingEvaluator.AutoCraftingResult result = AutoCraftingEvaluator.evaluateAutoCrafting(false, false, displaySupplier.get(), idsSupplier); + AutoCraftingEvaluator.AutoCraftingResult result = this.result.get(); autoCraftingButton.setEnabled(result.successful); autoCraftingButton.setTint(result.tint); -- cgit From d8c250d378a2cbaede41093a80973e47f34aec00 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 21 Oct 2022 23:41:57 +0800 Subject: Fix #1088 --- .../shedaniel/rei/impl/client/entry/filtering/FilteringContextImpl.java | 2 +- .../rei/impl/client/entry/filtering/rules/ManualFilteringRule.java | 2 +- .../java/me/shedaniel/rei/impl/client/search/AsyncSearchManager.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/src/main/java/me/shedaniel') diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringContextImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringContextImpl.java index 7c8675a9d..e46f8660b 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringContextImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringContextImpl.java @@ -104,7 +104,7 @@ public class FilteringContextImpl implements FilteringContext { this.stacks.get(FilteringContextType.HIDDEN).removeAll(shownStacks); })); try { - CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0])).get(20, TimeUnit.SECONDS); + CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0])).get(5, TimeUnit.MINUTES); } catch (InterruptedException | ExecutionException | TimeoutException e) { e.printStackTrace(); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/ManualFilteringRule.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/ManualFilteringRule.java index d960a9834..c65d18cb8 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/ManualFilteringRule.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/ManualFilteringRule.java @@ -75,7 +75,7 @@ public class ManualFilteringRule extends AbstractFilteringRule>> { })); } try { - CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get(10, TimeUnit.SECONDS); + CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get(30, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { e.printStackTrace(); } -- cgit