Press OK to OK
- Station UIs no longer show intermediate assembly information after the assemble button is clicked
This commit is contained in:
parent
cfbde0ab6c
commit
8d84910fb9
3 changed files with 22 additions and 11 deletions
|
@ -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<Carriage> carriages;
|
||||
public List<Integer> 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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue