diff --git a/core/src/mindustry/mod/DataPatcher.java b/core/src/mindustry/mod/DataPatcher.java index 59ef36f57a..7e811ae136 100644 --- a/core/src/mindustry/mod/DataPatcher.java +++ b/core/src/mindustry/mod/DataPatcher.java @@ -180,12 +180,7 @@ public class DataPatcher{ if(object == root){ if(value instanceof JsonValue jval && jval.isObject()){ for(var child : jval){ - Object[] otherResolve = resolve(object, jval.name, null); - if(otherResolve != null && otherResolve[0] instanceof ObjectMap map && map.containsKey(child.name)){ - assign(otherResolve[0], child.name, child, (FieldData)otherResolve[1], object, field); - }else{ - Log.warn("Content not found: @.@", field, child.name); - } + assign(root, field + "." + child.name, child, null, null, null); } }else{ warn("Content '@' cannot be assigned.", field); diff --git a/tests/src/test/java/PatcherTests.java b/tests/src/test/java/PatcherTests.java index 35f9e00854..4d92900ffb 100644 --- a/tests/src/test/java/PatcherTests.java +++ b/tests/src/test/java/PatcherTests.java @@ -408,6 +408,32 @@ public class PatcherTests{ assertEquals(0, Blocks.grass.attributes.get(Attribute.heat)); } + @Test + void singleValue() throws Exception{ + Vars.state.patcher.apply(Seq.with(""" + block: { + graphite-press.craftTime: 1 + } + """)); + + assertNoWarnings(); + assertEquals(1f, ((GenericCrafter)Blocks.graphitePress).craftTime); + } + + @Test + void singleValue2() throws Exception{ + Vars.state.patcher.apply(Seq.with(""" + block: { + graphite-press: { + craftTime: 1 + } + } + """)); + + assertNoWarnings(); + assertEquals(1f, ((GenericCrafter)Blocks.graphitePress).craftTime); + } + @Test void noResolution() throws Exception{ String name = Pathfinder.class.getCanonicalName();