Skip to content
This repository was archived by the owner on Feb 28, 2021. It is now read-only.

Commit 55fb5af

Browse files
authored
Merge pull request #4 from intact/1.14.2
Update to 1.14.2
2 parents 9db1633 + bf15a80 commit 55fb5af

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

project.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
ext {
22
projectName = "cotton-client-commands"
33
group = "io.github.cottonmc"
4-
version = "0.3.1+1.14"
4+
version = "0.3.1+1.14.2"
55
snapshot = true
66

7-
minecraft = "1.14"
8-
mappings = "1.14+build.3"
9-
loader = "0.4.4+build.139"
7+
minecraft = "1.14.2"
8+
mappings = "1.14.2+build.1"
9+
loader = "0.4.8+build.154"
1010
fabricMod = null
1111
silkMod = null
1212
jankson = null

src/main/java/io/github/cottonmc/clientcommands/Feedback.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import net.fabricmc.api.EnvType;
44
import net.fabricmc.api.Environment;
5+
import net.minecraft.ChatFormat;
56
import net.minecraft.client.MinecraftClient;
6-
import net.minecraft.text.StringTextComponent;
7-
import net.minecraft.text.TextComponent;
8-
import net.minecraft.text.TextFormat;
7+
import net.minecraft.network.chat.Component;
8+
import net.minecraft.network.chat.TextComponent;
99

1010
/**
1111
* Client-side replacements for ServerCommandSource.send[Feedback, Error]
@@ -19,7 +19,7 @@ private Feedback() {}
1919
*
2020
* @param textComponent the message
2121
*/
22-
public static void sendFeedback(TextComponent textComponent) {
22+
public static void sendFeedback(Component textComponent) {
2323
MinecraftClient.getInstance().player.addChatMessage(textComponent, false);
2424
}
2525

@@ -28,9 +28,9 @@ public static void sendFeedback(TextComponent textComponent) {
2828
*
2929
* @param textComponent the message
3030
*/
31-
public static void sendError(TextComponent textComponent) {
31+
public static void sendError(Component textComponent) {
3232
MinecraftClient.getInstance().player.addChatMessage(
33-
new StringTextComponent("").append(textComponent).applyFormat(TextFormat.RED), false
33+
new TextComponent("").append(textComponent).applyFormat(ChatFormat.RED), false
3434
);
3535
}
3636
}

src/main/java/io/github/cottonmc/clientcommands/mixin/NetworkHandlerMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import io.github.cottonmc.clientcommands.ClientCommands;
66
import io.github.cottonmc.clientcommands.impl.CommandCache;
77
import net.minecraft.client.MinecraftClient;
8-
import net.minecraft.client.gui.Screen;
8+
import net.minecraft.client.gui.screen.Screen;
99
import net.minecraft.client.network.ClientPlayNetworkHandler;
1010
import net.minecraft.client.network.packet.CommandTreeS2CPacket;
1111
import net.minecraft.network.ClientConnection;

src/main/java/io/github/cottonmc/clientcommands/mixin/PlayerMixin.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import com.mojang.brigadier.exceptions.CommandSyntaxException;
44
import io.github.cottonmc.clientcommands.impl.CommandCache;
5+
import net.minecraft.ChatFormat;
56
import net.minecraft.client.MinecraftClient;
67
import net.minecraft.client.network.ClientCommandSource;
78
import net.minecraft.client.network.ClientPlayerEntity;
89
import net.minecraft.command.CommandException;
9-
import net.minecraft.text.StringTextComponent;
10-
import net.minecraft.text.TextComponent;
11-
import net.minecraft.text.TextFormat;
12-
import net.minecraft.text.TranslatableTextComponent;
10+
import net.minecraft.network.chat.Component;
11+
import net.minecraft.network.chat.TextComponent;
12+
import net.minecraft.network.chat.TranslatableComponent;
1313
import org.spongepowered.asm.mixin.Final;
1414
import org.spongepowered.asm.mixin.Mixin;
1515
import org.spongepowered.asm.mixin.Shadow;
@@ -21,7 +21,7 @@
2121
public abstract class PlayerMixin {
2222
@Shadow @Final protected MinecraftClient client;
2323

24-
@Shadow public abstract void addChatMessage(TextComponent textComponent_1, boolean boolean_1);
24+
@Shadow public abstract void addChatMessage(Component textComponent_1, boolean boolean_1);
2525

2626
@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
2727
private void onChatMessage(String msg, CallbackInfo info) {
@@ -37,13 +37,13 @@ private void onChatMessage(String msg, CallbackInfo info) {
3737
// Prevent sending the message
3838
cancel = true;
3939
} catch (CommandException e) {
40-
addChatMessage(e.getMessageComponent().applyFormat(TextFormat.RED), false);
40+
addChatMessage(e.getMessageComponent().applyFormat(ChatFormat.RED), false);
4141
cancel = true;
4242
} catch (CommandSyntaxException e) {
43-
addChatMessage(new StringTextComponent(e.getMessage()).applyFormat(TextFormat.RED), false);
43+
addChatMessage(new TextComponent(e.getMessage()).applyFormat(ChatFormat.RED), false);
4444
cancel = true;
4545
} catch (Exception e) {
46-
addChatMessage(new TranslatableTextComponent("command.failed").applyFormat(TextFormat.RED), false);
46+
addChatMessage(new TranslatableComponent("command.failed").applyFormat(ChatFormat.RED), false);
4747
cancel = true;
4848
}
4949

src/test/java/io/github/cottonmc/clientcommands/test/ExampleModCommands.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
import io.github.cottonmc.clientcommands.ArgumentBuilders;
55
import io.github.cottonmc.clientcommands.ClientCommandPlugin;
66
import io.github.cottonmc.clientcommands.Feedback;
7+
import net.minecraft.network.chat.TextComponent;
78
import net.minecraft.server.command.CommandSource;
8-
import net.minecraft.text.StringTextComponent;
99

1010
public class ExampleModCommands implements ClientCommandPlugin {
1111
@Override
1212
public void registerCommands(CommandDispatcher<CommandSource> dispatcher) {
1313
dispatcher.register(ArgumentBuilders.literal("client-commands").executes(
1414
source -> {
15-
Feedback.sendFeedback(new StringTextComponent("Hello, world!"));
15+
Feedback.sendFeedback(new TextComponent("Hello, world!"));
1616
return 1;
1717
}
1818
));

0 commit comments

Comments
 (0)