diff options
author | GDCloud <93287602+GDCloudstrike@users.noreply.github.com> | 2024-10-17 12:44:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-17 10:44:06 +0000 |
commit | 994490cac9fd9ff71fcea7f2b9e97e420e04ac26 (patch) | |
tree | 09c8925731f54274d407dfff95bf389e4a4b12a9 /src/main/java/gregtech/api/util/MultiblockTooltipBuilder.java | |
parent | 7ad32098ac5d941f32fff792fc9a11af1097b310 (diff) | |
download | GT5-Unofficial-994490cac9fd9ff71fcea7f2b9e97e420e04ac26.tar.gz GT5-Unofficial-994490cac9fd9ff71fcea7f2b9e97e420e04ac26.tar.bz2 GT5-Unofficial-994490cac9fd9ff71fcea7f2b9e97e420e04ac26.zip |
Bind all tooltip separators to the config (#3376)
Co-authored-by: boubou19 <miisterunknown@gmail.com>
Diffstat (limited to 'src/main/java/gregtech/api/util/MultiblockTooltipBuilder.java')
-rw-r--r-- | src/main/java/gregtech/api/util/MultiblockTooltipBuilder.java | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/src/main/java/gregtech/api/util/MultiblockTooltipBuilder.java b/src/main/java/gregtech/api/util/MultiblockTooltipBuilder.java index 5b858a426a..007a73d588 100644 --- a/src/main/java/gregtech/api/util/MultiblockTooltipBuilder.java +++ b/src/main/java/gregtech/api/util/MultiblockTooltipBuilder.java @@ -133,14 +133,7 @@ public class MultiblockTooltipBuilder { * @return Instance this method was called on. */ public MultiblockTooltipBuilder addSeparator() { - switch (GTMod.gregtechproxy.separatorStyle) { - case 0 -> iLines.add(" "); - case 1 -> iLines.add(EnumChatFormatting.GRAY + StringUtils.getRepetitionOf('-', 41)); - default -> iLines.add( - EnumChatFormatting.GRAY.toString() + EnumChatFormatting.STRIKETHROUGH - + StringUtils.getRepetitionOf('-', 41)); - } - return this; + return addSeparator(EnumChatFormatting.GRAY, 41); } /** @@ -148,11 +141,12 @@ public class MultiblockTooltipBuilder { * * @return Instance this method was called on. */ - public MultiblockTooltipBuilder addLineSeparator(EnumChatFormatting color, int length) { - if (GTMod.gregtechproxy.separatorStyle == 1) { - iLines.add(color + StringUtils.getRepetitionOf('-', length)); - } else { - iLines.add(color.toString() + EnumChatFormatting.STRIKETHROUGH + StringUtils.getRepetitionOf('-', length)); + public MultiblockTooltipBuilder addSeparator(EnumChatFormatting color, int length) { + switch (GTMod.gregtechproxy.separatorStyle) { + case 0 -> iLines.add(" "); + case 1 -> iLines.add(color + StringUtils.getRepetitionOf('-', length)); + default -> iLines + .add(color.toString() + EnumChatFormatting.STRIKETHROUGH + StringUtils.getRepetitionOf('-', length)); } return this; } @@ -681,11 +675,25 @@ public class MultiblockTooltipBuilder { * * @return Instance this method was called on. */ - public MultiblockTooltipBuilder addStructureInfoLineSeparator(EnumChatFormatting color, int length) { - if (GTMod.gregtechproxy.separatorStyle == 1) { - sLines.add(color + StringUtils.getRepetitionOf('-', length)); + public MultiblockTooltipBuilder addStructureInfoSeparator(EnumChatFormatting color, int length, + boolean useFinisherConfig) { + if (useFinisherConfig) { + switch (GTMod.gregtechproxy.tooltipFinisherStyle) { + case 0 -> {} + case 1 -> sLines.add(TAB + " "); + case 2 -> sLines.add(TAB + color + StringUtils.getRepetitionOf('-', length)); + default -> sLines.add( + TAB + color.toString() + + EnumChatFormatting.STRIKETHROUGH + + StringUtils.getRepetitionOf('-', length)); + } } else { - sLines.add(color.toString() + EnumChatFormatting.STRIKETHROUGH + StringUtils.getRepetitionOf('-', length)); + switch (GTMod.gregtechproxy.separatorStyle) { + case 0 -> sLines.add(TAB + " "); + case 1 -> sLines.add(TAB + color + StringUtils.getRepetitionOf('-', length)); + default -> sLines + .add(TAB + color + EnumChatFormatting.STRIKETHROUGH + StringUtils.getRepetitionOf('-', length)); + } } return this; } @@ -696,14 +704,7 @@ public class MultiblockTooltipBuilder { * @return Instance this method was called on. */ public MultiblockTooltipBuilder addStructureInfoSeparator() { - switch (GTMod.gregtechproxy.separatorStyle) { - case 0 -> sLines.add(" "); - case 1 -> sLines.add(EnumChatFormatting.GRAY + StringUtils.getRepetitionOf('-', 30)); - default -> sLines.add( - EnumChatFormatting.GRAY.toString() + EnumChatFormatting.STRIKETHROUGH - + StringUtils.getRepetitionOf('-', 30)); - } - return this; + return addStructureInfoSeparator(EnumChatFormatting.GRAY, 30, false); } /** @@ -754,8 +755,7 @@ public class MultiblockTooltipBuilder { * @param authors Formatted names of the creators of this multiblock machine - if any */ public MultiblockTooltipBuilder toolTipFinisher(@Nullable String... authors) { - iLines.add(" "); - return toolTipFinisher0(authors); + return toolTipFinisher(EnumChatFormatting.GRAY, 41, authors); } /** @@ -766,15 +766,23 @@ public class MultiblockTooltipBuilder { * <p> * Ends the building process. * - * @param authors Formatted names of the creators of this multiblock machine - if any + * @param separatorColor Color of the separator line + * @param separatorLength Length of the separator line + * @param authors Formatted names of the creators of this multiblock machine - if any */ + public MultiblockTooltipBuilder toolTipFinisher(EnumChatFormatting separatorColor, int separatorLength, @Nullable String... authors) { - this.addLineSeparator(separatorColor, separatorLength); - return toolTipFinisher0(authors); - } - private MultiblockTooltipBuilder toolTipFinisher0(@Nullable String... authors) { + switch (GTMod.gregtechproxy.tooltipFinisherStyle) { + case 0 -> {} + case 1 -> iLines.add(" "); + case 2 -> iLines.add(separatorColor + StringUtils.getRepetitionOf('-', separatorLength)); + default -> iLines.add( + separatorColor.toString() + EnumChatFormatting.STRIKETHROUGH + + StringUtils.getRepetitionOf('-', separatorLength)); + } + iLines.add( TT_hold + " " + EnumChatFormatting.BOLD @@ -807,7 +815,7 @@ public class MultiblockTooltipBuilder { iLines.add(sb.toString()); } hLines.add(TT_structurehint); - sLines.add(" "); + this.addStructureInfoSeparator(EnumChatFormatting.GRAY, 30, true); sLines.add(EnumChatFormatting.WHITE + TT_StructureComplex); sLines.add( EnumChatFormatting.WHITE + TT_SeeStructure1 |