Skip to content

Commit 3d84836

Browse files
committed
Backwards Approach
- Fixed trains acceleration edge case at low speed settings Creators-of-Create#6348
1 parent 067062c commit 3d84836

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/com/simibubi/create/content/trains/entity/Navigation.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,11 @@ public void tick(Level level) {
264264
double topSpeed = train.maxSpeed();
265265

266266
if (targetDistance < 10) {
267-
double target = topSpeed * ((targetDistance) / 10);
268-
if (target < Math.abs(train.speed)) {
269-
train.speed += (target - Math.abs(train.speed)) * .5f * speedMod;
267+
double maxApproachSpeed = topSpeed * ((targetDistance) / 10);
268+
double speedRelativeToStation = train.speed * speedMod;
269+
270+
if (speedRelativeToStation > maxApproachSpeed) {
271+
train.speed += (maxApproachSpeed - Math.abs(train.speed)) * .5f * speedMod;
270272
return;
271273
}
272274
}

0 commit comments

Comments
 (0)