From 7d150811f0103be20936ed3e3dc7d7206c85e759 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Fri, 12 May 2017 02:44:08 +0200 Subject: [PATCH] Fixed #259 intermittent hyperspace jump issue --- .../block/movement/TileEntityShipController.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java index 79cfb434..7c85d103 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java @@ -121,12 +121,13 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { } private void setMode(final int mode) { - EnumShipCoreMode[] modes = EnumShipCoreMode.values(); - if (mode >= 0 && mode <= modes.length) { - this.mode = modes[mode]; - markDirty(); - if (WarpDriveConfig.LOGGING_JUMP && hasWorldObj()) { - WarpDrive.logger.info(this + " Mode set to " + this.mode + " (" + this.mode.getCode() + ")"); + for(EnumShipCoreMode enumShipCoreMode : EnumShipCoreMode.values()) { + if (enumShipCoreMode.getCode() == mode) { + this.mode = enumShipCoreMode; + markDirty(); + if (WarpDriveConfig.LOGGING_JUMP && hasWorldObj()) { + WarpDrive.logger.info(this + " Mode set to " + this.mode + " (" + this.mode.getCode() + ")"); + } } } }