mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Print data component type on encoding error
This commit is contained in:
parent
b50682ab2b
commit
aabe9f5264
1 changed files with 8 additions and 2 deletions
|
@ -9,16 +9,22 @@
|
|||
});
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, DataComponentPatch> STREAM_CODEC = new StreamCodec<RegistryFriendlyByteBuf, DataComponentPatch>() {
|
||||
public DataComponentPatch decode(RegistryFriendlyByteBuf registryfriendlybytebuf) {
|
||||
@@ -144,7 +144,7 @@
|
||||
@@ -144,7 +144,13 @@
|
||||
}
|
||||
|
||||
private static <T> void encodeComponent(RegistryFriendlyByteBuf buf, DataComponentType<T> type, Object value) {
|
||||
- type.streamCodec().encode(buf, 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 = "!";
|
||||
@@ -270,7 +270,43 @@
|
||||
@@ -270,7 +276,43 @@
|
||||
private final Reference2ObjectMap<DataComponentType<?>, Optional<?>> map = new Reference2ObjectArrayMap();
|
||||
|
||||
Builder() {}
|
||||
|
|
Loading…
Reference in a new issue