Skip to content

Instantly share code, notes, and snippets.

Created January 19, 2021 16:23
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mjtb49/97a499f97fd2af0664f921194a30b495 to your computer and use it in GitHub Desktop.
* An example to show basic functionality of KaptainWutax's libraries
* and common usage patterns.
import kaptainwutax.biomeutils.source.OverworldBiomeSource;
import kaptainwutax.featureutils.structure.Village;
public class HelloWorldVillage {
final static Village village = new Village(MCVersion.v1_16_1);
final static ChunkRand rand = new ChunkRand();
public static void main(String[] args) {
boolean foundGoodSeed = false;
//loop over base seeds. The upper bound can be taken as large as 1L << 48.
for (long structureSeed = 0; structureSeed < 10000; structureSeed++) {
//Will the village try and spawn at 0 0
if (village.getInRegion(structureSeed,0,0,rand).equals(CPos.ZERO))
//Are the biomes good at 0 0
if (village.canSpawn(0, 0,
new OverworldBiomeSource(MCVersion.v1_16_1, structureSeed))){
//Below commented code takes advantage of the sister seed fact to find a sister seed
//having valid biome
/*if (village.getInRegion(structureSeed,0,0,rand).equals(CPos.ZERO)) {
//Loop over possible upper bits of the seed
for (long upperBits = 0; upperBits < 1 << 16; upperBits++) {
//seed will have the same structure attemps as structureSeed but different biomes
long seed = (upperBits << 48) | structureSeed;
//check if seed has good biomes at 0 0
if (village.canSpawn(0, 0,
new OverworldBiomeSource(MCVersion.v1_16_1, seed))){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment