From c7d57c68fc8eae2965c6716e4e85cba85907f2ac Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 25 Oct 2024 18:46:37 +0200 Subject: [PATCH] fixed the allow/disallow filter button not updating its tooltip immediately --- src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java b/src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java index 3323c7c..ece0ec7 100644 --- a/src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java +++ b/src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java @@ -63,10 +63,12 @@ public class ItemFilter { List buttons = new ArrayList<>(); if (this.canModifyWhitelist) { var whitelistText = (Supplier) () -> "info." + PrettyPipes.ID + "." + (this.isWhitelist ? "whitelist" : "blacklist"); + var tooltip = (Supplier) () -> Tooltip.create(Component.translatable(whitelistText.get() + ".description").withStyle(ChatFormatting.GRAY)); buttons.add(Button.builder(Component.translatable(whitelistText.get()), button -> { PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, List.of(0)); button.setMessage(Component.translatable(whitelistText.get())); - }).bounds(x - 20, y, 20, 20).tooltip(Tooltip.create(Component.translatable(whitelistText.get() + ".description").withStyle(ChatFormatting.GRAY))).build()); + button.setTooltip(tooltip.get()); + }).bounds(x - 20, y, 20, 20).tooltip(tooltip.get()).build()); } if (this.canPopulateFromInventories) { buttons.add(Button.builder(Component.translatable("info." + PrettyPipes.ID + ".populate"), button -> PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, List.of(1))).bounds(x - 42, y, 20, 20).tooltip(Tooltip.create(Component.translatable("info." + PrettyPipes.ID + ".populate.description").withStyle(ChatFormatting.GRAY))).build());