Files
SeedCracker-1.14.4/src/main/java/kaptainwutax/seedcracker/cracker/PillarData.java
T
Hykilpikonna 8db7d96727 Revert "Merge remote-tracking branch 'origin/master'"
This reverts commit 3f57818c35, reversing
changes made to 4e28f711ed.
2020-02-20 10:42:03 -05:00

46 lines
1.0 KiB
Java

package kaptainwutax.seedcracker.cracker;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class PillarData {
private List<Integer> heights;
public PillarData(List<Integer> heights) {
this.heights = heights;
}
public List<Integer> getPillarSeeds() {
List<Integer> result = new ArrayList<>();
for(int pillarSeed = 0; pillarSeed < (1 << 16); pillarSeed++) {
List<Integer> h = this.getPillarHeights(pillarSeed);
if(h.equals(heights))result.add(pillarSeed);
}
return result;
}
public List<Integer> getPillarHeights(int spikeSeed) {
List<Integer> indices = new ArrayList<>();
for (int i = 0; i < 10; i++) {
indices.add(i);
}
Collections.shuffle(indices, new Random(spikeSeed));
List<Integer> heights = new ArrayList<>();
for (Integer index: indices) {
heights.add(76 + index * 3);
}
return heights;
}
}