diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-04-12 23:26:12 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-04-12 23:26:12 +0800 |
| commit | 40064141a61e91a9b92f3b7ad417943839fb94c6 (patch) | |
| tree | 981e6fc2d7f5b7f79f78b7404d2cfa1aedcd495a /runtime/src/main/java/me | |
| parent | 371de0e3c77bd5b57616bb977925d677292f3def (diff) | |
| parent | 40119cc21ce0cf0098f31823e1382167990bc772 (diff) | |
| download | RoughlyEnoughItems-40064141a61e91a9b92f3b7ad417943839fb94c6.tar.gz RoughlyEnoughItems-40064141a61e91a9b92f3b7ad417943839fb94c6.tar.bz2 RoughlyEnoughItems-40064141a61e91a9b92f3b7ad417943839fb94c6.zip | |
Merge branch '8.x-1.18.2' into 9.x-1.19
# Conflicts:
# gradle.properties
Diffstat (limited to 'runtime/src/main/java/me')
20 files changed, 412 insertions, 234 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index 5681e6598..d1be18c87 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -41,6 +41,7 @@ import me.shedaniel.rei.api.common.plugins.REIServerPlugin; import me.shedaniel.rei.api.common.registry.ReloadStage; import me.shedaniel.rei.api.common.transfer.info.MenuInfoRegistry; import me.shedaniel.rei.impl.Internals; +import me.shedaniel.rei.impl.common.InternalLogger; import me.shedaniel.rei.impl.common.category.CategoryIdentifierImpl; import me.shedaniel.rei.impl.common.display.DisplaySerializerRegistryImpl; import me.shedaniel.rei.impl.common.entry.DeferringEntryTypeProviderImpl; @@ -54,8 +55,8 @@ import me.shedaniel.rei.impl.common.entry.type.EntryTypeRegistryImpl; import me.shedaniel.rei.impl.common.fluid.FluidSupportProviderImpl; import me.shedaniel.rei.impl.common.logging.FileLogger; import me.shedaniel.rei.impl.common.logging.Log4JLogger; -import me.shedaniel.rei.impl.common.logging.Logger; import me.shedaniel.rei.impl.common.logging.MultiLogger; +import me.shedaniel.rei.impl.common.logging.TransformingLogger; import me.shedaniel.rei.impl.common.logging.performance.PerformanceLogger; import me.shedaniel.rei.impl.common.logging.performance.PerformanceLoggerImpl; import me.shedaniel.rei.impl.common.plugins.PluginManagerImpl; @@ -74,10 +75,10 @@ import java.util.function.UnaryOperator; @ApiStatus.Internal public class RoughlyEnoughItemsCore { @ApiStatus.Internal - public static final Logger LOGGER = new MultiLogger(ImmutableList.of( + public static final InternalLogger LOGGER = new TransformingLogger(new MultiLogger(ImmutableList.of( new FileLogger(Platform.getGameFolder().resolve("logs/rei.log")), new Log4JLogger(LogManager.getFormatterLogger("REI")) - )); + )), message -> "[REI] " + message); public static final PerformanceLogger PERFORMANCE_LOGGER = new PerformanceLoggerImpl(); static { @@ -124,6 +125,7 @@ public class RoughlyEnoughItemsCore { ); }, new MenuInfoRegistryImpl()), "serverPluginManager"); + Internals.attachInstanceSupplier(LOGGER, "logger"); } public static void _reloadPlugins(@Nullable ReloadStage stage) { diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java index 02fbe7b05..775b29d9e 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java @@ -376,6 +376,9 @@ public class RoughlyEnoughItemsCoreClient { ClientScreenInputEvent.CHAR_TYPED_PRE.register((minecraftClient, screen, character, keyCode) -> { if (shouldReturn(screen)) return EventResult.pass(); + if (screen.getFocused() != null && screen.getFocused() instanceof EditBox || (screen.getFocused() instanceof RecipeBookComponent && ((RecipeBookComponent) screen.getFocused()).searchBox != null && ((RecipeBookComponent) screen.getFocused()).searchBox.isFocused())) + if (!REIRuntimeImpl.getSearchField().isFocused()) + return EventResult.pass(); resetFocused(screen); if (getOverlay().charTyped(character, keyCode) && resetFocused(screen)) @@ -409,7 +412,8 @@ public class RoughlyEnoughItemsCoreClient { } } if (screen.getFocused() != null && screen.getFocused() instanceof EditBox || (screen.getFocused() instanceof RecipeBookComponent && ((RecipeBookComponent) screen.getFocused()).searchBox != null && ((RecipeBookComponent) screen.getFocused()).searchBox.isFocused())) - return EventResult.pass(); + if (!REIRuntimeImpl.getSearchField().isFocused()) + return EventResult.pass(); resetFocused(screen); if (getOverlay().keyPressed(i, i1, i2) && resetFocused(screen)) diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java index 89568931a..f3b18ba39 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java @@ -31,7 +31,6 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; import me.shedaniel.rei.RoughlyEnoughItemsNetwork; import me.shedaniel.rei.api.client.ClientHelper; -import me.shedaniel.rei.api.client.REIRuntime; import me.shedaniel.rei.api.client.config.ConfigManager; import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.gui.config.DisplayScreenType; @@ -40,7 +39,6 @@ import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.client.registry.display.DisplayCategory; import me.shedaniel.rei.api.client.view.ViewSearchBuilder; import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import me.shedaniel.rei.api.common.display.Display; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; import me.shedaniel.rei.api.common.util.EntryStacks; @@ -48,7 +46,6 @@ import me.shedaniel.rei.api.common.util.FormattingUtils; import me.shedaniel.rei.impl.ClientInternals; import me.shedaniel.rei.impl.client.gui.screen.CompositeDisplayViewingScreen; import me.shedaniel.rei.impl.client.gui.screen.DefaultDisplayViewingScreen; -import me.shedaniel.rei.impl.client.gui.screen.UncertainDisplayViewingScreen; import me.shedaniel.rei.impl.client.view.ViewsImpl; import me.shedaniel.rei.impl.display.DisplaySpec; import net.fabricmc.api.EnvType; @@ -70,6 +67,7 @@ import org.jetbrains.annotations.Nullable; import java.time.LocalDateTime; import java.util.*; import java.util.function.Supplier; +import java.util.stream.Stream; @ApiStatus.Internal @Environment(EnvType.CLIENT) @@ -302,14 +300,22 @@ public class ClientHelperImpl implements ClientHelper { } return this; } + + @Override + public Stream<DisplaySpec> streamDisplays() { + return buildMapInternal().values().stream().flatMap(Collection::stream); + } } public static final class ViewSearchBuilderImpl extends AbstractViewSearchBuilder { + private final Set<CategoryIdentifier<?>> filteringCategories = new HashSet<>(); private final Set<CategoryIdentifier<?>> categories = new HashSet<>(); private final List<EntryStack<?>> recipesFor = new ArrayList<>(); private final List<EntryStack<?>> usagesFor = new ArrayList<>(); @Nullable private CategoryIdentifier<?> preferredOpenedCategory = null; + private boolean mergeDisplays = true; + private boolean processVisibilityHandlers = true; private final Supplier<Map<DisplayCategory<?>, List<DisplaySpec>>> map = Suppliers.memoize(() -> ViewsImpl.buildMapFor(this)); @Override @@ -364,10 +370,49 @@ public class ClientHelperImpl implements ClientHelper { } @Override + public ViewSearchBuilder filterCategory(CategoryIdentifier<?> category) { + this.filteringCategories.add(category); + return this; + } + + @Override + public ViewSearchBuilder filterCategories(Collection<CategoryIdentifier<?>> categories) { + this.filteringCategories.addAll(categories); + return this; + } + + @Override + public Set<CategoryIdentifier<?>> getFilteringCategories() { + return filteringCategories; + } + + @Override public Map<DisplayCategory<?>, List<DisplaySpec>> buildMapInternal() { fillPreferredOpenedCategory(); return this.map.get(); } + + @Override + public boolean isMergingDisplays() { + return mergeDisplays; + } + + @Override + public ViewSearchBuilder mergingDisplays(boolean mergingDisplays) { + this.mergeDisplays = mergingDisplays; + return this; + } + + @Override + public boolean isProcessingVisibilityHandlers() { + return processVisibilityHandlers; + } + + @Override + public ViewSearchBuilder processingVisibilityHandlers(boolean processingVisibilityHandlers) { + this.processVisibilityHandlers = processingVisibilityHandlers; + return this; + } } public static final class LegacyWrapperViewSearchBuilder extends AbstractViewSearchBuilder { @@ -399,6 +444,21 @@ public class ClientHelperImpl implements ClientHelper { } @Override + public ViewSearchBuilder filterCategory(CategoryIdentifier<?> category) { + return this; + } + + @Override + public ViewSearchBuilder filterCategories(Collection<CategoryIdentifier<?>> categories) { + return this; + } + + @Override + public Set<CategoryIdentifier<?>> getFilteringCategories() { + return Collections.emptySet(); + } + + @Override public <T> ViewSearchBuilder addRecipesFor(EntryStack<T> stack) { return this; } @@ -445,5 +505,25 @@ public class ClientHelperImpl implements ClientHelper { fillPreferredOpenedCategory(); return this.map; } + + @Override + public boolean isMergingDisplays() { + return true; + } + + @Override + public ViewSearchBuilder mergingDisplays(boolean mergingDisplays) { + return this; + } + + @Override + public boolean isProcessingVisibilityHandlers() { + return false; + } + + @Override + public ViewSearchBuilder processingVisibilityHandlers(boolean processingVisibilityHandlers) { + return this; + } } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java index 485b90271..078f46344 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java @@ -352,10 +352,6 @@ public class ConfigManagerImpl implements ConfigManager { builder.setGlobalized(true); builder.setGlobalizedExpanded(false); if (Minecraft.getInstance().getConnection() != null && Minecraft.getInstance().getConnection().getRecipeManager() != null) { - builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new ReloadPluginsEntry(220)); - builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new PerformanceEntry(220)); - } - return builder.setAfterInitConsumer(screen -> { TextListEntry feedbackEntry = ConfigEntryBuilder.create().startTextDescription( new TranslatableComponent("text.rei.feedback", new TranslatableComponent("text.rei.feedback.link") .withStyle(style -> style @@ -366,8 +362,32 @@ public class ConfigManagerImpl implements ConfigManager { )) .withStyle(ChatFormatting.GRAY) ).build(); - feedbackEntry.setScreen((AbstractConfigScreen) screen); - ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) feedbackEntry); + builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, feedbackEntry); + builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new ReloadPluginsEntry(220)); + builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new PerformanceEntry(220)); + } + return builder.setAfterInitConsumer(screen -> { + ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new EmptyEntry(4)); + TextListEntry supportText = ConfigEntryBuilder.create().startTextDescription( + new TranslatableComponent("text.rei.support.me.desc", + new TranslatableComponent("text.rei.support.me.patreon") + .withStyle(style -> style + .withColor(TextColor.fromRgb(0xff1fc3ff)) + .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://patreon.com/shedaniel")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ImmutableTextComponent("https://patreon.com/shedaniel"))) + ), + new TranslatableComponent("text.rei.support.me.bisect") + .withStyle(style -> style + .withColor(TextColor.fromRgb(0xff1fc3ff)) + .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.bisecthosting.com/shedaniel")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ImmutableTextComponent("https://www.bisecthosting.com/shedaniel"))) + ) + ) + .withStyle(ChatFormatting.GRAY) + ).build(); + supportText.setScreen((AbstractConfigScreen) screen); + ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) supportText); + ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new TitleTextEntry(new TranslatableComponent("text.rei.support.me"))); ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new EmptyEntry(4)); ScreenHooks.addRenderableWidget(screen, new Button(screen.width - 104, 4, 100, 20, new TranslatableComponent("text.rei.credits"), button -> { CreditsScreen creditsScreen = new CreditsScreen(screen); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java index fd715ede5..257751431 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java @@ -96,13 +96,13 @@ public class ReloadPluginsEntry extends AbstractConfigListEntry<Unit> { Window window = Minecraft.getInstance().getWindow(); this.reloadPluginsButton.active = this.isEditable(); this.reloadPluginsButton.y = y; - this.reloadPluginsButton.setWidth(width / 2 - 6); + this.reloadPluginsButton.setWidth(width / 2 - 2); this.reloadPluginsButton.x = x + entryWidth / 2 - width / 2; this.reloadPluginsButton.render(matrices, mouseX, mouseY, delta); this.reloadSearchButton.active = this.isEditable() && !Argument.SEARCH_CACHE.isEmpty(); this.reloadSearchButton.y = y; - this.reloadSearchButton.setWidth(width / 2 - 6); - this.reloadSearchButton.x = x + entryWidth / 2 + 3; + this.reloadSearchButton.setWidth(width / 2 - 2); + this.reloadSearchButton.x = x + entryWidth / 2 + 2; this.reloadSearchButton.render(matrices, mouseX, mouseY, delta); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/TitleTextEntry.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/TitleTextEntry.java new file mode 100644 index 000000000..3e2bdc48a --- /dev/null +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/TitleTextEntry.java @@ -0,0 +1,87 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.impl.client.config.entries; + +import com.mojang.blaze3d.vertex.PoseStack; +import me.shedaniel.clothconfig2.api.AbstractConfigListEntry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.chat.NarratorChatListener; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.network.chat.Component; +import net.minecraft.util.Unit; +import org.jetbrains.annotations.ApiStatus; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +@ApiStatus.Internal +public class TitleTextEntry extends AbstractConfigListEntry<Unit> { + private Component text; + + public TitleTextEntry(Component text) { + super(NarratorChatListener.NO_TITLE, false); + this.text = text; + } + + @Override + public Unit getValue() { + return Unit.INSTANCE; + } + + @Override + public Optional<Unit> getDefaultValue() { + return Optional.of(Unit.INSTANCE); + } + + @Override + public void save() { + } + + @Override + public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) { + super.render(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, isSelected, delta); + matrices.pushPose(); + matrices.translate(x + entryWidth / 2F - Minecraft.getInstance().font.width(text) * 1.5F / 2F, y + 5, 1.0F); + matrices.scale(1.5F, 1.5F, 1.0F); + Minecraft.getInstance().font.drawShadow(matrices, text, 0.0F, 0.0F, -1); + matrices.popPose(); + } + + @Override + public int getItemHeight() { + return 26; + } + + @Override + public List<? extends GuiEventListener> children() { + return Collections.emptyList(); + } + + @Override + public List<? extends NarratableEntry> narratables() { + return Collections.emptyList(); + } +} diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRule.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRule.java index 58ad942ba..5f5969674 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRule.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRule.java @@ -23,6 +23,7 @@ package me.shedaniel.rei.impl.client.entry.filtering.rules; +import com.google.common.base.Suppliers; import com.google.common.collect.Lists; import me.shedaniel.rei.api.client.search.SearchFilter; import me.shedaniel.rei.api.client.search.SearchProvider; @@ -41,6 +42,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.util.StringUtil; import java.util.Collection; import java.util.List; @@ -51,23 +53,30 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.function.BiFunction; import java.util.function.Consumer; +import java.util.function.Supplier; @Environment(EnvType.CLIENT) public class SearchFilteringRule extends AbstractFilteringRule<SearchFilteringRule> { - private SearchFilter filter; + private String filterStr; + private Supplier<SearchFilter> filter; private boolean show; public SearchFilteringRule() { } - public SearchFilteringRule(SearchFilter filter, boolean show) { - this.filter = filter; + public SearchFilteringRule(String filter, boolean show) { + setFilter(filter); this.show = show; } + public void setFilter(String filter) { + this.filterStr = filter; + this.filter = Suppliers.memoize(() -> StringUtil.isNullOrEmpty(filter) ? SearchFilter.matchAll() : SearchProvider.getInstance().createFilter(filter)); + } + @Override public CompoundTag save(CompoundTag tag) { - tag.putString("filter", filter.getFilter()); + tag.putString("filter", filterStr); tag.putBoolean("show", show); return tag; } @@ -76,7 +85,7 @@ public class SearchFilteringRule extends AbstractFilteringRule<SearchFilteringRu public SearchFilteringRule createFromTag(CompoundTag tag) { String filter = tag.getString("filter"); boolean show = tag.getBoolean("show"); - return new SearchFilteringRule(SearchProvider.getInstance().createFilter(filter), show); + return new SearchFilteringRule(filter, show); } @Override @@ -106,7 +115,7 @@ public class SearchFilteringRule extends AbstractFilteringRule<SearchFilteringRu @Override public SearchFilteringRule createNew() { - return new SearchFilteringRule(SearchFilter.matchAll(), true); + return new SearchFilteringRule("", true); } private void processList(Collection<EntryStack<?>> stacks, List<CompletableFuture<List<EntryStack<?>>>> completableFutures) { @@ -114,7 +123,7 @@ public class SearchFilteringRule extends AbstractFilteringRule<SearchFilteringRu completableFutures.add(CompletableFuture.supplyAsync(() -> { List<EntryStack<?>> output = Lists.newArrayList(); for (EntryStack<?> stack : partitionStacks) { - if (stack != null && filter.test(stack)) { + if (stack != null && filter.get().test(stack)) { output.add(stack); } } @@ -146,7 +155,7 @@ public class SearchFilteringRule extends AbstractFilteringRule<SearchFilteringRu entryConsumer.accept(entry = new TextFieldRuleEntry(width - 36, rule, widget -> { widget.setMaxLength(9999); if (entry != null) widget.setValue(entry.getWidget().getValue()); - else widget.setValue(rule.filter.getFilter()); + else widget.setValue(rule.filterStr); })); addEmpty(entryConsumer, 10); addText(entryConsumer, new TranslatableComponent("rule.roughlyenoughitems.filtering.search.show").withStyle(ChatFormatting.GRAY)); @@ -157,7 +166,7 @@ public class SearchFilteringRule extends AbstractFilteringRule<SearchFilteringRu @Override public void save() { - rule.filter = SearchProvider.getInstance().createFilter(entry.getWidget().getValue()); + rule.setFilter(entry.getWidget().getValue()); rule.show = show.getBoolean(); } }); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CachedEntryListRender.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CachedEntryListRender.java index 65447b81b..b9037a3ac 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CachedEntryListRender.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CachedEntryListRender.java @@ -35,6 +35,7 @@ import it.unimi.dsi.fastutil.longs.Long2LongMap; import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.RoughlyEnoughItemsCore; +import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer; import me.shedaniel.rei.api.client.registry.entry.EntryRegistry; import me.shedaniel.rei.api.common.entry.EntryStack; @@ -76,7 +77,9 @@ public class CachedEntryListRender { } public static void refresh() { - RoughlyEnoughItemsCore.LOGGER.info("Refreshing cached entry list texture..."); + if (ConfigObject.getInstance().doesCacheEntryRendering()) { + RoughlyEnoughItemsCore.LOGGER.info("Refreshing cached entry list texture..."); + } if (cachedTextureLocation != null) { Minecraft.getInstance().getTextureManager().release(cachedTextureLocation); cachedTextureLocation = null; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java index 3f9cfe4cc..96a19c34d 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java @@ -362,11 +362,9 @@ public class EntryWidget extends Slot implements DraggableStackProviderWidget { RenderSystem.disableDepthTest(); RenderSystem.colorMask(true, true, true, false); Rectangle bounds = getInnerBounds(); - setZ(300); fillGradient(matrices, bounds.x, bounds.y, bounds.getMaxX(), bounds.getMaxY(), 0x80ffffff, 0x80ffffff); int darkColor = 0x111111 | ((int) (90 * darkHighlightedAlpha.value()) << 24); fillGradient(matrices, bounds.x, bounds.y, bounds.getMaxX(), bounds.getMaxY(), darkColor, darkColor); - setZ(0); RenderSystem.colorMask(true, true, true, true); RenderSystem.enableDepthTest(); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/QueuedTooltip.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/QueuedTooltip.java index 586eae71a..5c992d197 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/QueuedTooltip.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/QueuedTooltip.java @@ -29,6 +29,7 @@ import me.shedaniel.math.Point; import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.util.CollectionUtils; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; @@ -46,17 +47,15 @@ import java.util.List; @Environment(EnvType.CLIENT) public class QueuedTooltip implements Tooltip { private Point location; - private List<Tooltip.Entry> entries; - private List<TooltipComponent> components; + private List<TooltipEntryImpl> entries; private EntryStack<?> stack = EntryStack.empty(); - private QueuedTooltip(Point location, Collection<Tooltip.Entry> entries) { + private QueuedTooltip(Point location, Collection<? extends Tooltip.Entry> entries) { this.location = location; if (this.location == null) { this.location = PointHelper.ofMouse(); } - this.entries = Lists.newArrayList(entries); - this.components = Lists.newArrayList(); + this.entries = (List<TooltipEntryImpl>) Lists.newArrayList(entries); } public static QueuedTooltip impl(Point location, Collection<Tooltip.Entry> text) { @@ -75,12 +74,12 @@ public class QueuedTooltip implements Tooltip { @Override public Li |
