Skip to content

Commit 928c723

Browse files
committed
Scripting: Return raw custom destination
1 parent e5efdcd commit 928c723

1 file changed

Lines changed: 1 addition & 17 deletions

File tree

fabric/src/main/java/com/lx862/jcm/mod/network/scripting/RequestStopsDataC2SPacket.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import org.mtr.mapping.tool.PacketBufferSender;
2323
import org.mtr.mod.Init;
2424

25-
import java.util.List;
26-
2725
public class RequestStopsDataC2SPacket extends PacketHandler {
2826
private final long vehicleId;
2927
private final long sidingId;
@@ -97,7 +95,7 @@ public void runServer(MinecraftServer minecraftServer, ServerPlayerEntity server
9795
long platformId = routePlatformData.getPlatform().getId();
9896
long stationId = routePlatformData.getPlatform().area == null ? 0 : routePlatformData.getPlatform().area.getId();
9997
String destination = belongingRoute.getDestination(routePlatformIndex);
100-
String customDestination = getCustomDestination(belongingRoute.getRoutePlatforms(), routePlatformIndex);
98+
String customDestination = routePlatformData.getCustomDestination();
10199
double distance = pathData.getEndDistance();
102100

103101
VehicleDataCache.SimplifiedStop stopObject = new VehicleDataCache.SimplifiedStop(destination, customDestination, stationId, platformId, distance);
@@ -142,18 +140,4 @@ public void runServer(MinecraftServer minecraftServer, ServerPlayerEntity server
142140
}
143141
}
144142
}
145-
146-
private static String getCustomDestination(List<RoutePlatformData> routePlatformData, int index) {
147-
for(int i = Math.min(routePlatformData.size() - 1, index); i >= 0; --i) {
148-
String customDestination = (routePlatformData.get(i)).getCustomDestination();
149-
if (Route.destinationIsReset(customDestination)) {
150-
break;
151-
}
152-
153-
if (!customDestination.isEmpty()) {
154-
return customDestination;
155-
}
156-
}
157-
return "";
158-
}
159143
}

0 commit comments

Comments
 (0)