Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong results from getStructurePos? #22

Closed
mcbq opened this issue Oct 4, 2019 · 1 comment
Closed

Wrong results from getStructurePos? #22

mcbq opened this issue Oct 4, 2019 · 1 comment

Comments

@mcbq
Copy link

mcbq commented Oct 4, 2019

Hi

I'm trying to use getStructurePos to find a seed with an outpost near spawn, from looking at the two provided examples I've stitched together the following

#include "finders.h"
#include "generator.h"
#include "layers.h"

#include <unistd.h>

int isValidBiome(int);

int main(int argc, char *argv[])
{
    // Always initialize the biome list before starting any seed finder or
    // biome generator.
    initBiomes();

    int64_t seedStart, seedEnd;

    seedStart = 0;
    seedEnd = 100000000LL;
    StructureConfig featureConfig;

    featureConfig = OUTPOST_CONFIG;

    unsigned int range;

    int regPosX = 0;
    int regPosZ = 0;

    regPosX -= 1;
    regPosZ -= 1;

    range = 200;

    LayerStack g = setupGenerator(MC_1_13);
    int *cache = allocCache(&g.layers[L_VORONOI_ZOOM_1], range, range);

    int64_t s, base;

    Pos outpostPos;

    for (s = seedStart; s < seedEnd; s++)
    {
        base = moveStructure(s, regPosX, regPosZ);
        outpostPos = getStructurePos(featureConfig, base, 0+regPosX, 0+regPosZ);

        //Validate that position is valid biome
        if (!isValidBiome(getBiomeAtPos(g, outpostPos))) continue;

        printf("%ld\n", s);
        printf("%d\n", outpostPos.x);
        printf("%d\n", outpostPos.z);
        fflush(stdout);
    }

    freeGenerator(g);
    free(cache);
}

int isValidBiome(int biomeId) {
    int validBiomes[] = {
        plains,
        desert,
        savanna,
        taiga,
        snowy_tundra,
        snowy_taiga,
    };

    int i;
    for (i = 0; i < sizeof(validBiomes) / sizeof(int); i++) {
        if (validBiomes[i] == biomeId) {
            return 1;
        }
    }

    return 0;
}

which outputs seeds and coordinates, however I've not yet managed to find a correct set where the coordinates actually had an outpost? From looking at the quad_huts file the biomecheck seems necessary, but am I missing something else?

Thank you for your itme
Which outputs seeds

@Cubitect
Copy link
Owner

Sorry that the issues haven't been maintained well,
examples like this are in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants