@Override
    public void onSpawnTick(SinglePlayerGame game) {
        EntityType toSpawn = game.getEntityType(spawnID);
        Set<Location> existing = game.getEntityLocations(toSpawn);
        if (existing != null && existing.size() < cap) {
            Set<Location> entityLocations = game.getEntityLocations(this);
            for (Location loc : entityLocations) {
                if (game.getEntity(loc).getTicksLived() % rate == 0) {
                    Set<Location> emptyLocations = game.getEmptyLocations(loc.x, loc.y, 1);
                    int spawned = 0;
                    for (Location empty : emptyLocations) {
                        if (spawned + existing.size() < cap) {
                            spawned++;
                            game.spawnEntity(empty, toSpawn.spawn());
                        }
                    }
                }
            }
        }
    }