From cf9b1b21934aaefd49f6b231f6ff14d689c1d17f Mon Sep 17 00:00:00 2001 From: tterrag Date: Sun, 5 Apr 2020 00:45:59 -0400 Subject: [PATCH] Fix Tag serializing empty optionals, improve RegistryObject error msg --- patches/minecraft/net/minecraft/tags/Tag.java.patch | 2 +- src/main/java/net/minecraftforge/fml/RegistryObject.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/tags/Tag.java.patch b/patches/minecraft/net/minecraft/tags/Tag.java.patch index 1f76c5347..69fbf0f7d 100644 --- a/patches/minecraft/net/minecraft/tags/Tag.java.patch +++ b/patches/minecraft/net/minecraft/tags/Tag.java.patch @@ -34,7 +34,7 @@ - jsonobject.addProperty("replace", false); + jsonobject.addProperty("replace", replace); jsonobject.add("values", jsonarray); -+ jsonobject.add("optional", optional); ++ if (optional.size() > 0) jsonobject.add("optional", optional); return jsonobject; } diff --git a/src/main/java/net/minecraftforge/fml/RegistryObject.java b/src/main/java/net/minecraftforge/fml/RegistryObject.java index cf2d9d366..5eb2e57ea 100644 --- a/src/main/java/net/minecraftforge/fml/RegistryObject.java +++ b/src/main/java/net/minecraftforge/fml/RegistryObject.java @@ -88,7 +88,7 @@ public final class RegistryObject> impl public T get() { T ret = this.value; - Objects.requireNonNull(ret, "Registry Object not present"); + Objects.requireNonNull(ret, () -> "Registry Object not present: " + this.name); return ret; }