private DroneAICC getAI() throws Exception { if (drone != null) { for (EntityAITaskEntry task : drone.getRunningTasks()) { if (task.action instanceof DroneAICC) return (DroneAICC) task.action; } } setDrone( null); // set to null in case of the drone is connected, but for some reason isn't currently // running the piece (shouldn't be possible). throw new IllegalStateException("There's no connected Drone!"); }