-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print data component type on encoding error
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
patches/server/1048-Print-data-component-type-on-encoding-error.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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 913327c9bb937c95e487ba21cf8e2084817bbfdb..f7632a099e1c6e214b5689375889eee7d6426e67 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 = "!"; |