Skip to content

Instantly share code, notes, and snippets.

@zyuiop
Created December 19, 2015 14:21
Show Gist options
  • Save zyuiop/d87a483811740360a2f1 to your computer and use it in GitHub Desktop.
Save zyuiop/d87a483811740360a2f1 to your computer and use it in GitHub Desktop.
import java.util.Random;
import java.util.Scanner;
/**
* @author zyuiop
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Map seed : ");
long seed = scanner.nextLong();
System.out.print("Chunk X : ");
int x = scanner.nextInt();
System.out.print("Chunk Z : ");
int z = scanner.nextInt();
System.out.print("Spawners qty : ");
int q = scanner.nextInt();
Random random = new Random(seed);
long px = random.nextLong() / 2L * 2L + 1L;
long pz = random.nextLong() / 2L * 2L + 1L;
random.setSeed((long) x * px + (long) z * pz ^ seed);
System.out.println("Random seed : " + ((long) x * px + (long) z * pz ^ seed) + " / x randomizer : " + px + " / z randomizer : " + pz);
for (int i = 0; i < q; ++i) {
int posX = random.nextInt(16) + 8;
int posY = random.nextInt(256);
int posZ = random.nextInt(16) + 8;
System.out.println("#" + i + " : " + posX + " " + posY + " " + posZ + ". Absolute : " + (posX + 16 * x) + " " + posY + " " + (posZ + 16 * z));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment