public void run() {

        boolean cont = true;
        while(cont) {
            try {
                sendPacket(new EntitySpawnPacket(new Entity(35, 35, 44)));

                // Sleep for 40 seconds.
                try {
                    Thread.sleep(40);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            } catch (Exception e) {
                // If encountered exception, terminate loop.
                cont = false;
            }
        }
    }