Fixed #11465
This commit is contained in:
@@ -370,10 +370,10 @@ public class DataPatcher{
|
|||||||
Reflect.set(fobj, fdata.field, fv);
|
Reflect.set(fobj, fdata.field, fv);
|
||||||
}, value, true);
|
}, value, true);
|
||||||
}else if(value instanceof JsonValue jsv && object instanceof Block bl && jsv.isObject() && field.equals("consumes")){
|
}else if(value instanceof JsonValue jsv && object instanceof Block bl && jsv.isObject() && field.equals("consumes")){
|
||||||
modifiedField(bl, "consumeBuilder", Reflect.<Seq<Consume>>get(Block.class, bl, "consumeBuilder").copy());
|
Seq<Consume> prevBuilder = Reflect.<Seq<Consume>>get(Block.class, bl, "consumeBuilder").copy();
|
||||||
modifiedField(bl, "consumers", Reflect.<Consume[]>get(Block.class, bl, "consumers"));
|
|
||||||
boolean hadItems = bl.hasItems, hadLiquids = bl.hasLiquids, hadPower = bl.hasPower, acceptedItems = bl.acceptsItems;
|
boolean hadItems = bl.hasItems, hadLiquids = bl.hasLiquids, hadPower = bl.hasPower, acceptedItems = bl.acceptsItems;
|
||||||
reset(() -> {
|
reset(() -> {
|
||||||
|
Reflect.set(Block.class, bl, "consumeBuilder", prevBuilder);
|
||||||
bl.reinitializeConsumers();
|
bl.reinitializeConsumers();
|
||||||
bl.hasItems = hadItems;
|
bl.hasItems = hadItems;
|
||||||
bl.hasLiquids = hadLiquids;
|
bl.hasLiquids = hadLiquids;
|
||||||
|
|||||||
@@ -138,6 +138,26 @@ public class PatcherTests{
|
|||||||
assertEquals(prev, reconstructor.upgrades);
|
assertEquals(prev, reconstructor.upgrades);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void consumeApply() throws Exception{
|
||||||
|
Vars.state.patcher.apply(Seq.with(
|
||||||
|
"""
|
||||||
|
block.conveyor.consumes: {power: 1}
|
||||||
|
"""
|
||||||
|
));
|
||||||
|
|
||||||
|
assertNoWarnings();
|
||||||
|
assertTrue(Blocks.conveyor.hasPower);
|
||||||
|
assertNotNull(Blocks.conveyor.consPower);
|
||||||
|
assertEquals(1, Blocks.conveyor.consumers.length);
|
||||||
|
|
||||||
|
resetAfter();
|
||||||
|
|
||||||
|
assertFalse(Blocks.conveyor.hasPower);
|
||||||
|
assertNull(Blocks.conveyor.consPower);
|
||||||
|
assertEquals(0, Blocks.conveyor.consumers.length);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void unitWeapons() throws Exception{
|
void unitWeapons() throws Exception{
|
||||||
UnitTypes.dagger.checkStats();
|
UnitTypes.dagger.checkStats();
|
||||||
|
|||||||
Reference in New Issue
Block a user