Implement biome-specific regen

- initial biome-specific regen implementation
- RegenOptions modified to include biomeType option (null if not specified)
- Matched upstream's regen command
This commit is contained in:
IronApollo
2020-10-13 22:43:11 -04:00
parent b86e452b80
commit e6b083554b
7 changed files with 171 additions and 23 deletions

View File

@ -22,6 +22,7 @@ package com.sk89q.worldedit.world;
import com.google.auto.value.AutoValue;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.biome.BiomeType;
import java.util.OptionalLong;
import javax.annotation.Nullable;
@ -38,7 +39,7 @@ public abstract class RegenOptions {
* @return the builder
*/
public static Builder builder() {
return new AutoValue_RegenOptions.Builder().seed(OptionalLong.empty()).regenBiomes(false);
return new AutoValue_RegenOptions.Builder().seed(OptionalLong.empty()).regenBiomes(false).biomeType(null);
}
@AutoValue.Builder
@ -69,6 +70,13 @@ public abstract class RegenOptions {
*/
public abstract Builder regenBiomes(boolean regenBiomes);
/**
* Defines the {@code BiomeType} the regenerator should use for regeneration. Defaults to {@code null}.
* @param biomeType the {@code BiomeType} to be used for regeneration
* @return this builder
*/
public abstract Builder biomeType(@Nullable BiomeType biomeType);
/**
* Build the options object.
*
@ -99,4 +107,10 @@ public abstract class RegenOptions {
return isRegenBiomes();
}
@Nullable public abstract BiomeType getBiomeType();
public boolean hasBiomeType() {
return getBiomeType() != null;
}
}