mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 22:33:42 +01:00
Remove TooltipHelper.getUnformattedDeepText
- Replace it with ITextComponent.getString
This commit is contained in:
parent
1e65e3aee6
commit
8d90137b1a
3 changed files with 5 additions and 14 deletions
|
@ -26,7 +26,7 @@ public interface IDisplayAssemblyExceptions {
|
||||||
|
|
||||||
tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(Lang.translate("gui.assembly.exception").formatted(TextFormatting.GOLD)));
|
tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(Lang.translate("gui.assembly.exception").formatted(TextFormatting.GOLD)));
|
||||||
|
|
||||||
String text = TooltipHelper.getUnformattedDeepText(e.component);
|
String text = e.component.getString();
|
||||||
Arrays.stream(text.split("\n"))
|
Arrays.stream(text.split("\n"))
|
||||||
.forEach(l -> TooltipHelper.cutStringTextComponent(l, GRAY, WHITE)
|
.forEach(l -> TooltipHelper.cutStringTextComponent(l, GRAY, WHITE)
|
||||||
.forEach(c -> tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(c))));
|
.forEach(c -> tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(c))));
|
||||||
|
@ -35,4 +35,5 @@ public interface IDisplayAssemblyExceptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
AssemblyException getLastAssemblyException();
|
AssemblyException getLastAssemblyException();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,10 +212,8 @@ public class ItemDescription {
|
||||||
boolean hasControls = !linesOnCtrl.isEmpty();
|
boolean hasControls = !linesOnCtrl.isEmpty();
|
||||||
|
|
||||||
if (hasDescription || hasControls) {
|
if (hasDescription || hasControls) {
|
||||||
String[] holdDesc = TooltipHelper.getUnformattedDeepText(Lang.translate("tooltip.holdForDescription", "$"))
|
String[] holdDesc = Lang.translate("tooltip.holdForDescription", "$").getString().split("\\$");
|
||||||
.split("\\$");
|
String[] holdCtrl = Lang.translate("tooltip.holdForControls", "$").getString().split("\\$");
|
||||||
String[] holdCtrl = TooltipHelper.getUnformattedDeepText(Lang.translate("tooltip.holdForControls", "$"))
|
|
||||||
.split("\\$");
|
|
||||||
IFormattableTextComponent keyShift = Lang.translate("tooltip.keyShift");
|
IFormattableTextComponent keyShift = Lang.translate("tooltip.keyShift");
|
||||||
IFormattableTextComponent keyCtrl = Lang.translate("tooltip.keyCtrl");
|
IFormattableTextComponent keyCtrl = Lang.translate("tooltip.keyCtrl");
|
||||||
for (List<ITextComponent> list : Arrays.asList(lines, linesOnShift, linesOnCtrl)) {
|
for (List<ITextComponent> list : Arrays.asList(lines, linesOnShift, linesOnCtrl)) {
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class TooltipHelper {
|
||||||
|
|
||||||
public static List<ITextComponent> cutTextComponent(ITextComponent c, TextFormatting defaultColor,
|
public static List<ITextComponent> cutTextComponent(ITextComponent c, TextFormatting defaultColor,
|
||||||
TextFormatting highlightColor, int indent) {
|
TextFormatting highlightColor, int indent) {
|
||||||
String s = getUnformattedDeepText(c);
|
String s = c.getString();
|
||||||
|
|
||||||
// Apply markup
|
// Apply markup
|
||||||
String markedUp = s;// .replaceAll("_([^_]+)_", highlightColor + "$1" + defaultColor);
|
String markedUp = s;// .replaceAll("_([^_]+)_", highlightColor + "$1" + defaultColor);
|
||||||
|
@ -330,12 +330,4 @@ public class TooltipHelper {
|
||||||
// return l.get();
|
// return l.get();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public static String getUnformattedDeepText(ITextComponent component) {
|
|
||||||
StringBuilder b = new StringBuilder();
|
|
||||||
b.append(component.getString());
|
|
||||||
component.getSiblings()
|
|
||||||
.forEach(c -> b.append(getUnformattedDeepText(c)));
|
|
||||||
return b.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue