From ffbf1f049c79a5d1ab568bfadd7016c59034c759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sun, 27 Dec 2020 02:01:01 +0100 Subject: [PATCH] Avoid start/stop doing anything on client. --- .../java/li/cil/oc2/common/block/ComputerBlock.java | 12 +++++++++--- .../oc2/common/block/entity/ComputerTileEntity.java | 10 ++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/li/cil/oc2/common/block/ComputerBlock.java b/src/main/java/li/cil/oc2/common/block/ComputerBlock.java index 34f619e5..368e2ede 100644 --- a/src/main/java/li/cil/oc2/common/block/ComputerBlock.java +++ b/src/main/java/li/cil/oc2/common/block/ComputerBlock.java @@ -96,10 +96,16 @@ public final class ComputerBlock extends HorizontalBlock { } } } else { - if (world.isRemote()) { - openTerminalScreen(computer); + if (player.isSneaking()) { + if (!world.isRemote()) { + computer.start(); + } } else { - computer.start(); + if (world.isRemote()) { + openTerminalScreen(computer); + } else { + computer.start(); + } } } diff --git a/src/main/java/li/cil/oc2/common/block/entity/ComputerTileEntity.java b/src/main/java/li/cil/oc2/common/block/entity/ComputerTileEntity.java index 7d5a2c52..a68c3a77 100644 --- a/src/main/java/li/cil/oc2/common/block/entity/ComputerTileEntity.java +++ b/src/main/java/li/cil/oc2/common/block/entity/ComputerTileEntity.java @@ -134,6 +134,11 @@ public final class ComputerTileEntity extends AbstractTileEntity implements ITic return; } + final World world = getWorld(); + if (world == null || world.isRemote()) { + return; + } + setBootError(null); setRunState(RunState.LOADING_DEVICES); loadDevicesDelay = 0; @@ -144,6 +149,11 @@ public final class ComputerTileEntity extends AbstractTileEntity implements ITic return; } + final World world = getWorld(); + if (world == null || world.isRemote()) { + return; + } + if (runState == RunState.LOADING_DEVICES) { setRunState(RunState.STOPPED); return;