diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-05-27 18:43:08 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2023-05-29 20:32:42 +0800 |
| commit | 00c275e2fee7ea2551dc1cacb2a6df4be2f9d718 (patch) | |
| tree | 4dfa41f443513d551253535177bb7e3922e9d3bd /runtime/src/main/java | |
| parent | 461394cd22e428ac9128802963f450ee7ad1e42a (diff) | |
| download | RoughlyEnoughItems-00c275e2fee7ea2551dc1cacb2a6df4be2f9d718.tar.gz RoughlyEnoughItems-00c275e2fee7ea2551dc1cacb2a6df4be2f9d718.tar.bz2 RoughlyEnoughItems-00c275e2fee7ea2551dc1cacb2a6df4be2f9d718.zip | |
Fix #867, Fix #861
Diffstat (limited to 'runtime/src/main/java')
13 files changed, 86 insertions, 28 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java index b4f3d83ad..53618154b 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java @@ -39,6 +39,7 @@ import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer; import me.shedaniel.rei.api.client.favorites.FavoriteEntry; import me.shedaniel.rei.api.client.favorites.FavoriteEntryType; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.client.overlay.ScreenOverlay; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; @@ -63,6 +64,7 @@ import me.shedaniel.rei.impl.client.favorites.FavoriteEntryTypeRegistryImpl; import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl; import me.shedaniel.rei.impl.client.gui.widget.InternalWidgets; import me.shedaniel.rei.impl.client.gui.widget.QueuedTooltip; +import me.shedaniel.rei.impl.client.gui.widget.TooltipContextImpl; import me.shedaniel.rei.impl.client.gui.widget.search.OverlaySearchField; import me.shedaniel.rei.impl.client.registry.category.CategoryRegistryImpl; import me.shedaniel.rei.impl.client.registry.display.DisplayRegistryImpl; @@ -97,6 +99,7 @@ import net.minecraft.world.inventory.CraftingMenu; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.crafting.Ingredient; import org.apache.commons.lang3.mutable.MutableLong; import org.jetbrains.annotations.ApiStatus; @@ -142,6 +145,7 @@ public class RoughlyEnoughItemsCoreClient { return entryType.readResult(object); }, "favoriteEntryFromJson"); ClientInternals.attachInstance((BiFunction<@Nullable Point, Collection<Component>, Tooltip>) QueuedTooltip::impl, "tooltipProvider"); + ClientInternals.attachInstance((BiFunction<Point, @Nullable TooltipFlag, TooltipContext>) TooltipContextImpl::new, "tooltipContextProvider"); ClientInternals.attachInstance((Function<@Nullable Boolean, ClickArea.Result>) successful -> new ClickArea.Result() { private List<CategoryIdentifier<?>> categories = Lists.newArrayList(); private BooleanSupplier execute = () -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/type/types/RenderingEntryDefinition.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/type/types/RenderingEntryDefinition.java index 6dbe08d98..27915c407 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/type/types/RenderingEntryDefinition.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/type/types/RenderingEntryDefinition.java @@ -31,6 +31,7 @@ import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer; import me.shedaniel.rei.api.client.entry.type.BuiltinClientEntryTypes; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.type.EntryDefinition; import me.shedaniel.rei.impl.common.entry.type.types.BuiltinEntryDefinition; @@ -46,7 +47,7 @@ public class RenderingEntryDefinition { public static final EntryDefinition<Renderer> RENDERING = new BuiltinEntryDefinition<Renderer>(Renderer.class, BuiltinClientEntryTypes.RENDERING, false, RenderingEntryDefinition::throwRendering, () -> () -> DeferredRenderer.INSTANCE) { @Override public Component asFormattedText(EntryStack<Renderer> entry, Renderer value) { - Tooltip tooltip = value.getTooltip(PointHelper.ofMouse()); + Tooltip tooltip = value.getTooltip(TooltipContext.ofMouse()); if (tooltip != null && !tooltip.getText().isEmpty()) { return tooltip.getText().get(0); } @@ -68,8 +69,8 @@ public class RenderingEntryDefinition { @Override @Nullable - public Tooltip getTooltip(EntryStack<Renderer> entry, Point mouse) { - return entry.getValue().getTooltip(mouse); + public Tooltip getTooltip(EntryStack<Renderer> entry, TooltipContext context) { + return entry.getValue().getTooltip(context.getPoint()); } } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/modules/entries/EntryStackSubsetsMenuEntry.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/modules/entries/EntryStackSubsetsMenuEntry.java index d6029865f..dfe6fac94 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/modules/entries/EntryStackSubsetsMenuEntry.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/modules/entries/EntryStackSubsetsMenuEntry.java @@ -31,6 +31,7 @@ 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.config.entry.EntryStackProvider; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.client.registry.entry.EntryRegistry; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.util.EntryStacks; @@ -76,7 +77,7 @@ public class EntryStackSubsetsMenuEntry extends AbstractMenuEntry { fill(matrices, getX(), getY(), getX() + getWidth(), getY() + 18, 1174405119); } if (containsMouse() && mouseX >= getX() + (getWidth() / 2) - 8 && mouseX <= getX() + (getWidth() / 2) + 8 && mouseY >= getY() + 1 && mouseY <= getY() + 17) { - REIRuntime.getInstance().queueTooltip(stack.getTooltip(new Point(mouseX, mouseY))); + REIRuntime.getInstance().queueTooltip(stack.getTooltip(TooltipContext.of(new Point(mouseX, mouseY)))); if (RoughlyEnoughItemsCoreClient.isLeftMousePressed && !clickedLast) { clickedLast = true; if (getParent().scrolling.getScissorBounds().contains(mouseX, mouseY)) { 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 2cf0c9ac4..97857d8dc 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 @@ -34,10 +34,7 @@ import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.client.REIRuntime; import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.gui.DisplayRenderer; -import me.shedaniel.rei.api.client.gui.widgets.Button; -import me.shedaniel.rei.api.client.gui.widgets.Tooltip; -import me.shedaniel.rei.api.client.gui.widgets.Widget; -import me.shedaniel.rei.api.client.gui.widgets.Widgets; +import me.shedaniel.rei.api.client.gui.widgets.*; import me.shedaniel.rei.api.client.registry.category.ButtonArea; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayCategory; @@ -371,7 +368,7 @@ public class CompositeDisplayViewingScreen extends AbstractDisplayViewingScreen if (buttonList.get(i).getBounds().getMaxY() > scrollListBounds.getMinY() && buttonList.get(i).getBounds().getMinY() < scrollListBounds.getMaxY()) { displayRenderers.get(i).setZ(1); displayRenderers.get(i).render(matrices, buttonList.get(i).getBounds(), mouseX, mouseY, delta); - Optional.ofNullable(displayRenderers.get(i).getTooltip(new Point(mouseX, mouseY))).ifPresent(Tooltip::queue); + Optional.ofNullable(displayRenderers.get(i).getTooltip(TooltipContext.of(new Point(mouseX, mouseY)))).ifPresent(Tooltip::queue); } } scrolling.renderScrollBar(0, scrollBarAlpha, REIRuntime.getInstance().isDarkThemeEnabled() ? 0.8f : 1f); 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 7821c2c26..0240bd5d2 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 @@ -415,7 +415,7 @@ public class EntryWidget extends Slot implements DraggableStackProviderWidget { @Override @Nullable - public Tooltip getCurrentTooltip(me.shedaniel.math.Point point) { + public Tooltip getCurrentTooltip(Point point) { Tooltip tooltip = getCurrentEntry().getTooltip(point); if (tooltip != null && !ClientHelper.getInstance().isCheating() && getTransferHandler() != null diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/TooltipContextImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/TooltipContextImpl.java new file mode 100644 index 000000000..0b91481ac --- /dev/null +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/TooltipContextImpl.java @@ -0,0 +1,54 @@ +/* + * 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.gui.widget; + +import me.shedaniel.math.Point; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; +import net.minecraft.client.Minecraft; +import net.minecraft.world.item.TooltipFlag; +import org.jetbrains.annotations.Nullable; + +import java.util.Objects; + +public class TooltipContextImpl implements TooltipContext { + private final Point point; + @Nullable + private final TooltipFlag flag; + + public TooltipContextImpl(Point point, @Nullable TooltipFlag flag) { + this.point = Objects.requireNonNull(point); + this.flag = flag; + } + + @Override + public TooltipFlag getFlag() { + return flag == null ? (Minecraft.getInstance().options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL) + : flag; + } + + @Override + public Point getPoint() { + return point; + } +} diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListWidget.java index f513fbb86..fda522dbc 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListWidget.java @@ -45,6 +45,7 @@ import me.shedaniel.rei.api.client.gui.drag.DraggedAcceptorResult; import me.shedaniel.rei.api.client.gui.drag.DraggingContext; import me.shedaniel.rei.api.client.gui.screen.DisplayScreen; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; import me.shedaniel.rei.api.client.overlay.OverlayListWidget; @@ -300,8 +301,8 @@ public class EntryListWidget extends WidgetWithBounds implements OverlayListWidg @Override @Nullable - public Tooltip getTooltip(EntryStack<Object> entry, Point mouse) { - return stack.getDefinition().getRenderer().getTooltip(entry.cast(), mouse); + public Tooltip getTooltip(EntryStack<Object> entry, TooltipContext context) { + return stack.getDefinition().getRenderer().getTooltip(entry.cast(), context); } }); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java index 94b00cd05..9631a2874 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java @@ -294,7 +294,7 @@ public class Argument<T, R> { if (async) { 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(); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/type/TooltipArgumentType.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/type/TooltipArgumentType.java index e7c313971..013d7083a 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/type/TooltipArgumentType.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/type/TooltipArgumentType.java @@ -27,6 +27,7 @@ import me.shedaniel.math.Point; import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.gui.config.SearchMode; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.util.CollectionUtils; import net.fabricmc.api.EnvType; @@ -35,6 +36,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; import net.minecraft.network.chat.TextColor; import net.minecraft.util.Unit; +import net.minecraft.world.item.TooltipFlag; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; @@ -45,7 +47,8 @@ import java.util.Locale; @Environment(EnvType.CLIENT) public final class TooltipArgumentType extends ArgumentType<Unit, String> { public static final TooltipArgumentType INSTANCE = new TooltipArgumentType(); - public static final String INVALID = "INVALID_PIECE_OF_TOOLTIP_I_DONT_THINK_PEOPLE_WILL_EXACTLY_HAVE_THIS_REI_REI_REI"; + private static final TooltipContext CONTEXT = TooltipContext.of(new Point(), TooltipFlag.Default.NORMAL); + public static String INVALID = "INVALID_PIECE_OF_TOOLTIP_I_DONT_THINK_PEOPLE_WILL_EXACTLY_HAVE_THIS_REI_REI_REI"; private static final Style STYLE = Style.EMPTY.withColor(TextColor.fromRgb(0xffe0ad)); @Override @@ -86,7 +89,7 @@ public final class TooltipArgumentType extends ArgumentType<Unit, String> { @Nullable public static String tryGetEntryStackTooltip(EntryStack<?> stack, int attempt) { try { - Tooltip tooltip = stack.getTooltip(new Point(), false); + Tooltip tooltip = stack.getTooltip(CONTEXT, false); if (tooltip != null) { return CollectionUtils.mapAndJoinToString(tooltip.getText(), Component::getString, "\n"); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java index 0ef43d176..a4e7d9a8d 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java @@ -34,6 +34,7 @@ import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.ClientHelper; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.settings.EntrySettingsAdapterRegistry; import me.shedaniel.rei.api.common.util.EntryStacks; @@ -210,9 +211,9 @@ public abstract class AbstractEntryStack<A> implements EntryStack<A>, Renderer { @Override @Nullable - public Tooltip getTooltip(Point mouse, boolean appendModName) { + public Tooltip getTooltip(TooltipContext context, boolean appendModName) { try { - Mutable<Tooltip> tooltip = new MutableObject<>(getRenderer().<A>cast().getTooltip(this, mouse)); + Mutable<Tooltip> tooltip = new MutableObject<>(getRenderer().<A>cast().getTooltip(this, context)); if (tooltip.getValue() == null) return null; tooltip.getValue().withContextStack(this); tooltip.getValue().addAllTexts(get(Settings.TOOLTIP_APPEND_EXTRA).apply(this)); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/types/EmptyEntryDefinition.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/types/EmptyEntryDefinition.java index 2859b5660..b4456c634 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/types/EmptyEntryDefinition.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/types/EmptyEntryDefinition.java @@ -47,11 +47,5 @@ public class EmptyEntryDefinition { public void render(EntryStack<Unit> entry, PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { } - - @Override - @Nullable - public Tooltip getTooltip(EntryStack<Unit> entry, Point mouse) { - return null; - } } } diff --git a/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java b/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java index 1f4124f0d..b39634669 100644 --- a/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java +++ b/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java @@ -38,6 +38,7 @@ import me.shedaniel.rei.api.client.entry.renderer.AbstractEntryRenderer; import me.shedaniel.rei.api.client.entry.renderer.BatchedEntryRenderer; import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.client.util.SpriteRenderer; import me.shedaniel.rei.api.common.entry.EntrySerializer; import me.shedaniel.rei.api.common.entry.EntryStack; @@ -289,7 +290,7 @@ public class FluidEntryDefinition implements EntryDefinition<FluidStack>, EntryS @Override @Nullable - public Tooltip getTooltip(EntryStack<FluidStack> entry, Point mouse) { + public Tooltip getTooltip(EntryStack<FluidStack> entry, TooltipContext context) { if (entry.isEmpty()) return null; List<Component> toolTip = Lists.newArrayList(entry.asFormattedText()); diff --git a/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java b/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java index 8e76e5bcd..7beab03b9 100644 --- a/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java +++ b/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/ItemEntryDefinition.java @@ -38,6 +38,7 @@ import me.shedaniel.rei.api.client.entry.renderer.AbstractEntryRenderer; import me.shedaniel.rei.api.client.entry.renderer.BatchedEntryRenderer; import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.common.entry.EntrySerializer; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.comparison.ComparisonContext; @@ -204,10 +205,10 @@ public class ItemEntryDefinition implements EntryDefinition<ItemStack>, EntrySer } @Environment(EnvType.CLIENT) - private List<Component> tryGetItemStackToolTip(EntryStack<ItemStack> entry, ItemStack value, boolean careAboutAdvanced) { + private List<Component> tryGetItemStackToolTip(EntryStack<ItemStack> entry, ItemStack value, TooltipContext context) { if (!SEARCH_BLACKLISTED.contains(value.getItem())) try { - return value.getTooltipLines(Minecraft.getInstance().player, careAboutAdvanced && Minecraft.getInstance().options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL); + return value.getTooltipLines(Minecraft.getInstance().player, context.getFlag()); } catch (Throwable e) { e.printStackTrace(); SEARCH_BLACKLISTED.add(value.getItem()); @@ -293,10 +294,10 @@ public class ItemEntryDefinition implements EntryDefinition<ItemStack>, EntrySer @Override @Nullable - public Tooltip getTooltip(EntryStack<ItemStack> entry, Point mouse) { + public Tooltip getTooltip(EntryStack<ItemStack> entry, TooltipContext context) { if (entry.isEmpty()) return null; - return Tooltip.create(tryGetItemStackToolTip(entry, entry.getValue(), true)); + return Tooltip.create(tryGetItemStackToolTip(entry, entry.getValue(), context)); } } } |
