From 706056b706b6114365e5e1e0dc97c87c5342d659 Mon Sep 17 00:00:00 2001 From: _Kristof_ Date: Sat, 14 Mar 2026 10:29:32 +0100 Subject: [PATCH] Make catchall always be considered last, since anything after it would otherwise be unreachable. This makes it so that you don't have to move around the catchall when trying to patch it. --- Loading/RegistryObjectType.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Loading/RegistryObjectType.cs b/Loading/RegistryObjectType.cs index b613dd0..a69566c 100644 --- a/Loading/RegistryObjectType.cs +++ b/Loading/RegistryObjectType.cs @@ -320,9 +320,10 @@ protected static void solveByType(JToken json, string codePath, API.Datastructur { throw new FormatException("Invalid value at key: " + entry.Key); } + var catchAll = jobj["*"]; foreach (var byTypeProperty in jobj) { - if (WildcardUtil.Match(byTypeProperty.Key, codePath)) + if(byTypeProperty.Key != "*" && WildcardUtil.Match(byTypeProperty.Key, codePath)) { JToken typedToken = byTypeProperty.Value; // Unnecessary to solveByType specifically on this new token's contents as we will be doing a solveByType on all the tokens in the jsonObj anyhow, after adding the propertiesToAdd if (propertiesToAdd == null) propertiesToAdd = new Dictionary(); @@ -330,6 +331,11 @@ protected static void solveByType(JToken json, string codePath, API.Datastructur break; // Replaces for first matched key only } } + if(catchAll is not null && (propertiesToAdd is null || !propertiesToAdd.ContainsKey(trueKey))) + { + propertiesToAdd ??= new Dictionary(); + propertiesToAdd.Add(trueKey, catchAll); + } if (propertiesToRemove == null) propertiesToRemove = new List(); propertiesToRemove.Add(entry.Key); }