2022-07-28 03:57:50 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2023-07-01 20:21:13 +00:00
|
|
|
From: Video <videogamesm12@gmail.com>
|
|
|
|
Date: Mon, 28 Mar 2022 16:49:17 -0600
|
2022-07-28 03:57:50 +00:00
|
|
|
Subject: [PATCH] Reject oversized components from updating
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
2024-04-16 05:12:25 +00:00
|
|
|
index 3365aed2b67ae0e4dd0410f5190ba474f146139b..43b62a07b040b1d7d76dc8f940f35b51d1d5f868 100644
|
2022-07-28 03:57:50 +00:00
|
|
|
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
|
|
|
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
2023-09-24 21:42:28 +00:00
|
|
|
@@ -38,8 +38,9 @@ public class ComponentUtils {
|
2022-07-28 03:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
2023-07-01 20:21:13 +00:00
|
|
|
+ MutableComponent result; // Scissors
|
2022-07-28 03:57:50 +00:00
|
|
|
if (depth > 100) {
|
|
|
|
- return text.copy();
|
2023-07-01 20:21:13 +00:00
|
|
|
+ result = text.copy(); // Scissors
|
2022-07-28 03:57:50 +00:00
|
|
|
} else {
|
2024-01-18 23:05:55 +00:00
|
|
|
// Paper start - adventure; pass actual vanilla component
|
2022-11-26 04:34:27 +00:00
|
|
|
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
2023-09-24 21:42:28 +00:00
|
|
|
@@ -52,8 +53,9 @@ public class ComponentUtils {
|
2022-07-28 03:57:50 +00:00
|
|
|
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
- return mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
2023-07-01 20:21:13 +00:00
|
|
|
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth)); // Scissors
|
2022-07-28 03:57:50 +00:00
|
|
|
}
|
2023-07-01 20:21:13 +00:00
|
|
|
+ return Component.Serializer.toJson(result).length() > 65535 ? Component.empty() : result; // Scissors
|
2022-07-28 03:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|