Remove no longer needed diff from adventure patch

This commit is contained in:
Jason Penilla 2023-12-12 13:44:09 -08:00
parent dc3ef2ae0f
commit 7e15d977ec
No known key found for this signature in database
GPG key ID: 0E75A301420E48F8

View file

@ -2245,33 +2245,6 @@ index 887b9fd625aa23c4ec828a175d63695f915232d3..8152420b9c3eb1bf13c012dd43505d99
+ }
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
index d3a80d0a23be762c05931ae8001d98e43cab2b4a..e0037b99838519eee5fb6f7e95ffaad252f08baf 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -1,6 +1,7 @@
package net.minecraft.network.chat;
import com.google.common.collect.Lists;
+import io.papermc.paper.adventure.AdventureComponent; // Paper
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
@@ -277,6 +278,14 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
}
public JsonElement serialize(Component ichatbasecomponent, Type type, JsonSerializationContext jsonserializationcontext) {
+ // Paper start - hack before proper nbt serialization is added
+ if (ichatbasecomponent instanceof io.papermc.paper.adventure.AdventureComponent adventure) {
+ final @Nullable Component converted = adventure.deepConvertedIfPresent();
+ if (converted == null) {
+ return net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serializeToTree(adventure.adventure$component());
+ }
+ }
+ // Paper end - hack before proper nbt serialization is added
return Component.Serializer.serialize(ichatbasecomponent);
}
}
diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java
index 49138ccda0f378b13c7f425be765876eb4026b06..ca662b668177532a73e7e309bb8b0fb3c4e310f1 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java