privatestaticList<BlockPos> locateStructure(Seedseed, Featurefeature, EndCityModeendCityMode, BlockPoscenter, intradius, intmaxResults) {
Dimensiondimension = getDimension(feature);
MCVersionmcVersion = seed.version;
Structure<?, ?> structure = getStructure(feature, mcVersion);
if (structure == null) returnnull;
BiomeSourcebiomeSource = BiomeSource.of(dimension, mcVersion, seed.seed);
if (!structure.isValidDimension(biomeSource.getDimension()))
returnnull;
List<BPos> structurePos = locateStructures(structure, newBPos(center.getX(), center.getY(), center.getZ()), endCityMode, radius, maxResults, newChunkRand(), biomeSource, TerrainGenerator.of(biomeSource));
returntoBlockPosList(structurePos);
}
privatestaticList<BPos> locateStructures(Structure<?, ?> structure, BPoscenter, EndCityModeendCityMode, intradius, intmaxResults, ChunkRandchunkRand, BiomeSourcesource, TerrainGeneratorterrainGenerator) {
List<BPos> result = newArrayList<>();
if (structureinstanceofEndCityendCity) {
SpiralIterator<CPos> spiralIterator = newSpiralIterator<>(newCPos(center.getX() >> 4, center.getZ() >> 4), newCPos(radius, radius), (x, y, z) -> newCPos(x, z));
StreamSupport.stream(spiralIterator.spliterator(), false)
.filter(cPos -> {
com.seedfinding.mcfeature.Feature.Data<?> data = endCity.at(cPos.getX(), cPos.getZ());
EndCityGeneratorendCityGenerator = newEndCityGenerator(source.getVersion());
returndata.testStart(source.getWorldSeed(), chunkRand)
&& data.testBiome(source)
&& data.testGenerate(terrainGenerator)
&& switch (endCityMode) {
caseOnlyHasShip -> endCityGenerator.generate(terrainGenerator, cPos) && endCityGenerator.hasShip();
caseOnlyNotShip -> endCityGenerator.generate(terrainGenerator, cPos) && !endCityGenerator.hasShip();
caseBoth -> endCityGenerator.generate(terrainGenerator, cPos);
};
})
.limit(maxResults)
.forEach(cPos -> result.add(cPos.toBlockPos().add(9, 0, 9)));
} elseif (structureinstanceofRegionStructure<?, ?> regionStructure) {
intchunkInRegion = regionStructure.getSpacing();
intregionSize = chunkInRegion * 16;
finalintborder = 30_000_000;
SpiralIterator<RPos> spiralIterator = newSpiralIterator<>(center.toRegionPos(regionSize), newBPos(-border, 0, -border).toRegionPos(regionSize), newBPos(border, 0, border).toRegionPos(regionSize), 1, (x, y, z) -> newRPos(x, z, regionSize));
StreamSupport.stream(spiralIterator.spliterator(), false)
.map(rPos -> regionStructure.getInRegion(source.getWorldSeed(), rPos.getX(), rPos.getZ(), chunkRand))
.filter(Objects::nonNull)
.filter(cPos -> (regionStructure.canSpawn(cPos, source)) && (terrainGenerator == null || regionStructure.canGenerate(cPos, terrainGenerator)))
.limit(maxResults)
.forEach(cPos -> result.add(cPos.toBlockPos().add(9, 0, 9)));
} else {
if (structureinstanceofStrongholdstrongholdStructure) {
CPoscurrentChunkPos = center.toChunkPos();
intsquaredDistance = Integer.MAX_VALUE;
for (CPosstronghold : strongholdStructure.getAllStarts(source, chunkRand)) {
if (result.size() >= maxResults) {
break;
}
intnewSquaredDistance = (currentChunkPos.getX() - stronghold.getX()) * (currentChunkPos.getX() - stronghold.getX()) + (currentChunkPos.getZ() - stronghold.getZ()) * (currentChunkPos.getZ() - stronghold.getZ());
if (newSquaredDistance < squaredDistance) {
squaredDistance = newSquaredDistance;
result.clear();
result.add(stronghold.toBlockPos().add(9, 0, 9));
}
}
} elseif (structureinstanceofMineshaftmineshaft) {
SpiralIterator<CPos> spiralIterator = newSpiralIterator<>(newCPos(center.getX() >> 4, center.getZ() >> 4), newCPos(radius, radius), (x, y, z) -> newCPos(x, z));
StreamSupport.stream(spiralIterator.spliterator(), false)
.filter(cPos -> {
com.seedfinding.mcfeature.Feature.Data<Mineshaft> data = mineshaft.at(cPos.getX(), cPos.getZ());
returndata.testStart(source.getWorldSeed(), chunkRand) && data.testBiome(source) && data.testGenerate(terrainGenerator);
})
.limit(maxResults)
.forEach(cPos -> result.add(cPos.toBlockPos().add(9, 0, 9)));
}
}
returnresult;
}
privatestaticDimensiongetDimension(Featurefeature) {
returnswitch (feature) {
caseburied_treasure -> Dimension.OVERWORLD;
casemansion -> Dimension.OVERWORLD;
casestronghold -> Dimension.OVERWORLD;
casenether_fortress -> Dimension.NETHER;
caseocean_monument -> Dimension.OVERWORLD;
casebastion_remnant -> Dimension.NETHER;
caseslime_chunk -> Dimension.OVERWORLD;
casevillage -> Dimension.OVERWORLD;
casemineshaft -> Dimension.OVERWORLD;
caseend_city -> Dimension.END;
casedesert_pyramid -> Dimension.OVERWORLD;
default -> Dimension.OVERWORLD;
};
}
privatestaticbooleancheckIfInDimension(Dimensiondimension) {
returnswitch (dimension) {
caseOVERWORLD -> (PlayerUtils.getDimension() == meteordevelopment.meteorclient.utils.world.Dimension.Overworld);
caseNETHER -> (PlayerUtils.getDimension() == meteordevelopment.meteorclient.utils.world.Dimension.Nether);
caseEND -> (PlayerUtils.getDimension() == meteordevelopment.meteorclient.utils.world.Dimension.End);
};
}
privatestaticStructure<?, ?> getStructure(Featurefeature, MCVersionversion) {
returnswitch (feature) {
caseburied_treasure -> newBuriedTreasure(version);
casemansion -> newMansion(version);
casestronghold -> newStronghold(version);
casenether_fortress -> newFortress(version);
caseocean_monument -> newMonument(version);
casebastion_remnant -> newBastionRemnant(version);
caseend_city -> newEndCity(version);
casevillage -> newVillage(version);
casemineshaft -> newMineshaft(version);
casedesert_pyramid -> newDesertPyramid(version);
default -> null;
};
}
privatestaticList<BlockPos> toBlockPosList(List<BPos> posList) {
List<BlockPos> blockPosList = newArrayList<>();
for (BPospos : posList) {
blockPosList.add(newBlockPos(pos.getX(), pos.getY(), pos.getZ()));
}
returnblockPosList;
}Seed: -3396536410594980164, Location: -3428 60-13070.
Judging from the seedMap, the location below 1.18.2 will refresh the end city, but above 1.18.2 is useless, I also tried to change the MCVersion of BiomeSource, but the result remains the same, so I suspect that it is an API problem.
Seed: -3396536410594980164, Location: -3428 60-13070.
Judging from the seedMap, the location below 1.18.2 will refresh the end city, but above 1.18.2 is useless, I also tried to change the MCVersion of BiomeSource, but the result remains the same, so I suspect that it is an API problem.