Skip to content

Commit 0638cf9

Browse files
committed
Update to 1.14.3
1 parent f099ccd commit 0638cf9

14 files changed

+110
-110
lines changed

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/use
6-
minecraft_version=1.14.2
7-
yarn_mappings=1.14.2+build.7
8-
loader_version=0.4.8+build.154
6+
minecraft_version=1.14.3
7+
yarn_mappings=1.14.3+build.1
8+
loader_version=0.4.8+build.155
99

1010
# Mod Properties
11-
mod_version = 2.1.0
11+
mod_version = 2.1.1
1212
maven_group = net.earthcomputer
1313
archives_base_name = clientcommands
1414

src/main/java/net/earthcomputer/clientcommands/WikiRetriever.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package net.earthcomputer.clientcommands;
22

33
import com.google.gson.Gson;
4-
import net.minecraft.ChatFormat;
4+
import net.minecraft.util.Formatting;
55

66
import java.io.IOException;
77
import java.io.InputStream;
@@ -18,7 +18,7 @@ public class WikiRetriever {
1818
private static final String WIKI_HOST = "https://minecraft.gamepedia.com/";
1919
private static final String PAGE_SUMMARY_QUERY = WIKI_HOST + "api.php?action=query&prop=extracts&exintro=true&format=json&titles=%s";
2020
private static final Pattern HTML_TAG_PATTERN = Pattern.compile("<\\s*(/)?\\s*(\\w+).*?>", Pattern.DOTALL);
21-
private static final ChatFormat CODE_COLOR = ChatFormat.DARK_GREEN;
21+
private static final Formatting CODE_COLOR = Formatting.DARK_GREEN;
2222
private static final Gson GSON = new Gson();
2323

2424
public static String decode(String html) {
@@ -39,23 +39,23 @@ public static String decode(String html) {
3939
if (!endTag) {
4040
switch (tagName) {
4141
case "b":
42-
raw.append(ChatFormat.BOLD);
42+
raw.append(Formatting.BOLD);
4343
bold = true;
4444
break;
4545
case "i":
46-
raw.append(ChatFormat.ITALIC);
46+
raw.append(Formatting.ITALIC);
4747
italic = true;
4848
break;
4949
case "u":
5050
case "dt":
51-
raw.append(ChatFormat.UNDERLINE);
51+
raw.append(Formatting.UNDERLINE);
5252
underline = true;
5353
break;
5454
case "code":
5555
raw.append(CODE_COLOR);
56-
if (bold) raw.append(ChatFormat.BOLD);
57-
if (italic) raw.append(ChatFormat.ITALIC);
58-
if (underline) raw.append(ChatFormat.UNDERLINE);
56+
if (bold) raw.append(Formatting.BOLD);
57+
if (italic) raw.append(Formatting.ITALIC);
58+
if (underline) raw.append(Formatting.UNDERLINE);
5959
code = true;
6060
break;
6161
case "dd":
@@ -82,33 +82,33 @@ public static String decode(String html) {
8282
switch (tagName) {
8383
case "b":
8484
if (code) raw.append(CODE_COLOR);
85-
else raw.append(ChatFormat.RESET);
86-
if (italic) raw.append(ChatFormat.ITALIC);
87-
if (underline) raw.append(ChatFormat.UNDERLINE);
85+
else raw.append(Formatting.RESET);
86+
if (italic) raw.append(Formatting.ITALIC);
87+
if (underline) raw.append(Formatting.UNDERLINE);
8888
bold = false;
8989
break;
9090
case "i":
9191
if (code) raw.append(CODE_COLOR);
92-
else raw.append(ChatFormat.RESET);
93-
if (bold) raw.append(ChatFormat.BOLD);
94-
if (underline) raw.append(ChatFormat.UNDERLINE);
92+
else raw.append(Formatting.RESET);
93+
if (bold) raw.append(Formatting.BOLD);
94+
if (underline) raw.append(Formatting.UNDERLINE);
9595
italic = false;
9696
break;
9797
case "dt":
9898
raw.append("\n");
9999
//fallthrough
100100
case "u":
101101
if (code) raw.append(CODE_COLOR);
102-
else raw.append(ChatFormat.RESET);
103-
if (bold) raw.append(ChatFormat.BOLD);
104-
if (italic) raw.append(ChatFormat.ITALIC);
102+
else raw.append(Formatting.RESET);
103+
if (bold) raw.append(Formatting.BOLD);
104+
if (italic) raw.append(Formatting.ITALIC);
105105
underline = false;
106106
break;
107107
case "code":
108-
raw.append(ChatFormat.RESET);
109-
if (bold) raw.append(ChatFormat.BOLD);
110-
if (italic) raw.append(ChatFormat.ITALIC);
111-
if (underline) raw.append(ChatFormat.UNDERLINE);
108+
raw.append(Formatting.RESET);
109+
if (bold) raw.append(Formatting.BOLD);
110+
if (italic) raw.append(Formatting.ITALIC);
111+
if (underline) raw.append(Formatting.UNDERLINE);
112112
code = false;
113113
break;
114114
case "ul":

src/main/java/net/earthcomputer/clientcommands/command/CHelpCommand.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import com.mojang.brigadier.ParseResults;
66
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
77
import com.mojang.brigadier.tree.CommandNode;
8-
import net.minecraft.network.chat.TextComponent;
9-
import net.minecraft.network.chat.TranslatableComponent;
108
import net.minecraft.server.command.ServerCommandSource;
9+
import net.minecraft.text.LiteralText;
10+
import net.minecraft.text.TranslatableText;
1111

1212
import java.util.Map;
1313

@@ -17,7 +17,7 @@
1717

1818
public class CHelpCommand {
1919

20-
private static final SimpleCommandExceptionType FAILED_EXCEPTION = new SimpleCommandExceptionType(new TranslatableComponent("commands.help.failed"));
20+
private static final SimpleCommandExceptionType FAILED_EXCEPTION = new SimpleCommandExceptionType(new TranslatableText("commands.help.failed"));
2121

2222
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
2323
addClientSideCommand("chelp");
@@ -30,11 +30,11 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
3030
if (isClientSideCommand(cmdName)) {
3131
Map<CommandNode<ServerCommandSource>, String> usage = dispatcher.getSmartUsage(command, ctx.getSource());
3232
for (String u : usage.values()) {
33-
sendFeedback(new TextComponent("/" + cmdName + " " + u));
33+
sendFeedback(new LiteralText("/" + cmdName + " " + u));
3434
}
3535
cmdCount += usage.size();
3636
if (usage.size() == 0) {
37-
sendFeedback(new TextComponent("/" + cmdName));
37+
sendFeedback(new LiteralText("/" + cmdName));
3838
cmdCount++;
3939
}
4040
}
@@ -53,7 +53,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
5353

5454
Map<CommandNode<ServerCommandSource>, String> usage = dispatcher.getSmartUsage(Iterables.getLast(parseResults.getContext().getNodes()).getNode(), ctx.getSource());
5555
for (String u : usage.values()) {
56-
sendFeedback(new TextComponent("/" + cmdName + " " + u));
56+
sendFeedback(new LiteralText("/" + cmdName + " " + u));
5757
}
5858

5959
return usage.size();

src/main/java/net/earthcomputer/clientcommands/command/CalcCommand.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import com.mojang.brigadier.CommandDispatcher;
44
import net.earthcomputer.clientcommands.TempRules;
55
import net.earthcomputer.clientcommands.command.arguments.ExpressionArgumentType;
6-
import net.minecraft.ChatFormat;
7-
import net.minecraft.network.chat.Component;
8-
import net.minecraft.network.chat.TextComponent;
96
import net.minecraft.server.command.ServerCommandSource;
7+
import net.minecraft.text.LiteralText;
8+
import net.minecraft.text.Text;
9+
import net.minecraft.util.Formatting;
1010

1111
import static net.earthcomputer.clientcommands.command.ClientCommandManager.*;
1212
import static net.earthcomputer.clientcommands.command.arguments.ExpressionArgumentType.*;
@@ -27,19 +27,19 @@ private static int evaluateExpression(ServerCommandSource source, ExpressionArgu
2727
TempRules.calcAnswer = result;
2828
int iresult = 0;
2929

30-
Component feedback = new TextComponent(expression.strVal + " = ");
30+
Text feedback = new LiteralText(expression.strVal + " = ");
3131

3232
if (Math.round(result) == result) {
3333
String strResult = String.valueOf(result);
34-
feedback.append(new TextComponent(strResult.contains("E") ? strResult : strResult.substring(0, strResult.length() - 2)).applyFormat(ChatFormat.BOLD));
34+
feedback.append(new LiteralText(strResult.contains("E") ? strResult : strResult.substring(0, strResult.length() - 2)).formatted(Formatting.BOLD));
3535
iresult = (int) result;
3636
if (iresult == result && iresult > 0) {
3737
int stacks = iresult / 64;
3838
int remainder = iresult % 64;
3939
feedback.append(" = " + stacks + " * 64 + " + remainder);
4040
}
4141
} else {
42-
feedback.append(new TextComponent(String.valueOf(result)).applyFormat(ChatFormat.BOLD));
42+
feedback.append(new LiteralText(String.valueOf(result)).formatted(Formatting.BOLD));
4343
}
4444

4545
sendFeedback(feedback);

src/main/java/net/earthcomputer/clientcommands/command/ClientCommandManager.java

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

33
import com.mojang.brigadier.StringReader;
44
import com.mojang.brigadier.exceptions.CommandSyntaxException;
5-
import net.minecraft.ChatFormat;
65
import net.minecraft.client.MinecraftClient;
76
import net.minecraft.client.network.ClientPlayerEntity;
87
import net.minecraft.command.CommandException;
9-
import net.minecraft.network.chat.*;
8+
import net.minecraft.text.*;
9+
import net.minecraft.util.Formatting;
1010
import net.minecraft.util.math.BlockPos;
1111

1212
import java.util.HashSet;
@@ -28,15 +28,15 @@ public static boolean isClientSideCommand(String name) {
2828
return clientSideCommands.contains(name);
2929
}
3030

31-
public static void sendError(Component error) {
32-
sendFeedback(new TextComponent("").append(error).applyFormat(ChatFormat.RED));
31+
public static void sendError(Text error) {
32+
sendFeedback(new LiteralText("").append(error).formatted(Formatting.RED));
3333
}
3434

3535
public static void sendFeedback(String message) {
36-
sendFeedback(new TranslatableComponent(message));
36+
sendFeedback(new TranslatableText(message));
3737
}
3838

39-
public static void sendFeedback(Component message) {
39+
public static void sendFeedback(Text message) {
4040
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(message);
4141
}
4242

@@ -45,40 +45,40 @@ public static void executeCommand(StringReader reader, String command) {
4545
try {
4646
player.networkHandler.getCommandDispatcher().execute(reader, new FakeCommandSource(player));
4747
} catch (CommandException e) {
48-
ClientCommandManager.sendError(e.getMessageComponent());
48+
ClientCommandManager.sendError(e.getMessageText());
4949
} catch (CommandSyntaxException e) {
50-
ClientCommandManager.sendError(Components.message(e.getRawMessage()));
50+
ClientCommandManager.sendError(Texts.toText(e.getRawMessage()));
5151
if (e.getInput() != null && e.getCursor() >= 0) {
5252
int cursor = Math.min(e.getCursor(), e.getInput().length());
53-
Component text = new TextComponent("").applyFormat(ChatFormat.GRAY)
54-
.modifyStyle(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command)));
53+
Text text = new LiteralText("").formatted(Formatting.GRAY)
54+
.styled(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command)));
5555
if (cursor > 10)
5656
text.append("...");
5757

5858
text.append(e.getInput().substring(Math.max(0, cursor - 10), cursor));
5959
if (cursor < e.getInput().length()) {
60-
text.append(new TextComponent(e.getInput().substring(cursor)).applyFormat(ChatFormat.RED, ChatFormat.UNDERLINE));
60+
text.append(new LiteralText(e.getInput().substring(cursor)).formatted(Formatting.RED, Formatting.UNDERLINE));
6161
}
6262

63-
text.append(new TranslatableComponent("command.context.here").applyFormat(ChatFormat.RED, ChatFormat.ITALIC));
63+
text.append(new TranslatableText("command.context.here").formatted(Formatting.RED, Formatting.ITALIC));
6464
ClientCommandManager.sendError(text);
6565
}
6666
} catch (Exception e) {
67-
TextComponent error = new TextComponent(e.getMessage() == null ? e.getClass().getName() : e.getMessage());
68-
ClientCommandManager.sendError(new TranslatableComponent("command.failed")
69-
.modifyStyle(style -> style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, error))));
67+
LiteralText error = new LiteralText(e.getMessage() == null ? e.getClass().getName() : e.getMessage());
68+
ClientCommandManager.sendError(new TranslatableText("command.failed")
69+
.styled(style -> style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, error))));
7070
e.printStackTrace();
7171
}
7272
}
7373

74-
public static Component getCoordsTextComponent(BlockPos pos) {
75-
Component text = new TranslatableComponent("commands.client.blockpos", pos.getX(), pos.getY(),
74+
public static Text getCoordsTextComponent(BlockPos pos) {
75+
Text text = new TranslatableText("commands.client.blockpos", pos.getX(), pos.getY(),
7676
pos.getZ());
7777
text.getStyle().setUnderline(true);
7878
text.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
7979
String.format("/clook block %d %d %d", pos.getX(), pos.getY(), pos.getZ())));
8080
text.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
81-
new TextComponent(String.format("/clook block %d %d %d", pos.getX(), pos.getY(), pos.getZ()))));
81+
new LiteralText(String.format("/clook block %d %d %d", pos.getX(), pos.getY(), pos.getZ()))));
8282
return text;
8383
}
8484

src/main/java/net/earthcomputer/clientcommands/command/FindBlockCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import net.minecraft.client.MinecraftClient;
66
import net.minecraft.command.arguments.BlockStateArgument;
77
import net.minecraft.command.arguments.BlockStateArgumentType;
8-
import net.minecraft.network.chat.TranslatableComponent;
98
import net.minecraft.server.command.ServerCommandSource;
9+
import net.minecraft.text.TranslatableText;
1010
import net.minecraft.util.math.BlockPos;
1111
import net.minecraft.util.math.ChunkPos;
1212
import net.minecraft.util.math.MathHelper;
@@ -58,13 +58,13 @@ private static int findBlock(ServerCommandSource source, BlockStateArgument bloc
5858
.orElse(null);
5959

6060
if (closestBlock == null) {
61-
sendError(new TranslatableComponent("commands.cfindblock.notFound"));
61+
sendError(new TranslatableText("commands.cfindblock.notFound"));
6262
return 0;
6363
} else {
6464
double foundRadius = radiusType.distanceFunc.applyAsDouble(closestBlock.subtract(origin));
65-
sendFeedback(new TranslatableComponent("commands.cfindblock.success.left", foundRadius)
65+
sendFeedback(new TranslatableText("commands.cfindblock.success.left", foundRadius)
6666
.append(getCoordsTextComponent(closestBlock))
67-
.append(new TranslatableComponent("commands.cfindblock.success.right", foundRadius)));
67+
.append(new TranslatableText("commands.cfindblock.success.right", foundRadius)));
6868
return 1;
6969
}
7070
}

src/main/java/net/earthcomputer/clientcommands/command/FindCommand.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package net.earthcomputer.clientcommands.command;
22

33
import com.mojang.brigadier.CommandDispatcher;
4-
import net.minecraft.ChatFormat;
54
import net.minecraft.entity.Entity;
6-
import net.minecraft.network.chat.TranslatableComponent;
75
import net.minecraft.server.command.ServerCommandSource;
6+
import net.minecraft.text.TranslatableText;
7+
import net.minecraft.util.Formatting;
88
import net.minecraft.util.math.BlockPos;
99

1010
import java.util.List;
@@ -25,16 +25,16 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
2525

2626
private static int listEntities(ServerCommandSource source, List<Entity> entities) {
2727
if (entities.isEmpty()) {
28-
sendError(new TranslatableComponent("commands.cfind.noMatch"));
28+
sendError(new TranslatableText("commands.cfind.noMatch"));
2929
return 0;
3030
}
3131

32-
sendFeedback(new TranslatableComponent("commands.cfind.success", entities.size()).applyFormat(ChatFormat.BOLD));
32+
sendFeedback(new TranslatableText("commands.cfind.success", entities.size()).formatted(Formatting.BOLD));
3333
for (Entity entity : entities) {
3434
double distance = Math.sqrt(entity.squaredDistanceTo(source.getPosition()));
35-
sendFeedback(new TranslatableComponent("commands.cfind.found.left", entity.getName(), distance)
35+
sendFeedback(new TranslatableText("commands.cfind.found.left", entity.getName(), distance)
3636
.append(getCoordsTextComponent(new BlockPos(entity)))
37-
.append(new TranslatableComponent("commands.cfind.found.right", entity.getName(), distance)));
37+
.append(new TranslatableText("commands.cfind.found.right", entity.getName(), distance)));
3838
}
3939

4040
return entities.size();

0 commit comments

Comments
 (0)