mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 23:47:38 +01:00
Destination display hotfix
This commit is contained in:
parent
0c6a23db83
commit
517fad7a62
1 changed files with 17 additions and 10 deletions
|
@ -332,21 +332,28 @@ public class ScheduleRuntime {
|
|||
}
|
||||
|
||||
private TrainDeparturePrediction createPrediction(int index, String destination, String currentTitle, int time) {
|
||||
if (index >= schedule.entries.size()) {
|
||||
int size = schedule.entries.size();
|
||||
if (index >= size) {
|
||||
if (!schedule.cyclic)
|
||||
return new TrainDeparturePrediction(train, time, new TextComponent(" "), destination);
|
||||
index %= schedule.entries.size();
|
||||
index %= size;
|
||||
}
|
||||
|
||||
ScheduleEntry scheduleEntry = schedule.entries.get(index);
|
||||
if (!(scheduleEntry.instruction instanceof DestinationInstruction instruction))
|
||||
return null;
|
||||
String text = currentTitle;
|
||||
if (text.isBlank()) {
|
||||
for (int i = 1; i < size; i++) {
|
||||
int j = (index + i) % size;
|
||||
ScheduleEntry scheduleEntry = schedule.entries.get(j);
|
||||
if (!(scheduleEntry.instruction instanceof DestinationInstruction instruction))
|
||||
continue;
|
||||
text = instruction.getFilter()
|
||||
.replaceAll("\\*", "")
|
||||
.trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new TrainDeparturePrediction(train, time,
|
||||
new TextComponent(currentTitle.isBlank() ? instruction.getFilter()
|
||||
.replaceAll("\\*", "")
|
||||
.trim() : currentTitle),
|
||||
destination);
|
||||
return new TrainDeparturePrediction(train, time, new TextComponent(text), destination);
|
||||
}
|
||||
|
||||
public CompoundTag write() {
|
||||
|
|
Loading…
Reference in a new issue