mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2025-02-15 01:01:28 +01:00
WIP.
This commit is contained in:
parent
d730ba725a
commit
c7880b355d
@ -1,11 +1,7 @@
|
|||||||
package world.bentobox.boxed;
|
package world.bentobox.boxed;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.ChunkSnapshot;
|
|
||||||
import org.bukkit.Difficulty;
|
import org.bukkit.Difficulty;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -25,16 +21,13 @@ import world.bentobox.bentobox.api.configuration.WorldSettings;
|
|||||||
import world.bentobox.bentobox.api.flags.Flag;
|
import world.bentobox.bentobox.api.flags.Flag;
|
||||||
import world.bentobox.bentobox.api.flags.Flag.Mode;
|
import world.bentobox.bentobox.api.flags.Flag.Mode;
|
||||||
import world.bentobox.bentobox.api.flags.Flag.Type;
|
import world.bentobox.bentobox.api.flags.Flag.Type;
|
||||||
import world.bentobox.bentobox.blueprints.BlueprintClipboard;
|
|
||||||
import world.bentobox.bentobox.managers.RanksManager;
|
import world.bentobox.bentobox.managers.RanksManager;
|
||||||
import world.bentobox.boxed.generators.BoxedBiomeGenerator;
|
import world.bentobox.boxed.generators.BoxedBiomeGenerator;
|
||||||
import world.bentobox.boxed.generators.BoxedBlockPopulator;
|
import world.bentobox.boxed.generators.BoxedBlockPopulator;
|
||||||
import world.bentobox.boxed.generators.BoxedChunkGenerator;
|
import world.bentobox.boxed.generators.BoxedChunkGenerator;
|
||||||
import world.bentobox.boxed.generators.BoxedSeedChunkGenerator;
|
import world.bentobox.boxed.generators.BoxedSeedChunkGenerator;
|
||||||
import world.bentobox.boxed.generators.SeedBiomeGenerator;
|
|
||||||
import world.bentobox.boxed.listeners.AdvancementListener;
|
import world.bentobox.boxed.listeners.AdvancementListener;
|
||||||
import world.bentobox.boxed.listeners.EnderPearlListener;
|
import world.bentobox.boxed.listeners.EnderPearlListener;
|
||||||
import world.bentobox.boxed.listeners.NewAreaListener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main Boxed class - provides a survival game inside a box
|
* Main Boxed class - provides a survival game inside a box
|
||||||
@ -64,7 +57,7 @@ public class Boxed extends GameModeAddon {
|
|||||||
private BoxedChunkGenerator netherChunkGenerator;
|
private BoxedChunkGenerator netherChunkGenerator;
|
||||||
private World seedWorld;
|
private World seedWorld;
|
||||||
private World seedWorldNether;
|
private World seedWorldNether;
|
||||||
private World seedWorldEnd;
|
//private World seedWorldEnd;
|
||||||
private BiomeProvider boxedBiomeProvider;
|
private BiomeProvider boxedBiomeProvider;
|
||||||
private BlockPopulator boxedBlockPopulator;
|
private BlockPopulator boxedBlockPopulator;
|
||||||
|
|
||||||
@ -180,6 +173,24 @@ public class Boxed extends GameModeAddon {
|
|||||||
// Make the nether if it does not exist
|
// Make the nether if it does not exist
|
||||||
if (settings.isNetherGenerate()) {
|
if (settings.isNetherGenerate()) {
|
||||||
log("Creating Boxed Seed Nether world ...");
|
log("Creating Boxed Seed Nether world ...");
|
||||||
|
// Copy regions
|
||||||
|
/*
|
||||||
|
boolean newWorld = Bukkit.getWorld(SEED + NETHER) == null;
|
||||||
|
if (newWorld) {
|
||||||
|
// New world
|
||||||
|
File root = new File(getDataFolder(), "../../../..");
|
||||||
|
BentoBox.getInstance().logDebug("Absolute path " + root.getAbsolutePath());
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.18.18.mca", root, false, false);
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.18.19.mca", root, false, false);
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.18.20.mca", root, false, false);
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.19.18.mca", root, false, false);
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.19.19.mca", root, false, false);
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.19.20.mca", root, false, false);
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.20.18.mca", root, false, false);
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.20.19.mca", root, false, false);
|
||||||
|
this.saveResource("worlds/seed_nether/DIM-1/region/r.20.20.mca", root, false, false);
|
||||||
|
}*/
|
||||||
|
|
||||||
seedWorldNether = WorldCreator
|
seedWorldNether = WorldCreator
|
||||||
.name(SEED + NETHER)
|
.name(SEED + NETHER)
|
||||||
.generator(new BoxedSeedChunkGenerator(this, Environment.NETHER))
|
.generator(new BoxedSeedChunkGenerator(this, Environment.NETHER))
|
||||||
@ -187,6 +198,10 @@ public class Boxed extends GameModeAddon {
|
|||||||
.seed(getSettings().getSeed())
|
.seed(getSettings().getSeed())
|
||||||
.createWorld();
|
.createWorld();
|
||||||
seedWorldNether.setDifficulty(Difficulty.EASY); // No damage wanted in this world.
|
seedWorldNether.setDifficulty(Difficulty.EASY); // No damage wanted in this world.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
copyChunks(seedWorldNether);
|
copyChunks(seedWorldNether);
|
||||||
|
|
||||||
if (getServer().getWorld(worldName + NETHER) == null) {
|
if (getServer().getWorld(worldName + NETHER) == null) {
|
||||||
@ -207,7 +222,7 @@ public class Boxed extends GameModeAddon {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies chunks from the seed world so they can be pasted in the game world
|
* Copies chunks from the seed world so they can be pasted in the game world
|
||||||
* @param seedWorld - souce world
|
* @param seedWorld - source world
|
||||||
*/
|
*/
|
||||||
private void copyChunks(World seedWorld) {
|
private void copyChunks(World seedWorld) {
|
||||||
BoxedChunkGenerator gen;
|
BoxedChunkGenerator gen;
|
||||||
|
@ -28,7 +28,7 @@ import world.bentobox.boxed.Boxed;
|
|||||||
* @author tastybento
|
* @author tastybento
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractSeendBiomeProvider extends BiomeProvider {
|
public abstract class AbstractSeedBiomeProvider extends BiomeProvider {
|
||||||
|
|
||||||
private static final Map<Environment, String> ENV_MAP;
|
private static final Map<Environment, String> ENV_MAP;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public abstract class AbstractSeendBiomeProvider extends BiomeProvider {
|
|||||||
protected final Map<BlockFace, SortedMap<Double, Biome>> quadrants;
|
protected final Map<BlockFace, SortedMap<Double, Biome>> quadrants;
|
||||||
|
|
||||||
|
|
||||||
protected AbstractSeendBiomeProvider(Boxed boxed, Environment env, Biome defaultBiome) {
|
protected AbstractSeedBiomeProvider(Boxed boxed, Environment env, Biome defaultBiome) {
|
||||||
this.addon = boxed;
|
this.addon = boxed;
|
||||||
this.defaultBiome = defaultBiome;
|
this.defaultBiome = defaultBiome;
|
||||||
dist = addon.getSettings().getIslandDistance();
|
dist = addon.getSettings().getIslandDistance();
|
||||||
@ -129,9 +129,10 @@ public abstract class AbstractSeendBiomeProvider extends BiomeProvider {
|
|||||||
try {
|
try {
|
||||||
double d = Double.parseDouble(split[0]);
|
double d = Double.parseDouble(split[0]);
|
||||||
Biome biome = Enums.getIfPresent(Biome.class, split[1].toUpperCase(Locale.ENGLISH)).orNull();
|
Biome biome = Enums.getIfPresent(Biome.class, split[1].toUpperCase(Locale.ENGLISH)).orNull();
|
||||||
if (biome == null) {
|
if (biome == null && !split[1].toUpperCase(Locale.ENGLISH).equalsIgnoreCase("default")) {
|
||||||
addon.logError(split[1].toUpperCase(Locale.ENGLISH) + " is an unknown biome on this server.");
|
addon.logError(split[1].toUpperCase(Locale.ENGLISH) + " is an unknown biome on this server.");
|
||||||
} else {
|
} else {
|
||||||
|
// A biome of null means that no alternative biome should be applied
|
||||||
result.put(d, biome);
|
result.put(d, biome);
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
@ -3,6 +3,7 @@ package world.bentobox.boxed.generators;
|
|||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.generator.BiomeProvider;
|
import org.bukkit.generator.BiomeProvider;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.bukkit.generator.WorldInfo;
|
||||||
|
|
||||||
import world.bentobox.boxed.Boxed;
|
import world.bentobox.boxed.Boxed;
|
||||||
|
|
||||||
@ -25,12 +26,12 @@ public class BoxedSeedChunkGenerator extends ChunkGenerator {
|
|||||||
this.env = env;
|
this.env = env;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeProvider getDefaultBiomeProvider(WorldInfo worldInfo) {
|
public BiomeProvider getDefaultBiomeProvider(WorldInfo worldInfo) {
|
||||||
return seedBiomeProvider;
|
return seedBiomeProvider;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldGenerateNoise() {
|
public boolean shouldGenerateNoise() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -9,7 +9,7 @@ import world.bentobox.boxed.Boxed;
|
|||||||
* @author tastybento
|
* @author tastybento
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SeedBiomeGenerator extends AbstractSeendBiomeProvider {
|
public class SeedBiomeGenerator extends AbstractSeedBiomeProvider {
|
||||||
|
|
||||||
public SeedBiomeGenerator(Boxed boxed) {
|
public SeedBiomeGenerator(Boxed boxed) {
|
||||||
super(boxed, Environment.NORMAL, Biome.OCEAN);
|
super(boxed, Environment.NORMAL, Biome.OCEAN);
|
||||||
|
Loading…
Reference in New Issue
Block a user