Send raw error message to client and add extra method to resolve error message.

Avoids powered-off computers showing "bus incomplete" after load.
This commit is contained in:
Florian Nücke
2022-02-13 19:11:45 +01:00
parent cb4117ad5a
commit f0a06c8929
4 changed files with 17 additions and 8 deletions

View File

@@ -185,7 +185,7 @@ public abstract class AbstractMachineTerminalScreen<T extends AbstractMachineTer
Sprites.ENERGY_BAR.drawFillY(stack, x, y, menu.getEnergy() / (float) menu.getEnergyCapacity());
}
terminalWidget.render(stack, mouseX, mouseY, menu.getVirtualMachine().getBootError());
terminalWidget.render(stack, mouseX, mouseY, menu.getVirtualMachine().getError());
}
@Override

View File

@@ -183,7 +183,7 @@ public final class ComputerRenderer implements BlockEntityRenderer<ComputerBlock
return;
}
final Component bootError = computer.getVirtualMachine().getBootError();
final Component bootError = computer.getVirtualMachine().getError();
if (bootError == null) {
return;
}

View File

@@ -126,6 +126,18 @@ public abstract class AbstractVirtualMachine implements VirtualMachine {
@Override
@Nullable
public Component getBootError() {
return bootError;
}
@Override
@OnlyIn(Dist.CLIENT)
public void setBootErrorClient(@Nullable final Component value) {
bootError = value;
}
@Override
@Nullable
public Component getError() {
switch (busState) {
case SCAN_PENDING:
case INCOMPLETE:
@@ -145,12 +157,6 @@ public abstract class AbstractVirtualMachine implements VirtualMachine {
return null;
}
@Override
@OnlyIn(Dist.CLIENT)
public void setBootErrorClient(@Nullable final Component value) {
bootError = value;
}
@Override
public void start() {
if (runState == VMRunState.RUNNING) {

View File

@@ -26,6 +26,9 @@ public interface VirtualMachine {
@OnlyIn(Dist.CLIENT)
void setBootErrorClient(@Nullable Component value);
@Nullable
Component getError();
boolean isRunning();
void start();