Skip to content

Commit

Permalink
fixed the allow/disallow filter button not updating its tooltip immed…
Browse files Browse the repository at this point in the history
…iately
  • Loading branch information
Ellpeck committed Oct 25, 2024
1 parent f976936 commit c7d57c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ public List<AbstractWidget> getButtons(Screen gui, int x, int y, boolean rightAl
List<AbstractWidget> buttons = new ArrayList<>();
if (this.canModifyWhitelist) {
var whitelistText = (Supplier<String>) () -> "info." + PrettyPipes.ID + "." + (this.isWhitelist ? "whitelist" : "blacklist");
var tooltip = (Supplier<Tooltip>) () -> 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());
Expand Down

0 comments on commit c7d57c6

Please sign in to comment.