-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- The root problem was that the controllers block entities are removed by Spatial IO before the blocks are, so we must ensure that the controller BE never gets queried by neighbors, otherwise a new "ghost" BE appears which causes the crash. - Also consolidated some ticking checks to make them all point to a Platform method.
- Loading branch information
1 parent
c0b0c6b
commit 27bdfdd
Showing
5 changed files
with
75 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/java/appeng/server/testplots/SpatialTestPlots.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package appeng.server.testplots; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
|
||
import appeng.core.definitions.AEBlocks; | ||
import appeng.core.definitions.AEItems; | ||
import appeng.server.testworld.PlotBuilder; | ||
|
||
public final class SpatialTestPlots { | ||
private SpatialTestPlots() { | ||
} | ||
|
||
/** | ||
* Validates that controllers inside of SCSs do not cause crashes. Regression test for | ||
* <a href="https://github.com/AppliedEnergistics/Applied-Energistics-2/issues/6990">issue 6990</a>. | ||
*/ | ||
@TestPlot("controller_inside_scs") | ||
public static void controllerInsideScs(PlotBuilder plot) { | ||
// Outer network | ||
plot.creativeEnergyCell("0 0 0"); | ||
plot.block("[1,10] 0 0", AEBlocks.SPATIAL_PYLON); | ||
plot.block("0 [1,10] 0", AEBlocks.SPATIAL_PYLON); | ||
plot.block("0 0 [1,10]", AEBlocks.SPATIAL_PYLON); | ||
plot.blockEntity("-1 0 0", AEBlocks.SPATIAL_IO_PORT, port -> { | ||
port.getInternalInventory().insertItem(0, AEItems.SPATIAL_CELL128.stack(), false); | ||
}); | ||
var leverPos = plot.leverOn(new BlockPos(-1, 0, 0), Direction.WEST); | ||
|
||
// Inner network | ||
plot.creativeEnergyCell("[4,6] 3 [4,6]"); | ||
for (int x = -1; x <= 1; ++x) { | ||
for (int y = -1; y <= 1; ++y) { | ||
for (int z = -1; z <= 1; ++z) { | ||
boolean edge = Math.abs(x) + Math.abs(y) + Math.abs(z) >= 2; | ||
if (edge) { | ||
plot.block(new BlockPos(5 + x, 5 + y, 5 + z), AEBlocks.CONTROLLER); | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Woosh! | ||
plot.test(helper -> { | ||
helper.startSequence() | ||
.thenIdle(5) | ||
.thenExecute(() -> helper.pullLever(leverPos)) | ||
.thenIdle(5) | ||
.thenSucceed(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters