diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayConsumer.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayConsumer.java index 8c8d76c25..8576b787c 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayConsumer.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayConsumer.java @@ -5,5 +5,8 @@ @FunctionalInterface public interface RelayConsumer { - void accept(RelayBlockEntity relayBlockEntity, BlockPos pos, BlockPos gridPos, GameTestSequence gameTestSequence); + void accept(RelayBlockEntity relayBlockEntity, + BlockPos pos, + BlockPos subnetworkPos, + GameTestSequence gameTestSequence); } diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayTest.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayTest.java index 537741208..808d172c5 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayTest.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayTest.java @@ -33,7 +33,7 @@ private RelayTest() { @GameTest(template = "empty_15x15") public static void shouldPassThrough(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -42,11 +42,11 @@ public static void shouldPassThrough(final GameTestHelper helper) { // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) - .thenWaitUntil(checkEnergyInNetwork(helper, gridPos, stored -> stored)) + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) + .thenWaitUntil(checkEnergyInNetwork(helper, subnetworkPos, stored -> stored)) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 10), new ResourceAmount(asResource(STONE), 15) )) @@ -62,7 +62,7 @@ public static void shouldPassThrough(final GameTestHelper helper) { @GameTest(template = "empty_15x15") public static void shouldNotPassThrough(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -74,9 +74,9 @@ public static void shouldNotPassThrough(final GameTestHelper helper) { // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, false)) - .thenWaitUntil(checkEnergyInNetwork(helper, gridPos, stored -> 0L)) - .thenWaitUntil(storageContainsExactly(helper, gridPos)) + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, false)) + .thenWaitUntil(checkEnergyInNetwork(helper, subnetworkPos, stored -> 0L)) + .thenWaitUntil(storageContainsExactly(helper, subnetworkPos)) .thenWaitUntil(storageContainsExactly( helper, pos, @@ -89,7 +89,7 @@ public static void shouldNotPassThrough(final GameTestHelper helper) { @GameTest(template = "empty_15x15") public static void shouldPassThroughEnergy(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -102,9 +102,9 @@ public static void shouldPassThroughEnergy(final GameTestHelper helper) { // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) - .thenWaitUntil(checkEnergyInNetwork(helper, gridPos, stored -> stored)) - .thenWaitUntil(storageContainsExactly(helper, gridPos)) + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) + .thenWaitUntil(checkEnergyInNetwork(helper, subnetworkPos, stored -> stored)) + .thenWaitUntil(storageContainsExactly(helper, subnetworkPos)) .thenWaitUntil(storageContainsExactly( helper, pos, @@ -117,7 +117,7 @@ public static void shouldPassThroughEnergy(final GameTestHelper helper) { @GameTest(template = "empty_15x15") public static void shouldPassThroughStorage(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -131,10 +131,10 @@ public static void shouldPassThroughStorage(final GameTestHelper helper) { // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 10), new ResourceAmount(asResource(STONE), 15) )) @@ -150,7 +150,7 @@ public static void shouldPassThroughStorage(final GameTestHelper helper) { @GameTest(template = "empty_15x15") public static void shouldPassThroughStorageBlocklist(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -165,10 +165,10 @@ public static void shouldPassThroughStorageBlocklist(final GameTestHelper helper // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(STONE), 15) )) .thenWaitUntil(storageContainsExactly( @@ -183,7 +183,7 @@ public static void shouldPassThroughStorageBlocklist(final GameTestHelper helper @GameTest(template = "empty_15x15") public static void shouldPassThroughStorageFuzzyBlocklist(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange final ItemStack damagedDiamondChestplate = getItemAsDamaged(DIAMOND_CHESTPLATE.getDefaultInstance(), 500); sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { @@ -203,10 +203,10 @@ public static void shouldPassThroughStorageFuzzyBlocklist(final GameTestHelper h // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 10), new ResourceAmount(asResource(STONE), 15) )) @@ -224,7 +224,7 @@ public static void shouldPassThroughStorageFuzzyBlocklist(final GameTestHelper h @GameTest(template = "empty_15x15") public static void shouldPassThroughStorageAllowlist(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -240,10 +240,10 @@ public static void shouldPassThroughStorageAllowlist(final GameTestHelper helper // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 10) )) .thenWaitUntil(storageContainsExactly( @@ -258,7 +258,7 @@ public static void shouldPassThroughStorageAllowlist(final GameTestHelper helper @GameTest(template = "empty_15x15") public static void shouldPassThroughStorageFuzzyAllowlist(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange final ItemStack damagedDiamondChestplate = getItemAsDamaged(DIAMOND_CHESTPLATE.getDefaultInstance(), 500); sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { @@ -278,10 +278,10 @@ public static void shouldPassThroughStorageFuzzyAllowlist(final GameTestHelper h // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIAMOND_CHESTPLATE), 1), new ResourceAmount(asResource(damagedDiamondChestplate), 1) )) @@ -299,7 +299,7 @@ public static void shouldPassThroughStorageFuzzyAllowlist(final GameTestHelper h @GameTest(template = "empty_15x15") public static void shouldPassThroughStorageAndInsertExtract(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -314,12 +314,12 @@ public static void shouldPassThroughStorageAndInsertExtract(final GameTestHelper // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) - .thenWaitUntil(networkIsAvailable(helper, gridPos, network -> + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) + .thenWaitUntil(networkIsAvailable(helper, subnetworkPos, network -> insert(helper, network, DIRT, 10))) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 20), new ResourceAmount(asResource(STONE), 15) )) @@ -329,11 +329,11 @@ public static void shouldPassThroughStorageAndInsertExtract(final GameTestHelper new ResourceAmount(asResource(DIRT), 20), new ResourceAmount(asResource(STONE), 15) )) - .thenWaitUntil(networkIsAvailable(helper, gridPos, network -> + .thenWaitUntil(networkIsAvailable(helper, subnetworkPos, network -> extract(helper, network, DIRT, 10))) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 10), new ResourceAmount(asResource(STONE), 15) )) @@ -349,7 +349,7 @@ public static void shouldPassThroughStorageAndInsertExtract(final GameTestHelper @GameTest(template = "empty_15x15") public static void shouldPassThroughStorageAndInsert(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -364,12 +364,12 @@ public static void shouldPassThroughStorageAndInsert(final GameTestHelper helper // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) - .thenWaitUntil(networkIsAvailable(helper, gridPos, network -> + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) + .thenWaitUntil(networkIsAvailable(helper, subnetworkPos, network -> insert(helper, network, DIRT, 10))) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 20), new ResourceAmount(asResource(STONE), 15) )) @@ -379,11 +379,11 @@ public static void shouldPassThroughStorageAndInsert(final GameTestHelper helper new ResourceAmount(asResource(DIRT), 20), new ResourceAmount(asResource(STONE), 15) )) - .thenWaitUntil(networkIsAvailable(helper, gridPos, network -> + .thenWaitUntil(networkIsAvailable(helper, subnetworkPos, network -> extract(helper, network, DIRT, 10, false))) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 20), new ResourceAmount(asResource(STONE), 15) )) @@ -399,7 +399,7 @@ public static void shouldPassThroughStorageAndInsert(final GameTestHelper helper @GameTest(template = "empty_15x15") public static void shouldPassThroughStorageAndExtract(final GameTestHelper helper) { - RelayTestPlots.preparePlot(helper, (relay, pos, gridPos, sequence) -> { + RelayTestPlots.preparePlot(helper, (relay, pos, subnetworkPos, sequence) -> { // Arrange sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> { insert(helper, network, DIRT, 10); @@ -414,12 +414,12 @@ public static void shouldPassThroughStorageAndExtract(final GameTestHelper helpe // Assert sequence - .thenWaitUntil(() -> checkBlockEntityActiveness(helper, gridPos, true)) - .thenWaitUntil(networkIsAvailable(helper, gridPos, network -> + .thenWaitUntil(() -> checkBlockEntityActiveness(helper, subnetworkPos, true)) + .thenWaitUntil(networkIsAvailable(helper, subnetworkPos, network -> insert(helper, network, DIRT, 10, false))) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(DIRT), 10), new ResourceAmount(asResource(STONE), 15) )) @@ -429,11 +429,11 @@ public static void shouldPassThroughStorageAndExtract(final GameTestHelper helpe new ResourceAmount(asResource(DIRT), 10), new ResourceAmount(asResource(STONE), 15) )) - .thenWaitUntil(networkIsAvailable(helper, gridPos, network -> + .thenWaitUntil(networkIsAvailable(helper, subnetworkPos, network -> extract(helper, network, DIRT, 10))) .thenWaitUntil(storageContainsExactly( helper, - gridPos, + subnetworkPos, new ResourceAmount(asResource(STONE), 15) )) .thenWaitUntil(storageContainsExactly( diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayTestPlots.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayTestPlots.java index 236a18bd6..22a91c089 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayTestPlots.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/networking/RelayTestPlots.java @@ -26,13 +26,13 @@ static void preparePlot(final GameTestHelper helper, final BlockPos relayPos = ZERO.above().above().above(); helper.setBlock(relayPos, RSBLOCKS.getRelay().getDefault().rotated(Direction.UP)); - final BlockPos gridPos = relayPos.above(); - helper.setBlock(gridPos, RSBLOCKS.getGrid().getDefault()); + final BlockPos subnetworkPos = relayPos.above(); + helper.setBlock(subnetworkPos, RSBLOCKS.getGrid().getDefault()); consumer.accept( requireBlockEntity(helper, relayPos, RelayBlockEntity.class), relayPos, - gridPos, + subnetworkPos, helper.startSequence() ); }