From 2554633c414a8093d0fb7668830223ed8f2be5cc Mon Sep 17 00:00:00 2001 From: MisterJulsen Date: Tue, 9 Apr 2024 10:11:27 +0200 Subject: [PATCH 1/7] Fixed: Crash when disassembling train --- .../block/display/AdvancedDisplayTarget.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/de/mrjulsen/crn/block/display/AdvancedDisplayTarget.java b/src/main/java/de/mrjulsen/crn/block/display/AdvancedDisplayTarget.java index 81b9f9fe..92072025 100644 --- a/src/main/java/de/mrjulsen/crn/block/display/AdvancedDisplayTarget.java +++ b/src/main/java/de/mrjulsen/crn/block/display/AdvancedDisplayTarget.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.redstone.displayLink.target.DisplayBoardTarget; import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats; import com.simibubi.create.content.trains.display.GlobalTrainDisplayData; +import com.simibubi.create.content.trains.entity.Train; import de.mrjulsen.crn.block.be.AdvancedDisplayBlockEntity; import de.mrjulsen.crn.data.DeparturePrediction; @@ -44,20 +45,24 @@ public void acceptFlapText(int line, List> text, DisplayL if (!preds.isEmpty()) { SimpleDeparturePrediction pred = preds.iterator().next(); - SimulatedTrainSchedule sched = SimpleTrainSchedule.of(TrainUtils.getTrainStopsSorted(pred.trainId(), context.blockEntity().getLevel())).simulate(TrainUtils.getTrain(pred.trainId()), 0, pred.stationName()); + Train train = TrainUtils.getTrain(pred.trainId()); + + if (train != null) { + SimulatedTrainSchedule sched = SimpleTrainSchedule.of(TrainUtils.getTrainStopsSorted(pred.trainId(), context.blockEntity().getLevel())).simulate(train, 0, pred.stationName()); - List stops = new ArrayList<>(sched.getAllStops()); - boolean foundStart = false; - - if (!stops.isEmpty()) { - for (int i = 0; i < stops.size() - 1; i++) { - TrainStop x = stops.get(i); - if (foundStart) { - stopovers.add(x.getStationAlias().getAliasName().get()); + List stops = new ArrayList<>(sched.getAllStops()); + boolean foundStart = false; + + if (!stops.isEmpty()) { + for (int i = 0; i < stops.size() - 1; i++) { + TrainStop x = stops.get(i); + if (foundStart) { + stopovers.add(x.getStationAlias().getAliasName().get()); + } + foundStart = foundStart || x.getPrediction().getStationName().equals(pred.stationName()); } - foundStart = foundStart || x.getPrediction().getStationName().equals(pred.stationName()); } - } + } } controller.setDepartureData( From 908cbb05334a798c25a0cce25bc6c5668c0bb9f2 Mon Sep 17 00:00:00 2001 From: MisterJulsen Date: Tue, 9 Apr 2024 10:31:33 +0200 Subject: [PATCH 2/7] Fixed: Color not being applied correctly --- .../crn/block/AbstractAdvancedDisplayBlock.java | 10 ++++++++++ .../ber/variants/BERPassengerInfoInformative.java | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/mrjulsen/crn/block/AbstractAdvancedDisplayBlock.java b/src/main/java/de/mrjulsen/crn/block/AbstractAdvancedDisplayBlock.java index a05dc7bc..29f23124 100644 --- a/src/main/java/de/mrjulsen/crn/block/AbstractAdvancedDisplayBlock.java +++ b/src/main/java/de/mrjulsen/crn/block/AbstractAdvancedDisplayBlock.java @@ -243,6 +243,11 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla be.setColor(dye == DyeColor.ORANGE ? 0xFF9900 : dye.getMaterialColor().col); be.notifyUpdate(); }); + + if (pLevel.isClientSide) { + blockEntity.getRenderer().update(pLevel, pPos, pState, blockEntity, EUpdateReason.BLOCK_CHANGED); + } + return InteractionResult.SUCCESS; } @@ -252,6 +257,11 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla be.setGlowing(true); be.notifyUpdate(); }); + + if (pLevel.isClientSide) { + blockEntity.getRenderer().update(pLevel, pPos, pState, blockEntity, EUpdateReason.BLOCK_CHANGED); + } + return InteractionResult.SUCCESS; } diff --git a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPassengerInfoInformative.java b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPassengerInfoInformative.java index 2795ba4e..d002d5cc 100644 --- a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPassengerInfoInformative.java +++ b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPassengerInfoInformative.java @@ -137,7 +137,7 @@ public void update(Level level, BlockPos pos, BlockState state, AdvancedDisplayB return; } - generateTitleBar(level, pos, state, blockEntity, parent); + generateTitleBar(level, pos, state, blockEntity, parent, reason); if (this.state == State.BEFORE_NEXT_STOP && this.nextConnections != null && !this.nextConnections.isEmpty()) { return; @@ -279,7 +279,7 @@ private float generateTimeLabel(Level level, BlockPos pos, BlockState state, Adv return rawTextWidth + arrowOffset; } - private void generateTitleBar(Level level, BlockPos pos, BlockState state, AdvancedDisplayBlockEntity blockEntity, AdvancedDisplayRenderInstance parent) { + private void generateTitleBar(Level level, BlockPos pos, BlockState state, AdvancedDisplayBlockEntity blockEntity, AdvancedDisplayRenderInstance parent, EUpdateReason reason) { int displayWidth = blockEntity.getXSizeScaled(); float maxWidth = displayWidth * 16 - 6 - (this.state != State.WHILE_TRAVELING && blockEntity.relativeExitDirection.get() != TrainExitSide.UNKNOWN ? 4 : 0); @@ -299,18 +299,18 @@ private void generateTitleBar(Level level, BlockPos pos, BlockState state, Advan } } - if (titleLabel != null && line.getString().equals(titleLabel.getCurrentText().getString())) { + if (titleLabel != null && line.getString().equals(titleLabel.getCurrentText().getString()) && reason == EUpdateReason.DATA_CHANGED) { return; } titleLabel = new BERText(parent.getFontUtils(), line, 0) .withIsCentered(false) .withMaxWidth(maxWidth - timeWidth, true) - .withStretchScale(0.3f, 0.5f) + .withStretchScale(0.15f, 0.25f) .withStencil(0, maxWidth - timeWidth) .withCanScroll(true, 0.5f) .withColor((0xFF << 24) | (blockEntity.getColor() & 0x00FFFFFF)) - .withPredefinedTextTransformation(new TextTransformation(3.0f, 2.5f, 0.0f, 0.5f, 0.25f)) + .withPredefinedTextTransformation(new TextTransformation(3.0f, 2.5f, 0.0f, 1, 0.25f)) .build(); } From 5177e98822fed1d14c60be35261255116732c54c Mon Sep 17 00:00:00 2001 From: MisterJulsen Date: Wed, 10 Apr 2024 18:26:36 +0200 Subject: [PATCH 3/7] Fixed: Wrong day time --- .../crn/client/ber/variants/BERPassengerInfoDetailed.java | 5 +++-- .../crn/client/ber/variants/BERPlatformDetailed.java | 2 +- .../mrjulsen/crn/client/ber/variants/BERPlatformSimple.java | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPassengerInfoDetailed.java b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPassengerInfoDetailed.java index 68166ff9..aed399a3 100644 --- a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPassengerInfoDetailed.java +++ b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPassengerInfoDetailed.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack; +import de.mrjulsen.crn.Constants; import de.mrjulsen.crn.block.be.AdvancedDisplayBlockEntity; import de.mrjulsen.crn.client.ber.AdvancedDisplayRenderInstance; import de.mrjulsen.crn.client.ber.base.BERText; @@ -150,8 +151,8 @@ private void updateDefault(Level level, BlockPos pos, BlockState state, Advanced Utils.text(blockEntity.getTrainData().trainName()).append(" ").append(Utils.text(blockEntity.getTrainData().getNextStop().get().scheduleTitle())), Utils.text("" + (int)Math.abs(Math.round(blockEntity.getTrainData().speed() * 20 * 3.6F))).append(" km/h"), isSingleBlock ? - Utils.text(TimeUtils.parseTime((int)(blockEntity.getLevel().dayTime() % 24000), ModClientConfig.TIME_FORMAT.get())) : - Utils.translate(keyDate, blockEntity.getLevel().getDayTime() / 24000, TimeUtils.parseTime((int)(blockEntity.getLevel().dayTime() % 24000), ModClientConfig.TIME_FORMAT.get())) + Utils.text(TimeUtils.parseTime((int)(blockEntity.getLevel().getDayTime() % 24000 + Constants.TIME_SHIFT), ModClientConfig.TIME_FORMAT.get())) : + Utils.translate(keyDate, blockEntity.getLevel().getDayTime() / 24000, TimeUtils.parseTime((int)(blockEntity.getLevel().dayTime() % 24000 + Constants.TIME_SHIFT), ModClientConfig.TIME_FORMAT.get())) ), 0) .withIsCentered(true) .withMaxWidth(maxWidth, true) diff --git a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformDetailed.java b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformDetailed.java index b309ac07..69d12431 100644 --- a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformDetailed.java +++ b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformDetailed.java @@ -206,7 +206,7 @@ private BERText[] addLine(Level level, BlockPos pos, BlockState state, AdvancedD public void setTimer(Level level, BlockPos pos, BlockState state, AdvancedDisplayBlockEntity blockEntity, AdvancedDisplayRenderInstance parent, EUpdateReason reason, float y) { float displayWidth = blockEntity.getXSizeScaled() * 16 - 6; - timeLabel = new BERText(parent.getFontUtils(), () -> List.of(Utils.translate(keyTime, TimeUtils.parseTime((int)(blockEntity.getLevel().getDayTime() % 24000 + 6000), ModClientConfig.TIME_FORMAT.get()))), 0) + timeLabel = new BERText(parent.getFontUtils(), () -> List.of(Utils.translate(keyTime, TimeUtils.parseTime((int)(blockEntity.getLevel().getDayTime() % 24000 + Constants.TIME_SHIFT), ModClientConfig.TIME_FORMAT.get()))), 0) .withIsCentered(true) .withMaxWidth(displayWidth, true) .withStretchScale(0.4f, 0.4f) diff --git a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformSimple.java b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformSimple.java index 0ab17ff9..2d40da80 100644 --- a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformSimple.java +++ b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformSimple.java @@ -7,6 +7,7 @@ import com.mojang.blaze3d.vertex.PoseStack; +import de.mrjulsen.crn.Constants; import de.mrjulsen.crn.block.be.AdvancedDisplayBlockEntity; import de.mrjulsen.crn.client.ber.AdvancedDisplayRenderInstance; import de.mrjulsen.crn.client.ber.base.BERText; @@ -62,8 +63,8 @@ public void update(Level level, BlockPos pos, BlockState state, AdvancedDisplayB float maxWidth = displayWidth * 16 - 6; parent.labels.add(new BERText(parent.getFontUtils(), () -> { List texts = new ArrayList<>(); - texts.add(Utils.translate(keyTime, TimeUtils.parseTime((int)(blockEntity.getLevel().getDayTime() % 24000 + 6000), ModClientConfig.TIME_FORMAT.get()))); - texts.addAll(preds.stream().map(x -> Utils.translate(keyTrainDeparture, x.trainName(), x.scheduleTitle(), TimeUtils.parseTime((int)(blockEntity.getLastRefreshedTime() % 24000 + 6000 + x.departureTicks()), ModClientConfig.TIME_FORMAT.get()), x.stationInfo().platform())).toList()); + texts.add(Utils.translate(keyTime, TimeUtils.parseTime((int)(blockEntity.getLevel().getDayTime() % 24000 + Constants.TIME_SHIFT), ModClientConfig.TIME_FORMAT.get()))); + texts.addAll(preds.stream().map(x -> Utils.translate(keyTrainDeparture, x.trainName(), x.scheduleTitle(), TimeUtils.parseTime((int)(blockEntity.getLastRefreshedTime() % 24000 + Constants.TIME_SHIFT + x.departureTicks()), ModClientConfig.TIME_FORMAT.get()), x.stationInfo().platform())).toList()); return List.of(ModUtils.concat(texts.toArray(Component[]::new))); }, 0) From 8d7f9a97f562c30c93ee632a62a40416974186b0 Mon Sep 17 00:00:00 2001 From: MisterJulsen Date: Wed, 10 Apr 2024 18:38:39 +0200 Subject: [PATCH 4/7] Fixed: Crash when station could not be found --- src/main/java/de/mrjulsen/crn/data/SimpleTrainSchedule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/mrjulsen/crn/data/SimpleTrainSchedule.java b/src/main/java/de/mrjulsen/crn/data/SimpleTrainSchedule.java index 47d9f2e1..587483be 100644 --- a/src/main/java/de/mrjulsen/crn/data/SimpleTrainSchedule.java +++ b/src/main/java/de/mrjulsen/crn/data/SimpleTrainSchedule.java @@ -232,7 +232,7 @@ public SimulatedTrainSchedule simulate(Train train, int simulationTime, String s v += cycleDuration; } return v; - }).min().getAsInt(); + }).min().orElse(0); int simToTargetTime = simulationTime + timeToTargetAfterSim; return new SimulatedTrainSchedule(getAllStops().parallelStream().map(x -> { From 0ad7d17e18b244b4e91ad3db5db9b0e019641fa5 Mon Sep 17 00:00:00 2001 From: MisterJulsen Date: Wed, 10 Apr 2024 18:38:46 +0200 Subject: [PATCH 5/7] Updated version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 70a96159..adcf90ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx6G org.gradle.daemon=false -mod_version = 0.4.0-beta +mod_version = 0.4.1-beta mod_minecraft_version = 1.18.2 mod_filename = createrailwaysnavigator mod_root_path = de.mrjulsen.crn From f4b8a6e7130ba9c1bde1a1b4a0235356fb3bded3 Mon Sep 17 00:00:00 2001 From: MisterJulsen Date: Wed, 10 Apr 2024 19:54:43 +0200 Subject: [PATCH 6/7] Fixed: Platform text is shows even there is no platform info --- .../ber/variants/BERPlatformSimple.java | 8 ++- .../overlay/RouteDetailsOverlayScreen.java | 9 ++- .../crn/event/listeners/JourneyListener.java | 70 ++++++++++++++----- .../createrailwaysnavigator/lang/de_de.json | 10 ++- .../createrailwaysnavigator/lang/en_us.json | 10 ++- 5 files changed, 82 insertions(+), 25 deletions(-) diff --git a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformSimple.java b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformSimple.java index 2d40da80..3b8521e8 100644 --- a/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformSimple.java +++ b/src/main/java/de/mrjulsen/crn/client/ber/variants/BERPlatformSimple.java @@ -28,6 +28,7 @@ public class BERPlatformSimple implements IBERRenderSubtype { private static final String keyTrainDeparture = "gui.createrailwaysnavigator.route_overview.notification.journey_begins"; + private static final String keyTrainDepartureWithPlatform = "gui.createrailwaysnavigator.route_overview.notification.journey_begins_with_platform"; private static final String keyTime = "gui.createrailwaysnavigator.time"; private Collection lastTrainOrder = new ArrayList<>(); @@ -64,7 +65,12 @@ public void update(Level level, BlockPos pos, BlockState state, AdvancedDisplayB parent.labels.add(new BERText(parent.getFontUtils(), () -> { List texts = new ArrayList<>(); texts.add(Utils.translate(keyTime, TimeUtils.parseTime((int)(blockEntity.getLevel().getDayTime() % 24000 + Constants.TIME_SHIFT), ModClientConfig.TIME_FORMAT.get()))); - texts.addAll(preds.stream().map(x -> Utils.translate(keyTrainDeparture, x.trainName(), x.scheduleTitle(), TimeUtils.parseTime((int)(blockEntity.getLastRefreshedTime() % 24000 + Constants.TIME_SHIFT + x.departureTicks()), ModClientConfig.TIME_FORMAT.get()), x.stationInfo().platform())).toList()); + texts.addAll(preds.stream().map(x -> { + if (x.stationInfo().platform() == null || x.stationInfo().platform().isBlank()) { + return Utils.translate(keyTrainDeparture, x.trainName(), x.scheduleTitle(), TimeUtils.parseTime((int)(blockEntity.getLastRefreshedTime() % 24000 + Constants.TIME_SHIFT + x.departureTicks()), ModClientConfig.TIME_FORMAT.get()), x.stationInfo().platform()); + } + return Utils.translate(keyTrainDepartureWithPlatform, x.trainName(), x.scheduleTitle(), TimeUtils.parseTime((int)(blockEntity.getLastRefreshedTime() % 24000 + Constants.TIME_SHIFT + x.departureTicks()), ModClientConfig.TIME_FORMAT.get())); + }).toList()); return List.of(ModUtils.concat(texts.toArray(Component[]::new))); }, 0) diff --git a/src/main/java/de/mrjulsen/crn/client/gui/overlay/RouteDetailsOverlayScreen.java b/src/main/java/de/mrjulsen/crn/client/gui/overlay/RouteDetailsOverlayScreen.java index a1c25634..831b58dd 100644 --- a/src/main/java/de/mrjulsen/crn/client/gui/overlay/RouteDetailsOverlayScreen.java +++ b/src/main/java/de/mrjulsen/crn/client/gui/overlay/RouteDetailsOverlayScreen.java @@ -115,6 +115,7 @@ public class RouteDetailsOverlayScreen implements IHudOverlay, IJourneyListenerC private static final String keyTrainDetails = "gui.createrailwaysnavigator.route_overview.train_details"; private static final String keyTrainSpeed = "gui.createrailwaysnavigator.route_overview.train_speed"; private static final String keyTransfer = "gui.createrailwaysnavigator.route_overview.transfer"; + private static final String keyTransferWithPlatform = "gui.createrailwaysnavigator.route_overview.transfer_with_platform"; private static final String keyTransferCount = "gui.createrailwaysnavigator.navigator.route_entry.transfer"; private static final String keyTrainCanceled = "gui.createrailwaysnavigator.route_overview.stop_canceled"; private static final String keyAfterJourney = "gui.createrailwaysnavigator.route_overview.after_journey"; @@ -356,7 +357,13 @@ private void setPageTransfer() { currentPage = Page.TRANSFER; StationEntry station = getListener().currentStation(); if (station != null) { - this.messageLabel = MultiLineLabel.create(shadowlessFont, Utils.translate(keyTransfer, + this.messageLabel = MultiLineLabel.create(shadowlessFont, + station.getInfo().platform() == null || station.getInfo().platform().isBlank() ? + Utils.translate(keyTransfer, + station.getTrain().trainName(), + station.getTrain().scheduleTitle() + ) : + Utils.translate(keyTransferWithPlatform, station.getTrain().trainName(), station.getTrain().scheduleTitle(), station.getInfo().platform() diff --git a/src/main/java/de/mrjulsen/crn/event/listeners/JourneyListener.java b/src/main/java/de/mrjulsen/crn/event/listeners/JourneyListener.java index d8794890..ee0d9883 100644 --- a/src/main/java/de/mrjulsen/crn/event/listeners/JourneyListener.java +++ b/src/main/java/de/mrjulsen/crn/event/listeners/JourneyListener.java @@ -41,8 +41,10 @@ public class JourneyListener { private boolean isStarted; private static final String keyJourneyBegins = "gui.createrailwaysnavigator.route_overview.journey_begins"; + private static final String keyJourneyBeginsWithPlatform = "gui.createrailwaysnavigator.route_overview.journey_begins_with_platform"; private static final String keyNextStop = "gui.createrailwaysnavigator.route_overview.next_stop"; private static final String keyTransfer = "gui.createrailwaysnavigator.route_overview.transfer"; + private static final String keyTransferWithPlatform = "gui.createrailwaysnavigator.route_overview.transfer_with_platform"; private static final String keyAfterJourney = "gui.createrailwaysnavigator.route_overview.after_journey"; private static final String keyJourneyInterruptedTitle = "gui.createrailwaysnavigator.route_overview.train_canceled_title"; private static final String keyJourneyInterrupted = "gui.createrailwaysnavigator.route_overview.train_canceled_info"; @@ -51,12 +53,14 @@ public class JourneyListener { private static final String keyKeybindOptions = "key.createrailwaysnavigator.route_overlay_options"; private static final String keyNotificationJourneyBeginsTitle = "gui.createrailwaysnavigator.route_overview.notification.journey_begins.title"; private static final String keyNotificationJourneyBegins = "gui.createrailwaysnavigator.route_overview.notification.journey_begins"; + private static final String keyNotificationJourneyBeginsWithPlatform = "gui.createrailwaysnavigator.route_overview.notification.journey_begins_with_platform"; private static final String keyNotificationPlatformChangedTitle = "gui.createrailwaysnavigator.route_overview.notification.platform_changed.title"; private static final String keyNotificationPlatformChanged = "gui.createrailwaysnavigator.route_overview.notification.platform_changed"; private static final String keyNotificationTrainDelayedTitle = "gui.createrailwaysnavigator.route_overview.notification.train_delayed.title"; private static final String keyNotificationTrainDelayed = "gui.createrailwaysnavigator.route_overview.notification.train_delayed"; private static final String keyNotificationTransferTitle = "gui.createrailwaysnavigator.route_overview.notification.transfer.title"; private static final String keyNotificationTransfer = "gui.createrailwaysnavigator.route_overview.notification.transfer"; + private static final String keyNotificationTransferWithPlatform = "gui.createrailwaysnavigator.route_overview.notification.transfer_with_platform"; private static final String keyNotificationConnectionEndangeredTitle = "gui.createrailwaysnavigator.route_overview.notification.connection_endangered.title"; private static final String keyNotificationConnectionEndangered = "gui.createrailwaysnavigator.route_overview.notification.connection_endangered"; private static final String keyNotificationConnectionMissedTitle = "gui.createrailwaysnavigator.route_overview.notification.connection_missed.title"; @@ -107,7 +111,13 @@ public static JourneyListener listenTo(SimpleRoute route) { } public JourneyListener start() { - Component text = Utils.translate(keyJourneyBegins, + Component text = currentStation().getInfo().platform() == null || currentStation().getInfo().platform().isBlank() ? + Utils.translate(keyJourneyBegins, + currentStation().getTrain().trainName(), + currentStation().getTrain().scheduleTitle(), + TimeUtils.parseTime((int)currentStation().getEstimatedTimeWithThreshold() + Constants.TIME_SHIFT, ModClientConfig.TIME_FORMAT.get()) + ) : + Utils.translate(keyJourneyBeginsWithPlatform, currentStation().getTrain().trainName(), currentStation().getTrain().scheduleTitle(), TimeUtils.parseTime((int)currentStation().getEstimatedTimeWithThreshold() + Constants.TIME_SHIFT, ModClientConfig.TIME_FORMAT.get()), @@ -300,12 +310,19 @@ public void tick() { Component title = Utils.translate(keyNotificationJourneyBeginsTitle, lastStation().getStationName() ); - Component description = Utils.translate(keyNotificationJourneyBegins, - currentStation().getTrain().trainName(), - currentStation().getTrain().scheduleTitle(), - TimeUtils.parseTime((int)currentStation().getEstimatedTimeWithThreshold() + Constants.TIME_SHIFT, ModClientConfig.TIME_FORMAT.get()), - currentStation().getInfo().platform() - ); + Component description = currentStation().getInfo().platform() == null || currentStation().getInfo().platform().isBlank() ? + Utils.translate(keyNotificationJourneyBegins, + currentStation().getTrain().trainName(), + currentStation().getTrain().scheduleTitle(), + TimeUtils.parseTime((int)currentStation().getEstimatedTimeWithThreshold() + Constants.TIME_SHIFT, ModClientConfig.TIME_FORMAT.get()) + ) + : + Utils.translate(keyNotificationJourneyBeginsWithPlatform, + currentStation().getTrain().trainName(), + currentStation().getTrain().scheduleTitle(), + TimeUtils.parseTime((int)currentStation().getEstimatedTimeWithThreshold() + Constants.TIME_SHIFT, ModClientConfig.TIME_FORMAT.get()), + currentStation().getInfo().platform() + ); setNotificationText(new NotificationData(currentState, title, description)); setNarratorText(title.getString() + " " + description.getString()); @@ -644,18 +661,30 @@ private void announceNextStop() { currentStation().getStationName() ); if (currentStation().getTag() == StationTag.PART_END && currentStation().getIndex() + 1 < route.getStationCount(true)) { - Component transferText = textB = Utils.translate(keyTransfer, + Component transferText = textB = nextStation().get().getInfo().platform() == null || nextStation().get().getInfo().platform().isBlank() ? + Utils.translate(keyTransfer, + nextStation().get().getTrain().trainName(), + nextStation().get().getTrain().scheduleTitle() + ) : + Utils.translate(keyTransferWithPlatform, nextStation().get().getTrain().trainName(), nextStation().get().getTrain().scheduleTitle(), nextStation().get().getInfo().platform() ); text = ModUtils.concat(text, transferText); setState(State.BEFORE_TRANSFER); - setNotificationText(new NotificationData(currentState, Utils.translate(keyNotificationTransferTitle), Utils.translate(keyNotificationTransfer, - nextStation().get().getTrain().trainName(), - nextStation().get().getTrain().scheduleTitle(), - nextStation().get().getInfo().platform() - ))); + setNotificationText(new NotificationData(currentState, Utils.translate(keyNotificationTransferTitle), + nextStation().get().getInfo().platform() == null || nextStation().get().getInfo().platform().isBlank() ? + Utils.translate(keyNotificationTransfer, + nextStation().get().getTrain().trainName(), + nextStation().get().getTrain().scheduleTitle() + ) : + Utils.translate(keyNotificationTransferWithPlatform, + nextStation().get().getTrain().trainName(), + nextStation().get().getTrain().scheduleTitle(), + nextStation().get().getInfo().platform() + ) + )); } else { setState(State.BEFORE_NEXT_STOP); } @@ -689,10 +718,17 @@ private void reachNextStop() { } private void reachTransferStop() { - Component text = nextStation().isPresent() ? Utils.translate(keyTransfer, - nextStation().get().getTrain().trainName(), - nextStation().get().getTrain().scheduleTitle(), - nextStation().get().getInfo().platform() + Component text = nextStation().isPresent() ? ( + nextStation().get().getInfo().platform() == null || nextStation().get().getInfo().platform().isBlank() ? + Utils.translate(keyTransfer, + nextStation().get().getTrain().trainName(), + nextStation().get().getTrain().scheduleTitle() + ) : + Utils.translate(keyTransferWithPlatform, + nextStation().get().getTrain().trainName(), + nextStation().get().getTrain().scheduleTitle(), + nextStation().get().getInfo().platform() + ) ) : Utils.emptyText(); String narratorText = text.getString(); diff --git a/src/main/resources/assets/createrailwaysnavigator/lang/de_de.json b/src/main/resources/assets/createrailwaysnavigator/lang/de_de.json index b0ac96ba..0de57c43 100644 --- a/src/main/resources/assets/createrailwaysnavigator/lang/de_de.json +++ b/src/main/resources/assets/createrailwaysnavigator/lang/de_de.json @@ -87,11 +87,13 @@ "gui.createrailwaysnavigator.route_details.save_route": "Route speichern", "gui.createrailwaysnavigator.route_overview.title": "Streckendetails", - "gui.createrailwaysnavigator.route_overview.journey_begins": "Ihre Reise beginnt! %s nach %s, Abfahrt %s von Gleis %s", + "gui.createrailwaysnavigator.route_overview.journey_begins": "Ihre Reise beginnt! %s nach %s, Abfahrt %s", + "gui.createrailwaysnavigator.route_overview.journey_begins_with_platform": "Ihre Reise beginnt! %s nach %s, Abfahrt %s von Gleis %s", "gui.createrailwaysnavigator.route_overview.train_details": "%s nach %s", "gui.createrailwaysnavigator.route_overview.train_speed": "%s km/h", "gui.createrailwaysnavigator.route_overview.next_stop": "Nächster Halt: %s", - "gui.createrailwaysnavigator.route_overview.transfer": "Umstieg in %s → %s auf Gleis %s", + "gui.createrailwaysnavigator.route_overview.transfer": "Umstieg in %s → %s", + "gui.createrailwaysnavigator.route_overview.transfer_with_platform": "Umstieg in %s → %s auf Gleis %s", "gui.createrailwaysnavigator.route_overview.journey_completed": "Reise abgeschlossen", "gui.createrailwaysnavigator.route_overview.after_journey": "Sie haben %s erreicht. Wir bedanken uns für Ihre Reise und wünschen einen schönen Tag.", "gui.createrailwaysnavigator.route_overview.next_connections": "Nächste Anschlüsse", @@ -109,7 +111,8 @@ "gui.createrailwaysnavigator.route_overview.journey_interrupted_info": "Ihre Reise nach %s kann nicht fortgesetzt werden. Suchen Sie nach einer Alternative im Navigator.", "gui.createrailwaysnavigator.route_overview.options": "Drücke %s für Optionen.", "gui.createrailwaysnavigator.route_overview.notification.journey_begins.title": "Ihre Reise nach %s beginnt!", - "gui.createrailwaysnavigator.route_overview.notification.journey_begins": "%s nach %s, Abfahrt %s von Gleis %s", + "gui.createrailwaysnavigator.route_overview.notification.journey_begins": "%s nach %s, Abfahrt %s", + "gui.createrailwaysnavigator.route_overview.notification.journey_begins_with_platform": "%s nach %s, Abfahrt %s von Gleis %s", "gui.createrailwaysnavigator.route_overview.notification.platform_changed.title": "Ihr Gleis hat sich geändert!", "gui.createrailwaysnavigator.route_overview.notification.platform_changed": "Ihr Zug in %s fährt heute von Gleis %s ab.", "gui.createrailwaysnavigator.route_overview.notification.train_delayed.title": "%s: Ankunft %s verspätet.", @@ -118,6 +121,7 @@ "gui.createrailwaysnavigator.route_overview.notification.train_canceled": "%s nach %s fällt heute aus.", "gui.createrailwaysnavigator.route_overview.notification.transfer.title": "Ihr Umstieg steht bevor", "gui.createrailwaysnavigator.route_overview.notification.transfer": "Steigen Sie in %s → %s auf Gleis %s um", + "gui.createrailwaysnavigator.route_overview.notification.transfer_with_platform": "Steigen Sie in %s → %s um", "gui.createrailwaysnavigator.route_overview.notification.connection_endangered.title": "Ihr Anschluss ist gefährdet!", "gui.createrailwaysnavigator.route_overview.notification.connection_endangered": "Sie werden voraussichtlich Ihren Anschluss %s nach %s nicht erreichen.", "gui.createrailwaysnavigator.route_overview.notification.connection_missed.title": "Anschluss verpasst", diff --git a/src/main/resources/assets/createrailwaysnavigator/lang/en_us.json b/src/main/resources/assets/createrailwaysnavigator/lang/en_us.json index 2b2efeaf..13f99f09 100644 --- a/src/main/resources/assets/createrailwaysnavigator/lang/en_us.json +++ b/src/main/resources/assets/createrailwaysnavigator/lang/en_us.json @@ -87,11 +87,13 @@ "gui.createrailwaysnavigator.route_details.save_route": "Save Connection", "gui.createrailwaysnavigator.route_overview.title": "Route Details", - "gui.createrailwaysnavigator.route_overview.journey_begins": "Your journey begins! %s to %s, departure %s on platform %s", + "gui.createrailwaysnavigator.route_overview.journey_begins": "Your journey begins! %s to %s, departure %s", + "gui.createrailwaysnavigator.route_overview.journey_begins_with_platform": "Your journey begins! %s to %s, departure %s on platform %s", "gui.createrailwaysnavigator.route_overview.train_details": "%s to %s", "gui.createrailwaysnavigator.route_overview.train_speed": "%s km/h", "gui.createrailwaysnavigator.route_overview.next_stop": "Next Stop: %s", - "gui.createrailwaysnavigator.route_overview.transfer": "Change to %s → %s on platform %s", + "gui.createrailwaysnavigator.route_overview.transfer": "Change to %s → %s", + "gui.createrailwaysnavigator.route_overview.transfer_with_platform": "Change to %s → %s on platform %s", "gui.createrailwaysnavigator.route_overview.journey_completed": "Journey completed", "gui.createrailwaysnavigator.route_overview.after_journey": "You have reached %s. Thank you for traveling and have a nice day.", "gui.createrailwaysnavigator.route_overview.next_connections": "Next connections", @@ -109,7 +111,8 @@ "gui.createrailwaysnavigator.route_overview.journey_interrupted_info": "Your journey to %s cannot be continued. Search for an alternative in the navigator.", "gui.createrailwaysnavigator.route_overview.options": "Press %s for options.", "gui.createrailwaysnavigator.route_overview.notification.journey_begins.title": "Your journey to %s begins!", - "gui.createrailwaysnavigator.route_overview.notification.journey_begins": "%s to %s, departure %s from platform %s", + "gui.createrailwaysnavigator.route_overview.notification.journey_begins": "%s to %s, departure %s", + "gui.createrailwaysnavigator.route_overview.notification.journey_begins_with_platform": "%s to %s, departure %s from platform %s", "gui.createrailwaysnavigator.route_overview.notification.platform_changed.title": "Your platform has changed!", "gui.createrailwaysnavigator.route_overview.notification.platform_changed": "Your train in %s leaves from platform %s today.", "gui.createrailwaysnavigator.route_overview.notification.train_delayed.title": "%s: Arrival %s delayed.", @@ -118,6 +121,7 @@ "gui.createrailwaysnavigator.route_overview.notification.train_canceled": "%s to %s is canceled today.", "gui.createrailwaysnavigator.route_overview.notification.transfer.title": "Transfer is coming", "gui.createrailwaysnavigator.route_overview.notification.transfer": "Change to %s → %s on platform %s", + "gui.createrailwaysnavigator.route_overview.notification.transfer_with_platform": "Change to %s → %s on platform %s", "gui.createrailwaysnavigator.route_overview.notification.connection_endangered.title": "Your connection is endangered!", "gui.createrailwaysnavigator.route_overview.notification.connection_endangered": "You probably won't be able to reach %s to %s.", "gui.createrailwaysnavigator.route_overview.notification.connection_missed.title": "Missed connection", From 617737d2a2de0600c46a8e219cafadc9982f90f7 Mon Sep 17 00:00:00 2001 From: MisterJulsen Date: Thu, 11 Apr 2024 19:52:23 +0200 Subject: [PATCH 7/7] Updated version --- update.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update.json b/update.json index e84b99cc..35faa06c 100644 --- a/update.json +++ b/update.json @@ -1,7 +1,7 @@ { "promos": { - "1.18.2-latest": "0.4.0-1.18.2", - "1.18.2-recommended": "0.4.0-1.18.2" + "1.18.2-latest": "0.4.1-1.18.2", + "1.18.2-recommended": "0.4.1-1.18.2" }, "homepage": "https://www.curseforge.com/minecraft/mc-mods/create-railways-navigator" } \ No newline at end of file