9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-21 16:09:19 +00:00
Files
Leaf/patches/server/0071-Don-t-throw-exception-on-missing-ResourceKey-value.patch
2024-02-29 09:31:12 -05:00

36 lines
1.9 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 718377ce91a010a48b2b4a5e59e02ee8a42107a7..1160202375d1fd50c5722524a1e0584188cb2080 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
@@ -4,7 +4,6 @@ import io.leangen.geantyref.TypeToken;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.ResourceKey;
-import org.spongepowered.configurate.serialize.SerializationException;
/**
* Use {@link RegistryHolderSerializer} for datapack-configurable things.
@@ -20,10 +19,14 @@ public final class RegistryValueSerializer<T> extends RegistryEntrySerializer<T,
}
@Override
- protected T convertFromResourceKey(ResourceKey<T> key) throws SerializationException {
+ protected T convertFromResourceKey(ResourceKey<T> key) {
final T value = this.registry().get(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
}
return value;
}