From aba9ed1c6d98c421ac8d4202e654926c06a60fe0 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 13 May 2018 11:04:25 +0200 Subject: [PATCH] Fixed monitor still usable with an invalid video channel --- .../java/cr0s/warpdrive/block/detection/BlockMonitor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/cr0s/warpdrive/block/detection/BlockMonitor.java b/src/main/java/cr0s/warpdrive/block/detection/BlockMonitor.java index 7c14482b..73ea8e85 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/BlockMonitor.java +++ b/src/main/java/cr0s/warpdrive/block/detection/BlockMonitor.java @@ -2,6 +2,7 @@ package cr0s.warpdrive.block.detection; import cr0s.warpdrive.Commons; import cr0s.warpdrive.WarpDrive; +import cr0s.warpdrive.api.IVideoChannel; import cr0s.warpdrive.block.BlockAbstractContainer; import cr0s.warpdrive.data.CameraRegistryItem; import cr0s.warpdrive.render.ClientCameraHandler; @@ -69,7 +70,13 @@ public class BlockMonitor extends BlockAbstractContainer { final TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityMonitor) { + // validate video channel final int videoChannel = ((TileEntityMonitor) tileEntity).getVideoChannel(); + if ( videoChannel < IVideoChannel.VIDEO_CHANNEL_MIN + || videoChannel > IVideoChannel.VIDEO_CHANNEL_MAX ) { + Commons.addChatMessage(entityPlayer, ((TileEntityMonitor) tileEntity).getStatus()); + return true; + } // validate camera final CameraRegistryItem camera = WarpDrive.cameras.getCameraByVideoChannel(world, videoChannel);