Skip to content

Commit

Permalink
Hell on Overworld
Browse files Browse the repository at this point in the history
- Fixed incorrect dimension data in train map sync
  • Loading branch information
simibubi committed Sep 3, 2024
1 parent 86ceb9e commit 8ca03de
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static class TrainMapSyncEntry {

// Clientside
public float[] prevPositions;
public List<ResourceKey<Level>> prevDims;

// Updated every 5 ticks
public float[] positions;
Expand Down Expand Up @@ -130,14 +131,22 @@ public void receive(FriendlyByteBuf buffer, DimensionPalette dimensionPalette, b

public void updateFrom(TrainMapSyncEntry other, boolean light) {
prevPositions = positions;
prevDims = dimensions;

positions = other.positions;
dimensions = other.dimensions;
state = other.state;
signalState = other.signalState;
fueled = other.fueled;
backwards = other.backwards;
targetStationDistance = other.targetStationDistance;

if (prevDims != null)
for (int i = 0; i < Math.min(prevDims.size(), dimensions.size()); i++)
if (prevDims.get(i) != dimensions.get(i))
for (int j = 0; j < 6; j++)
prevPositions[i * 6 + j] = positions[i * 6 + j];

if (light)
return;

Expand Down Expand Up @@ -252,7 +261,7 @@ private static TrainMapSyncEntry createEntry(MinecraftServer minecraftServer, Tr

ResourceKey<Level> carriageDim = (leadingDim == null || leadingDim != trailingDim) ? null : leadingDim;
entry.dimensions.add(carriageDim);

leadingPos = leading.getPosition(train.graph);
trailingPos = trailing.getPosition(train.graph);
}
Expand Down

0 comments on commit 8ca03de

Please sign in to comment.