Skip to content

Commit 6c3b6ae

Browse files
committed
Fixed #11471
1 parent 012eeab commit 6c3b6ae

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

core/src/mindustry/mod/ContentParser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ public <T> T readValue(Class<T> type, Class elementType, JsonValue jsonData, Cla
399399
T t = internalRead(type, elementType, jsonData, keyType);
400400
if(t != null && !Reflect.isWrapper(t.getClass()) && (type == null || !type.isPrimitive())){
401401
checkNullFields(t);
402-
listeners.each(hook -> hook.parsed(type, jsonData, t));
402+
if(jsonData.isObject()){
403+
listeners.each(hook -> hook.parsed(type, jsonData, t));
404+
}
403405
}
404406
return t;
405407
}

core/src/mindustry/mod/DataPatcher.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ void visit(Object object){
129129
}
130130

131131
void created(Object object, Object parent){
132+
if(object instanceof Weapon weapon){
133+
weapon.init();
134+
}else if(object instanceof Content cont){
135+
cont.init();
136+
cont.postInit();
137+
}
138+
132139
if(!Vars.headless){
133140
if(object instanceof DrawPart part && parent instanceof MappableContent cont){
134141
part.load(cont.name);
@@ -138,16 +145,9 @@ void created(Object object, Object parent){
138145
draw.load(block);
139146
}else if(object instanceof Weapon weapon){
140147
weapon.load();
141-
weapon.init();
142148
}else if(object instanceof Content cont){
143-
cont.init();
144-
cont.postInit();
145149
cont.load();
146150
}
147-
}else{
148-
if(object instanceof Weapon weapon){
149-
weapon.init();
150-
}
151151
}
152152
}
153153

0 commit comments

Comments
 (0)