Search in sources :

Example 1 with MCVersion

use of com.seedfinding.mccore.version.MCVersion in project SeedcrackerX by 19MisterX98.

the class TimeMachine method pokeBiomes.

protected boolean pokeBiomes() {
    if (this.structureSeeds.isEmpty() || this.worldSeeds.size() == 1)
        return false;
    if (this.structureSeeds.size() > 1000)
        return false;
    Log.debug("====================================");
    worldSeeds.clear();
    dataStorage.baseSeedData.dump();
    if (Config.get().getVersion().isNewerOrEqualTo(MCVersion.v1_18) && dataStorage.getDecoratorBits() > 32F) {
        Log.warn("tmachine.decoratorWorldSeedSearch");
        ChunkRandom rand = new ChunkRandom(new Xoroshiro128PlusPlusRandom(0));
        for (long structureSeed : this.structureSeeds) {
            for (long upperBits = 0; upperBits < 1 << 16 && !this.shouldTerminate; upperBits++) {
                long worldSeed = (upperBits << 48) | structureSeed;
                boolean matches = true;
                for (DataStorage.Entry<Feature.Data<?>> e : this.dataStorage.baseSeedData.getBaseSet()) {
                    if (e.data.feature instanceof Decorator && !((Decorator.Data<?>) e.data).testStart(worldSeed, rand)) {
                        matches = false;
                        break;
                    }
                }
                if (matches) {
                    this.worldSeeds.add(worldSeed);
                    if (this.worldSeeds.size() < 10) {
                        Log.printSeed("tmachine.foundWorldSeed", worldSeed);
                        if (this.worldSeeds.size() == 9) {
                            Log.warn("tmachine.printSeedsInConsole");
                        }
                    } else {
                        System.out.println("Found world seed " + worldSeed);
                    }
                }
                if (this.shouldTerminate) {
                    return false;
                }
            }
        }
        if (!this.worldSeeds.isEmpty()) {
            Log.warn("tmachine.worldSeedSearchFinished");
            return true;
        } else {
            Log.warn("finishedSearchNoResult");
        }
    }
    if (this.dataStorage.hashedSeedData != null && this.dataStorage.hashedSeedData.getHashedSeed() != 0) {
        Log.warn("tmachine.hashedSeedWorldSeedSearch");
        for (long structureSeed : this.structureSeeds) {
            WorldSeed.fromHash(structureSeed, this.dataStorage.hashedSeedData.getHashedSeed()).forEach(worldSeed -> {
                this.worldSeeds.add(worldSeed);
                Log.printSeed("tmachine.foundWorldSeed", worldSeed);
            });
            if (this.shouldTerminate) {
                return false;
            }
        }
        if (!this.worldSeeds.isEmpty()) {
            Log.warn("tmachine.worldSeedSearchFinished");
            return true;
        } else {
            this.dataStorage.hashedSeedData = null;
            Log.error("tmachine.noResultsRevertingToBiomes");
        }
    }
    this.dataStorage.biomeSeedData.dump();
    if (this.dataStorage.notEnoughBiomeData()) {
        Log.error("tmachine.moreBiomesNeeded");
        return false;
    }
    Log.warn("tmachine.biomeWorldSeedSearch", this.dataStorage.biomeSeedData.size());
    Log.warn("tmachine.fuzzyBiomeSearch");
    MCVersion version = Config.get().getVersion();
    for (long structureSeed : this.structureSeeds) {
        for (long worldSeed : StructureSeed.toRandomWorldSeeds(structureSeed)) {
            OverworldBiomeSource source = new OverworldBiomeSource(version, worldSeed);
            boolean matches = true;
            for (DataStorage.Entry<BiomeData> e : this.dataStorage.biomeSeedData) {
                if (!e.data.test(source)) {
                    matches = false;
                    break;
                }
            }
            if (matches) {
                this.worldSeeds.add(worldSeed);
                Log.printSeed("tmachine.foundWorldSeed", worldSeed);
            }
            if (this.shouldTerminate) {
                return false;
            }
        }
    }
    if (!this.worldSeeds.isEmpty())
        return true;
    if (this.structureSeeds.size() > 10)
        return false;
    Log.warn("tmachine.deepBiomeSearch");
    for (long structureSeed : this.structureSeeds) {
        for (long upperBits = 0; upperBits < 1 << 16 && !this.shouldTerminate; upperBits++) {
            long worldSeed = (upperBits << 48) | structureSeed;
            OverworldBiomeSource source = new OverworldBiomeSource(version, worldSeed);
            boolean matches = true;
            for (DataStorage.Entry<BiomeData> e : this.dataStorage.biomeSeedData) {
                if (!e.data.test(source)) {
                    matches = false;
                    break;
                }
            }
            if (matches) {
                this.worldSeeds.add(worldSeed);
                if (this.worldSeeds.size() < 10) {
                    Log.printSeed("tmachine.foundWorldSeed", worldSeed);
                    if (this.worldSeeds.size() == 9) {
                        Log.warn("tmachine.printSeedsInConsole");
                    }
                } else {
                    System.out.println("Found world seed " + worldSeed);
                }
            }
            if (this.shouldTerminate) {
                return false;
            }
        }
    }
    dispSearchEnd();
    if (!this.worldSeeds.isEmpty())
        return true;
    Log.error("tmachine.deleteBiomeInformation");
    this.dataStorage.biomeSeedData.getBaseSet().clear();
    Log.warn("tmachine.randomSeedSearch");
    for (long structureSeed : this.structureSeeds) {
        StructureSeed.toRandomWorldSeeds(structureSeed).forEach(s -> Log.printSeed("tmachine.foundWorldSeed", s));
    }
    return true;
}
Also used : Decorator(kaptainwutax.seedcrackerX.cracker.decorator.Decorator) Xoroshiro128PlusPlusRandom(net.minecraft.world.gen.random.Xoroshiro128PlusPlusRandom) MCVersion(com.seedfinding.mccore.version.MCVersion) OverworldBiomeSource(com.seedfinding.mcbiome.source.OverworldBiomeSource) BiomeData(kaptainwutax.seedcrackerX.cracker.BiomeData) BiomeData(kaptainwutax.seedcrackerX.cracker.BiomeData) ChunkRandom(net.minecraft.world.gen.random.ChunkRandom)

Example 2 with MCVersion

use of com.seedfinding.mccore.version.MCVersion in project meteor-rejects by AntiCope.

the class Seeds method setSeed.

public void setSeed(String seed) {
    if (mc.isIntegratedServerRunning())
        return;
    ServerInfo server = mc.getCurrentServerEntry();
    MCVersion ver = null;
    if (server != null)
        ver = MCVersion.fromString(server.version.asString());
    if (ver == null) {
        String targetVer = "unknown";
        if (server != null)
            targetVer = server.version.asString();
        sendInvalidVersionWarning(seed, targetVer);
        ver = MCVersion.latest();
    }
    setSeed(seed, ver);
}
Also used : MCVersion(com.seedfinding.mccore.version.MCVersion) ServerInfo(net.minecraft.client.network.ServerInfo)

Aggregations

MCVersion (com.seedfinding.mccore.version.MCVersion)2 OverworldBiomeSource (com.seedfinding.mcbiome.source.OverworldBiomeSource)1 BiomeData (kaptainwutax.seedcrackerX.cracker.BiomeData)1 Decorator (kaptainwutax.seedcrackerX.cracker.decorator.Decorator)1 ServerInfo (net.minecraft.client.network.ServerInfo)1 ChunkRandom (net.minecraft.world.gen.random.ChunkRandom)1 Xoroshiro128PlusPlusRandom (net.minecraft.world.gen.random.Xoroshiro128PlusPlusRandom)1