Allow default to be used for IrisDimensions

This commit is contained in:
CocoTheOwner 2022-01-25 16:19:21 +01:00
parent 2ead5b3c40
commit 5f165d0a89

View File

@ -19,6 +19,7 @@
package com.volmit.iris.util.decree.handlers;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.util.collection.KList;
@ -56,13 +57,19 @@ public class DimensionHandler implements DecreeParameterHandler<IrisDimension> {
@Override
public IrisDimension parse(String in, boolean force) throws DecreeParsingException {
if(in.equalsIgnoreCase("default")) {
return parse(IrisSettings.get().getGenerator().getDefaultWorldType());
}
KList<IrisDimension> options = getPossibilities(in);
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Dimension \"" + in + "\"");
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).toList().get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}