mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +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) {
|
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)
|
if (!schedule.cyclic)
|
||||||
return new TrainDeparturePrediction(train, time, new TextComponent(" "), destination);
|
return new TrainDeparturePrediction(train, time, new TextComponent(" "), destination);
|
||||||
index %= schedule.entries.size();
|
index %= size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduleEntry scheduleEntry = schedule.entries.get(index);
|
String text = currentTitle;
|
||||||
if (!(scheduleEntry.instruction instanceof DestinationInstruction instruction))
|
if (text.isBlank()) {
|
||||||
return null;
|
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,
|
return new TrainDeparturePrediction(train, time, new TextComponent(text), destination);
|
||||||
new TextComponent(currentTitle.isBlank() ? instruction.getFilter()
|
|
||||||
.replaceAll("\\*", "")
|
|
||||||
.trim() : currentTitle),
|
|
||||||
destination);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag write() {
|
public CompoundTag write() {
|
||||||
|
|
Loading…
Reference in a new issue