Fix #find results not being clickable

This commit is contained in:
ZacSharp 2023-01-15 20:22:58 +01:00
parent 0057f093db
commit 432d42ade8
No known key found for this signature in database
GPG Key ID: 9453647B005083A3
1 changed files with 7 additions and 7 deletions

View File

@ -75,13 +75,13 @@ public class FindCommand extends Command {
private ITextComponent positionToComponent(BetterBlockPos pos) {
String positionText = String.format("%s %s %s", pos.x, pos.y, pos.z);
String command = String.format("%sgoal %s", FORCE_COMMAND_PREFIX, positionText);
ITextComponent baseComponent = new StringTextComponent(pos.toString());
ITextComponent hoverComponent = new StringTextComponent("Click to set goal to this position");
baseComponent.getStyle()
.setColor(Color.fromTextFormatting(TextFormatting.GRAY))
.setInsertion(positionText)
.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent));
IFormattableTextComponent baseComponent = new StringTextComponent(pos.toString());
IFormattableTextComponent hoverComponent = new StringTextComponent("Click to set goal to this position");
baseComponent.setStyle(baseComponent.getStyle()
.setFormatting(TextFormatting.GRAY)
.setInsertion(positionText)
.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command))
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent)));
return baseComponent;
}