Fixed #11441
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user