Declare copper rails through AstraPlus and simplify train state
This commit is contained in:
+8
-5
@@ -17,6 +17,7 @@ import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
import online.astradev.content.train.*;
|
||||
import online.astradev.content.transport.SlimeBounce;
|
||||
import online.astradev.plus.api.BlockLine;
|
||||
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
@@ -108,6 +109,7 @@ final class TrainVerification {
|
||||
require(data.links().isEmpty(), "side cannot attach");
|
||||
click(level, a, Items.IRON_CHAIN, new Vec3(.49, .2, 0));
|
||||
require(data.links().size() == 1, "front auto couples");
|
||||
require(Trains.connected(a, b), "connected component after coupling");
|
||||
require(player.getMainHandItem().getCount() == 7, "one chain consumed");
|
||||
click(level, a, Items.IRON_CHAIN, new Vec3(.49, .2, 0));
|
||||
require(
|
||||
@@ -116,13 +118,14 @@ final class TrainVerification {
|
||||
Trains.show(level);
|
||||
Trains.show(level);
|
||||
require(
|
||||
level.getEntitiesOfClass(ChainDisplay.class, a.getBoundingBox().inflate(5)).size()
|
||||
level.getEntitiesOfClass(BlockLine.class, a.getBoundingBox().inflate(5)).size()
|
||||
== 1,
|
||||
"one visible vanilla chain");
|
||||
int drops =
|
||||
level.getEntitiesOfClass(ItemEntity.class, a.getBoundingBox().inflate(5)).size();
|
||||
click(level, b, Items.IRON_PICKAXE, new Vec3(-.49, .2, 0));
|
||||
require(data.links().isEmpty(), "detach from opposite end");
|
||||
require(!Trains.connected(a, b), "component cache invalidated after uncoupling");
|
||||
require(
|
||||
level.getEntitiesOfClass(ItemEntity.class, a.getBoundingBox().inflate(5)).size()
|
||||
== drops + 1,
|
||||
@@ -176,7 +179,7 @@ final class TrainVerification {
|
||||
var carts = new ArrayList<Minecart>();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
var c = cart(level, path.get(1 + i * 2).pos(), direction(turn, .5));
|
||||
((CartFrame) c).astracontent$front(direction(turn, 1));
|
||||
CouplingGeometry.restoreFront(c, direction(turn, 1));
|
||||
carts.add(c);
|
||||
}
|
||||
link(level, carts.get(0), carts.get(1));
|
||||
@@ -253,7 +256,7 @@ final class TrainVerification {
|
||||
.subtract(Vec3.atCenterOf(positions.get(i)))
|
||||
.normalize();
|
||||
var c = cart(level, positions.get(i), dir.scale(.3));
|
||||
((CartFrame) c).astracontent$front(dir);
|
||||
CouplingGeometry.restoreFront(c, dir);
|
||||
carts.add(c);
|
||||
}
|
||||
for (int i = 0; i < carts.size() - 1; i++) link(level, carts.get(i), carts.get(i + 1));
|
||||
@@ -333,7 +336,7 @@ final class TrainVerification {
|
||||
var direction = direction(turn, 1);
|
||||
for (int x = 4; x <= 8; x += 2) {
|
||||
var c = cart(level, at(x, 0, 0, turn), direction);
|
||||
((CartFrame) c).astracontent$front(direction);
|
||||
CouplingGeometry.restoreFront(c, direction);
|
||||
carts.add(c);
|
||||
}
|
||||
link(level, carts.get(0), carts.get(1));
|
||||
@@ -385,7 +388,7 @@ final class TrainVerification {
|
||||
require(a != null && b != null && Trains.connected(a, b), "saved train restored");
|
||||
Trains.show(level);
|
||||
require(
|
||||
level.getEntitiesOfClass(ChainDisplay.class, a.getBoundingBox().inflate(5)).size()
|
||||
level.getEntitiesOfClass(BlockLine.class, a.getBoundingBox().inflate(5)).size()
|
||||
== 1,
|
||||
"one chain recreated after restart");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user