Remove no longer needed diff from adventure patch

This commit is contained in:
Jason Penilla 2023-12-12 13:44:09 -08:00
parent 480f2aab54
commit 342ba71d4c

View file

@ -2245,33 +2245,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -0,0 +0,0 @@
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;
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java