Merge pull request #68 from BentoBoxWorld/fewer_worlds

Make just one seed world. Implement vanilla biomes.
This commit is contained in:
tastybento 2024-03-28 22:01:08 -07:00 committed by GitHub
commit 3c74d3e5c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 1067 additions and 105 deletions

View File

@ -65,7 +65,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>2.4.0</build.version>
<build.version>2.5.0</build.version>
<sonar.projectKey>BentoBoxWorld_Boxed</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>

View File

@ -58,15 +58,12 @@ public class Boxed extends GameModeAddon {
private static final String SEED = "seed";
private static final String NETHER = "_nether";
private static final String THE_END = "_the_end";
private static final String BASE = "_base";
// Settings
private Settings settings;
private AbstractBoxedChunkGenerator worldGen;
private AbstractBoxedChunkGenerator seedBaseGen;
private BoxedSeedChunkGenerator seedGen;
private AbstractBoxedChunkGenerator netherGen;
private AbstractBoxedChunkGenerator netherSeedBaseGen;
private BoxedSeedChunkGenerator netherSeedGen;
@ -75,7 +72,6 @@ public class Boxed extends GameModeAddon {
private World seedWorld;
private final Map<World, ChunkGenerator> generatorMap = new HashMap<>();
private final Map<String, ChunkGenerator> generatorMaps = new HashMap<>();
//private World seedWorldEnd;
private BiomeProvider boxedBiomeProvider;
@Override
@ -111,22 +107,16 @@ public class Boxed extends GameModeAddon {
this.worldGen = new BoxedChunkGenerator(this);
generatorMaps.put(settings.getWorldName(), worldGen);
seedBaseGen = new BoxedSeedChunkGenerator(this, Environment.NORMAL);
generatorMaps.put(settings.getWorldName() + "/" + SEED + BASE, seedBaseGen);
seedGen = new BoxedSeedChunkGenerator(this, Environment.NORMAL,
new SeedBiomeGenerator(this, seedBaseGen));
new SeedBiomeGenerator(this));
generatorMaps.put(settings.getWorldName() + "/" + SEED, seedGen);
// Nether generators
this.netherGen = new BoxedChunkGenerator(this);
generatorMaps.put(settings.getWorldName() + NETHER, netherGen);
netherSeedBaseGen = new BoxedSeedChunkGenerator(this, Environment.NETHER);
generatorMaps.put(settings.getWorldName() + "/" + SEED + NETHER + BASE, netherSeedBaseGen); // + SEED + NETHER + BASE)
netherSeedGen = new BoxedSeedChunkGenerator(this, Environment.NETHER,
new NetherSeedBiomeGenerator(this, seedBaseGen));
new NetherSeedBiomeGenerator(this));
generatorMaps.put(settings.getWorldName() + "/" + SEED + NETHER, netherSeedGen);
return true;
@ -206,20 +196,6 @@ public class Boxed extends GameModeAddon {
private void createNether(String worldName) {
// Create vanilla seed nether world
log("Creating Boxed Seed Nether world ...");
World baseWorldNether = WorldCreator
.name(worldName + "/" + SEED + NETHER + BASE)
.generator(netherSeedBaseGen)
.environment(Environment.NETHER)
.seed(getSettings().getSeed())
.createWorld();
baseWorldNether.setDifficulty(Difficulty.PEACEFUL);
baseWorldNether.setSpawnLocation(settings.getSeedX(), 64, settings.getSeedZ());
generatorMap.put(baseWorldNether, netherSeedBaseGen);
getPlugin().getIWM().addWorld(baseWorldNether, this);
copyChunks(baseWorldNether, netherSeedBaseGen);
// Create seed world
// This copies a base world with custom biomes
log("Creating Boxed Biomed Nether world ...");
World seedWorldNether = WorldCreator
.name(worldName + "/" + SEED + NETHER)
.generator(netherSeedGen)
@ -242,21 +218,6 @@ public class Boxed extends GameModeAddon {
private void createOverWorld(String worldName) {
// Create vanilla seed world
log("Creating Boxed Seed world ...");
// This creates a vanilla base world with biomes
World baseWorld = WorldCreator
.name(worldName + "/" + SEED + BASE)
.generator(seedBaseGen)
.environment(Environment.NORMAL)
.seed(getSettings().getSeed())
.createWorld();
baseWorld.setDifficulty(Difficulty.PEACEFUL);
baseWorld.setSpawnLocation(settings.getSeedX(), 64, settings.getSeedZ());
generatorMap.put(baseWorld, seedBaseGen);
getPlugin().getIWM().addWorld(baseWorld, this);
copyChunks(baseWorld, seedBaseGen);
// Create seed world
// This copies a base world with custom biomes
log("Creating Boxed Biomed world ...");
seedWorld = WorldCreator
.name(worldName + "/" + SEED)
.generator(seedGen)

View File

@ -131,7 +131,7 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "world.max-areas")
private int maxIslands = -1;
@ConfigComment("Area height - Lowest is 5.")
@ConfigComment("Area height")
@ConfigComment("It is the y coordinate of the bedrock block in the blueprint.")
@ConfigEntry(path = "world.area-height")
private int islandHeight = 8;

View File

@ -1,10 +1,8 @@
package world.bentobox.boxed.generators.biomes;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import world.bentobox.boxed.Boxed;
import world.bentobox.boxed.generators.chunks.AbstractBoxedChunkGenerator;
/**
* Generator for the Nether seed world
@ -13,8 +11,8 @@ import world.bentobox.boxed.generators.chunks.AbstractBoxedChunkGenerator;
*/
public class NetherSeedBiomeGenerator extends AbstractSeedBiomeProvider {
public NetherSeedBiomeGenerator(Boxed boxed, AbstractBoxedChunkGenerator seedGen) {
super(boxed, Environment.NETHER, Biome.BASALT_DELTAS, seedGen);
public NetherSeedBiomeGenerator(Boxed boxed) {
super(boxed, Environment.NETHER);
}
}

View File

@ -1,10 +1,8 @@
package world.bentobox.boxed.generators.biomes;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import world.bentobox.boxed.Boxed;
import world.bentobox.boxed.generators.chunks.AbstractBoxedChunkGenerator;
/**
* Generator for the seed world
@ -13,8 +11,7 @@ import world.bentobox.boxed.generators.chunks.AbstractBoxedChunkGenerator;
*/
public class SeedBiomeGenerator extends AbstractSeedBiomeProvider {
public SeedBiomeGenerator(Boxed boxed, AbstractBoxedChunkGenerator seedGen) {
super(boxed, Environment.NORMAL, Biome.PLAINS, seedGen);
public SeedBiomeGenerator(Boxed boxed) {
super(boxed, Environment.NORMAL);
}
}

View File

@ -38,6 +38,7 @@ public abstract class AbstractBoxedChunkGenerator extends ChunkGenerator {
public AbstractBoxedChunkGenerator(Boxed addon) {
this.addon = addon;
size = (int)(addon.getSettings().getIslandDistance() / 16D); // Size is chunks
}
/**