Paper/patches/server/1043-Print-data-component-type-on-encoding-error.patch
Riley Park f17519338b
Expose server build information (#10729)
* Expose server build information

* squash patches

* final tweaks

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: masmc05 <masmc05@gmail.com>
2024-05-15 17:06:59 -07:00

25 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Thu, 9 May 2024 15:11:34 +0200
Subject: [PATCH] Print data component type on encoding error
diff --git a/src/main/java/net/minecraft/core/component/DataComponentPatch.java b/src/main/java/net/minecraft/core/component/DataComponentPatch.java
index 33340e8ebe23a1a9ce587be34551fb929c41d0fd..b8977749d35dd7343021425f477445bec470d46b 100644
--- a/src/main/java/net/minecraft/core/component/DataComponentPatch.java
+++ b/src/main/java/net/minecraft/core/component/DataComponentPatch.java
@@ -143,7 +143,13 @@ public final class DataComponentPatch {
}
private static <T> void encodeComponent(RegistryFriendlyByteBuf buf, DataComponentType<T> type, Object value) {
+ // Paper start - codec errors of random anonymous classes are useless
+ try {
type.streamCodec().encode(buf, (T) value); // CraftBukkit - decompile error
+ } catch (final Exception e) {
+ throw new RuntimeException("Error encoding component " + type, e);
+ }
+ // Paper end - codec errors of random anonymous classes are useless
}
};
private static final String REMOVED_PREFIX = "!";