diff --git a/src/main/java/dan200/computercraft/shared/command/CommandCopy.java b/src/main/java/dan200/computercraft/shared/command/CommandCopy.java index adf102649..52143faee 100644 --- a/src/main/java/dan200/computercraft/shared/command/CommandCopy.java +++ b/src/main/java/dan200/computercraft/shared/command/CommandCopy.java @@ -12,6 +12,7 @@ import net.minecraft.command.CommandSource; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.Style; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.util.text.event.ClickEvent; import net.minecraft.util.text.event.HoverEvent; @@ -57,10 +58,8 @@ public static void onClientSendMessage( ClientChatEvent event ) public static ITextComponent createCopyText( String text ) { - StringTextComponent name = new StringTextComponent( text ); - name.getStyle() + return new StringTextComponent( text ).func_230530_a_( Style.EMPTY .setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, PREFIX + text ) ) - .setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new TranslationTextComponent( "gui.computercraft.tooltip.copy" ) ) ); - return name; + .setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new TranslationTextComponent( "gui.computercraft.tooltip.copy" ) ) ) ); } } diff --git a/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java b/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java index d060dc202..71eced8e5 100644 --- a/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java +++ b/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java @@ -21,14 +21,12 @@ private ChatHelpers() {} public static IFormattableTextComponent coloured( String text, TextFormatting colour ) { - IFormattableTextComponent component = new StringTextComponent( text == null ? "" : text ); - component.getStyle().setFormatting( colour ); - return component; + return new StringTextComponent( text == null ? "" : text ).func_240699_a_( colour ); } public static T coloured( T component, TextFormatting colour ) { - component.getStyle().setFormatting( colour ); + component.func_240699_a_( colour ); return component; } @@ -74,11 +72,11 @@ public static IFormattableTextComponent link( IFormattableTextComponent componen { Style style = component.getStyle(); - if( style.getColor() == null ) style.setFormatting( TextFormatting.YELLOW ); - style.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, command ) ); - style.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, toolTip ) ); + if( style.getColor() == null ) style = style.setFormatting( TextFormatting.YELLOW ); + style = style.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, command ) ); + style = style.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, toolTip ) ); - return component; + return component.func_230530_a_( style ); } public static IFormattableTextComponent header( String text )