From 6c3b6aeea5a29caa1156ad1dd495fe4010eb7c8f Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 21 Dec 2025 00:00:13 -0500 Subject: [PATCH] Fixed #11471 --- core/src/mindustry/mod/ContentParser.java | 4 +++- core/src/mindustry/mod/DataPatcher.java | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 4880f6db9a..39b812bb40 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -399,7 +399,9 @@ public class ContentParser{ T t = internalRead(type, elementType, jsonData, keyType); if(t != null && !Reflect.isWrapper(t.getClass()) && (type == null || !type.isPrimitive())){ checkNullFields(t); - listeners.each(hook -> hook.parsed(type, jsonData, t)); + if(jsonData.isObject()){ + listeners.each(hook -> hook.parsed(type, jsonData, t)); + } } return t; } diff --git a/core/src/mindustry/mod/DataPatcher.java b/core/src/mindustry/mod/DataPatcher.java index f2e3418fbd..cd3e767e39 100644 --- a/core/src/mindustry/mod/DataPatcher.java +++ b/core/src/mindustry/mod/DataPatcher.java @@ -129,6 +129,13 @@ public class DataPatcher{ } void created(Object object, Object parent){ + if(object instanceof Weapon weapon){ + weapon.init(); + }else if(object instanceof Content cont){ + cont.init(); + cont.postInit(); + } + if(!Vars.headless){ if(object instanceof DrawPart part && parent instanceof MappableContent cont){ part.load(cont.name); @@ -138,16 +145,9 @@ public class DataPatcher{ draw.load(block); }else if(object instanceof Weapon weapon){ weapon.load(); - weapon.init(); }else if(object instanceof Content cont){ - cont.init(); - cont.postInit(); cont.load(); } - }else{ - if(object instanceof Weapon weapon){ - weapon.init(); - } } }