9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/paper-patches/features/0036-Don-t-throw-exception-on-missing-ResourceKey-value.patch
2025-06-03 09:49:56 +08:00

24 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Mon, 26 Feb 2024 18:51:02 -0500
Subject: [PATCH] Don't throw exception on missing ResourceKey value
diff --git a/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java
index 6831b7b72c5e1f79eff36019ca2ff56531c26df8..a1b9949c9e36770724292ea2f71f21456ae7889f 100644
--- a/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java
+++ b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java
@@ -23,7 +23,11 @@ public final class RegistryValueSerializer<T> extends RegistryEntrySerializer<T,
protected T convertFromResourceKey(ResourceKey<T> key) throws SerializationException {
final T value = this.registry().getValue(key);
if (value == null) {
- throw new SerializationException("Missing value in " + this.registry() + " with key " + key.location());
+ // Leaf start - Don't throw exception on missing ResourceKey value
+ //throw new SerializationException("Missing value in " + this.registry() + " with key " + key.location());
+ com.mojang.logging.LogUtils.getClassLogger().error("Missing value in {} with key {}", this.registry(), key.location());
+ return null;
+ // Leaf end - Don't throw exception on missing ResourceKey value
}
return value;
}