private void spawnResources(ResourceType rt, int count, int level) {
        Point p;
        int y;
        for (int i = 0; i < count; i++) {
            p = rt.getNewXY(gameController.getMapWidth(), level);
            if (p.x > 0 && p.y > 0) {
                Resource r = new Resource(registry, this, rt, p.x, p.y, 0);
                y = findNextFloor(p.x + r.getWidth(), p.y, r.getHeight());
                if (p.y == y) {
                    //make sure the resource isn't spawned in view
                    if (this.isInPlayerView(p) || this.isInFrontOfPlaceable(r.getPerimeter())) {
                        r = null;
                    } else {
                        registerResource(r);
                        if (gameController.multiplayerMode == gameController.multiplayerMode.SERVER && registry.getNetworkThread() != null) {
                            if (registry.getNetworkThread().readyForUpdates()) {
                                registry.getNetworkThread().sendData(r);
                            }
                        }
                    }
                }
            }
        }
    }