Idk what I did here but it's bad

This commit is contained in:
CocoTheOwner 2021-08-14 22:23:51 +02:00
parent a65a85fb67
commit f6c42c4b53

View File

@ -443,40 +443,38 @@ public class Iris extends VolmitPlugin implements Listener {
@Override @Override
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
String dimension = IrisSettings.get().getGenerator().getDefaultWorldType();
if (id != null && !id.isEmpty()) { IrisDimension dim;
dimension = id; if (id == null || id.isEmpty()){
Iris.info("Generator ID: " + id + " requested by bukkit/plugin. Assuming IrisDimension: " + id); dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType());
} else {
dim = IrisData.loadAnyDimension(id);
} }
Iris.info("Generator ID: " + id + " requested by bukkit/plugin");
IrisDimension d = IrisData.loadAnyDimension(dimension); if (dim == null) {
if (d == null) {
Iris.warn("Unable to find dimension type " + id + " Looking for online packs..."); Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
d = IrisData.loadAnyDimension(dimension);
if (dimension == null) {
Iris.warn("Unable to find dimension type \"" + dimensionName + "\". Looking for online packs...");
Iris.proj.downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), dimensionName, true);
dimension = IrisData.loadAnyDimension(dimensionName);
if (d == null) { Iris.proj.downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
throw new RuntimeException("Can't find dimension " + dimension + "!"); dim = IrisData.loadAnyDimension(id);
if (dim == null) {
throw new RuntimeException("Can't find dimension " + id + "!");
} else { } else {
Iris.info("Resolved missing dimension, proceeding with generation."); Iris.info("Resolved missing dimension, proceeding with generation.");
} }
} }
Iris.info("Assuming IrisDimension: " + dim.getName());
IrisWorld w = IrisWorld.builder() IrisWorld w = IrisWorld.builder()
.name(worldName) .name(worldName)
.seed(RNG.r.lmax()) .seed(RNG.r.lmax())
.environment(d.getEnvironment()) .environment(dim.getEnvironment())
.worldFolder(new File(worldName)) .worldFolder(new File(worldName))
.minHeight(0) .minHeight(0)
.maxHeight(256) .maxHeight(256)
.build(); .build();
return new BukkitChunkGenerator(w, false, new File(w.worldFolder(), "iris"), dim.getName());
return new BukkitChunkGenerator(w, false, new File(w.worldFolder(), "iris"), dimension);
} }
public static void msg(String string) { public static void msg(String string) {