Skip to content

Commit

Permalink
Merge pull request #633 from fixrtm/opposite-seat-bug
Browse files Browse the repository at this point in the history
fix: sitting in the driver's seat on the opposite side drives train in reverse
  • Loading branch information
anatawa12 committed Jun 10, 2023
2 parents 8bab477 + 141d9de commit 9843d2e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-SNAPSHOTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The changelog for 2.0.23 and earlier is generated by [anatawa12's fork of `auto-
### Removed

### Fixed
- Sitting in the driver's seat on the opposite side drives train in reverse `#633`

### Security

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Thanks to prepare-changelog.sh, we have some macros.
### Removed

### Fixed
- Sitting in the driver's seat on the opposite side drives train in reverse `#633`

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if (axisalignedbb == null) {
axisalignedbb = new AxisAlignedBB(-1.5D, 0.0D, -2.0D, 1.5D, 3.0D, 2.0D);
}
@@ -532,21 +531,33 @@
@@ -532,21 +531,36 @@
public void setTrainStateData(int id, byte data) {
this.setVehicleState(TrainState.getStateType(id), data);
}
Expand All @@ -25,6 +25,9 @@
public void setVehicleState(TrainState.TrainStateType type, byte data) {
- this.getResourceState().getDataMap().setInt(type.toString(), data, 3);
+ this.getResourceState().getDataMap().setInt(type.toString(), type.clap(data, this), 3);
+ if (type == TrainState.TrainStateType.Direction && data != getVehicleState(TrainState.TrainStateType.Direction)) {
+ setSpeed(-getSpeed());
+ }
}

@SideOnly(Side.CLIENT)
Expand Down

0 comments on commit 9843d2e

Please sign in to comment.