Skip to content

Commit 2323704

Browse files
authored
Improve pattern provider grouping (#8735)
If different group entries are available still use the more specific icon if it is the same for all group entries. Fixes #8732
1 parent 693eb85 commit 2323704

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/main/java/appeng/helpers/patternprovider/PatternProviderLogic.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -747,24 +747,29 @@ public PatternContainerGroup getTerminalGroup() {
747747
return groups.iterator().next();
748748
}
749749

750+
// If nothing is adjacent, just use itself
751+
var icon = this.host.getTerminalIcon();
750752
List<Component> tooltip = List.of();
751753
// If there are multiple groups, show that in the tooltip
752754
if (groups.size() > 1) {
753755
tooltip = new ArrayList<>();
754756
tooltip.add(GuiText.AdjacentToDifferentMachines.text().withStyle(ChatFormatting.BOLD));
757+
// If all groups share the same icon use that
758+
icon = groups.getFirst().icon();
755759
for (var group : groups) {
760+
if (!icon.getId().equals(group.icon().getId())) {
761+
icon = this.host.getTerminalIcon();
762+
}
756763
tooltip.add(group.name());
757764
for (var line : group.tooltip()) {
758765
tooltip.add(Component.literal(" ").append(line));
759766
}
760767
}
761768
}
762769

763-
// If nothing is adjacent, just use itself
764-
var hostIcon = this.host.getTerminalIcon();
765770
return new PatternContainerGroup(
766-
hostIcon,
767-
hostIcon.getDisplayName(),
771+
icon,
772+
icon.getDisplayName(),
768773
tooltip);
769774
}
770775

0 commit comments

Comments
 (0)