Update SpawnPoint.java

In case RandomSeed is not found, try find seed in WorldGenSettings.
This commit is contained in:
Peter Koeleman 2020-08-12 13:39:29 +02:00 committed by GitHub
parent 5121ab6f01
commit bdc03e9e72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,9 +64,17 @@ public class SpawnPoint {
final IntTag spawnY = (IntTag) newData.get("SpawnY");
final IntTag spawnZ = (IntTag) newData.get("SpawnZ");
final LongTag Seed = (LongTag) newData.get("RandomSeed");
var.randomSeed = Seed.getValue();
Out.out("Seed: " + var.randomSeed); // lets output the seed, cause why not?
LongTag Seed = (LongTag) newData.get("RandomSeed");
if (Seed == null) {
CompoundTag WorldGenSettings = (CompoundTag) newData.get("WorldGenSettings");
if (WorldGenSettings != null) {
Seed = (LongTag) WorldGenSettings.getValue().get("seed");
}
}
if (Seed != null) {
var.randomSeed = Seed.getValue();
Out.out("Seed: " + var.randomSeed); // lets output the seed, cause why not?
}
final Coordinates ret =
new Coordinates(spawnX.getValue(), spawnY.getValue(), spawnZ.getValue());