From 8d84910fb965ce57a45d08a8ae30acd8d292dc31 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Fri, 27 May 2022 16:12:46 +0200 Subject: [PATCH] Press OK to OK - Station UIs no longer show intermediate assembly information after the assemble button is clicked --- .../logistics/trains/entity/Train.java | 8 ++++---- .../edgePoint/station/AssemblyScreen.java | 19 +++++++++++++------ .../edgePoint/station/StationScreen.java | 6 +++++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/entity/Train.java b/src/main/java/com/simibubi/create/content/logistics/trains/entity/Train.java index 98541da9b..59ff8b662 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/entity/Train.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/entity/Train.java @@ -88,7 +88,10 @@ public class Train { public UUID currentStation; public boolean currentlyBackwards; + // considered for removal + @Deprecated public boolean heldForAssembly; + public boolean doubleEnded; public List carriages; public List carriageSpacing; @@ -124,7 +127,7 @@ public class Train { navigation = new Navigation(this); runtime = new ScheduleRuntime(this); - heldForAssembly = true; + heldForAssembly = false; migratingPoints = new ArrayList<>(); currentStation = null; manualSteer = SteerDirection.NONE; @@ -171,9 +174,6 @@ public class Train { return; } - if (heldForAssembly && getCurrentStation() == null) - heldForAssembly = false; - updateConductors(); runtime.tick(level); navigation.tick(level); diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/management/edgePoint/station/AssemblyScreen.java b/src/main/java/com/simibubi/create/content/logistics/trains/management/edgePoint/station/AssemblyScreen.java index 5d637c5a5..44ef04baa 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/management/edgePoint/station/AssemblyScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/management/edgePoint/station/AssemblyScreen.java @@ -65,14 +65,14 @@ public class AssemblyScreen extends AbstractStationScreen { iconTypeScroll.active = iconTypeScroll.visible = false; addRenderableWidget(iconTypeScroll); - toggleAssemblyButton = new WideIconButton(x + 83, by, AllGuiTextures.I_ASSEMBLE_TRAIN); + toggleAssemblyButton = new WideIconButton(x + 94, by, AllGuiTextures.I_ASSEMBLE_TRAIN); toggleAssemblyButton.active = false; toggleAssemblyButton.setToolTip(new TextComponent("Assemble Train")); toggleAssemblyButton.withCallback(() -> { AllPackets.channel.sendToServer(StationEditPacket.tryAssemble(te.getBlockPos())); }); - quitAssembly = new IconButton(x + 62, by, AllIcons.I_DISABLE); + quitAssembly = new IconButton(x + 73, by, AllIcons.I_DISABLE); quitAssembly.active = true; quitAssembly.setToolTip(new TextComponent("Cancel Assembly")); quitAssembly.withCallback(() -> { @@ -89,6 +89,8 @@ public class AssemblyScreen extends AbstractStationScreen { minecraft.setScreen(new StationScreen(te, station)); }); + completeAssembly.visible = false; + addRenderableWidget(toggleAssemblyButton); addRenderableWidget(quitAssembly); addRenderableWidget(completeAssembly); @@ -103,9 +105,13 @@ public class AssemblyScreen extends AbstractStationScreen { Train train = displayedTrain.get(); toggleAssemblyButton.active = te.bogeyCount > 0 || train != null; - if (train != null) + if (train != null) { + assemblyCompleted = true; + AllPackets.channel.sendToServer(StationEditPacket.configure(te.getBlockPos(), false, station.name)); + minecraft.setScreen(new StationScreen(te, station)); for (Carriage carriage : train.carriages) carriage.updateConductors(); + } } private void tickTrainDisplay() { @@ -113,7 +119,7 @@ public class AssemblyScreen extends AbstractStationScreen { Train imminentTrain = getImminent(); if (train == null) { - if (imminentTrain != null) { + if (imminentTrain != null && !imminentTrain.heldForAssembly) { displayedTrain = new WeakReference<>(imminentTrain); completeAssembly.active = true; quitAssembly.active = false; @@ -151,6 +157,7 @@ public class AssemblyScreen extends AbstractStationScreen { Train train = displayedTrain.get(); if (train != null) { + // note: the code below becomes redundant if Train.heldForAssembly is removed TrainIconType icon = train.icon; int offset = 0; int trainIconWidth = getTrainIconWidth(train); @@ -220,8 +227,8 @@ public class AssemblyScreen extends AbstractStationScreen { new TextComponent(bogeyCount == 0 ? "No Bogeys" : bogeyCount + (bogeyCount == 1 ? " Bogey" : " Bogeys")); font.draw(ms, text, x + 97 - font.width(text) / 2, y + 47, 0x7A7A7A); - font.drawWordWrap(new TextComponent("Use Train Casing on highlighted Tracks to create bogeys."), x + 28, y + 62, 134, - 0x7A7A7A); + font.drawWordWrap(new TextComponent("Use Train Casing on highlighted Tracks to create bogeys."), x + 28, y + 62, + 134, 0x7A7A7A); font.drawWordWrap(new TextComponent("Remove bogeys by breaking the block on top."), x + 28, y + 94, 134, 0x7A7A7A); font.drawWordWrap(new TextComponent("Build carriages attached to one or two bogeys each."), x + 28, y + 117, diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/management/edgePoint/station/StationScreen.java b/src/main/java/com/simibubi/create/content/logistics/trains/management/edgePoint/station/StationScreen.java index 702d4d59b..6e4afd7e6 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/management/edgePoint/station/StationScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/management/edgePoint/station/StationScreen.java @@ -347,7 +347,11 @@ public class StationScreen extends AbstractStationScreen { AllPackets.channel .sendToServer(StationEditPacket.configure(te.getBlockPos(), switchingToAssemblyMode, nameBox.getValue())); Train train = displayedTrain.get(); - if (!switchingToAssemblyMode && train != null) + if (train == null) + return; + if (switchingToAssemblyMode) + train.heldForAssembly = true; + if (!switchingToAssemblyMode) AllPackets.channel .sendToServer(new TrainEditPacket(train.id, trainNameBox.getValue(), false, train.icon.getId())); }