From a594f5edd524a968d0813efd442f31dc03e8ecee Mon Sep 17 00:00:00 2001 From: BONNe Date: Thu, 9 Jul 2020 21:42:31 +0300 Subject: [PATCH] CaveBlock 1.14 Release (#48) * Increment development version. * Prepare for 1.16.1 release. - Added nether and the end biome sections in config. * Add 1.15.2 backward compatibility. Update to 1.14 api. --- pom.xml | 6 +- .../world/bentobox/caveblock/Settings.java | 57 ++++++++++++++++++- .../generators/ChunkGeneratorWorld.java | 50 +++++++++++++--- src/main/resources/config.yml | 9 ++- 4 files changed, 106 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 850e134..23dd7c2 100644 --- a/pom.xml +++ b/pom.xml @@ -45,12 +45,12 @@ UTF-8 1.8 - 1.15.2-R0.1-SNAPSHOT - 1.13.0 + 1.16.1-R0.1-SNAPSHOT + 1.14.0 ${build.version}-SNAPSHOT - 1.13.0 + 1.14.0 -LOCAL diff --git a/src/main/java/world/bentobox/caveblock/Settings.java b/src/main/java/world/bentobox/caveblock/Settings.java index a52a1bf..cca6098 100644 --- a/src/main/java/world/bentobox/caveblock/Settings.java +++ b/src/main/java/world/bentobox/caveblock/Settings.java @@ -1,6 +1,7 @@ package world.bentobox.caveblock; +import com.google.common.base.Enums; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -1860,6 +1861,50 @@ public class Settings implements WorldSettings } + /** + * Method Settings#getDefaultNetherBiome returns the defaultNetherBiome of this object. + * + * @return the defaultNetherBiome (type Biome) of this object. + */ + public Biome getDefaultNetherBiome() + { + return defaultNetherBiome; + } + + + /** + * Method Settings#setDefaultNetherBiome sets new value for the defaultNetherBiome of this object. + * @param defaultNetherBiome new value for this object. + * + */ + public void setDefaultNetherBiome(Biome defaultNetherBiome) + { + this.defaultNetherBiome = defaultNetherBiome; + } + + + /** + * Method Settings#getDefaultTheEndBiome returns the defaultTheEndBiome of this object. + * + * @return the defaultTheEndBiome (type Biome) of this object. + */ + public Biome getDefaultTheEndBiome() + { + return defaultTheEndBiome; + } + + + /** + * Method Settings#setDefaultTheEndBiome sets new value for the defaultTheEndBiome of this object. + * @param defaultTheEndBiome new value for this object. + * + */ + public void setDefaultTheEndBiome(Biome defaultTheEndBiome) + { + this.defaultTheEndBiome = defaultTheEndBiome; + } + + // --------------------------------------------------------------------- // Section: Variables // --------------------------------------------------------------------- @@ -2009,6 +2054,10 @@ public class Settings implements WorldSettings @ConfigEntry(path = "world.nether.caves", needsReset = true) private boolean netherIslands = true; + @ConfigComment("The default biome for the nether world (this may affect what mobs can spawn)") + @ConfigEntry(path = "world.nether.biome", since = "1.14.0") + private Biome defaultNetherBiome = Enums.getIfPresent(Biome.class, "NETHER").or(Enums.getIfPresent(Biome.class, "NETHER_WASTES").or(Biome.BADLANDS)); + @ConfigComment("Nether spawn protection radius - this is the distance around the nether spawn") @ConfigComment("that will be protected from player interaction (breaking blocks, pouring lava etc.)") @ConfigComment("Minimum is 0 (not recommended), maximum is 100. Default is 25.") @@ -2026,7 +2075,7 @@ public class Settings implements WorldSettings @ConfigComment("Main block of which world will be generated.") @ConfigEntry(path = "world.nether.main-block", needsReset = true) - private Material netherMainBlock = Material.STONE; + private Material netherMainBlock = Material.NETHERRACK; @ConfigComment("Blocks that will occasionally replace main block by random chance.") @ConfigComment("Blocks will replace only main-block and will try to create packs that") @@ -2047,6 +2096,10 @@ public class Settings implements WorldSettings @ConfigEntry(path = "world.end.caves", needsReset = true) private boolean endIslands = true; + @ConfigComment("The default biome for the end world (this may affect what mobs can spawn)") + @ConfigEntry(path = "world.end.biome", since = "1.14.0") + private Biome defaultTheEndBiome = Biome.THE_END; + @ConfigEntry(path = "world.end.dragon-spawn", experimental = true) private boolean dragonSpawn = false; @@ -2060,7 +2113,7 @@ public class Settings implements WorldSettings @ConfigComment("Main block of which world will be generated.") @ConfigEntry(path = "world.end.main-block", needsReset = true) - private Material endMainBlock = Material.STONE; + private Material endMainBlock = Material.END_STONE; @ConfigComment("Blocks that will occasionally replace main block by random chance.") @ConfigComment("Blocks will replace only main-block and will try to create packs that") diff --git a/src/main/java/world/bentobox/caveblock/generators/ChunkGeneratorWorld.java b/src/main/java/world/bentobox/caveblock/generators/ChunkGeneratorWorld.java index 63916ae..75e4c02 100644 --- a/src/main/java/world/bentobox/caveblock/generators/ChunkGeneratorWorld.java +++ b/src/main/java/world/bentobox/caveblock/generators/ChunkGeneratorWorld.java @@ -78,15 +78,15 @@ public class ChunkGeneratorWorld extends ChunkGenerator // Populate chunk with necessary information if (world.getEnvironment().equals(World.Environment.NETHER)) { - this.populateNetherChunk(result); + this.populateNetherChunk(world, result, biomeGrid); } else if (world.getEnvironment().equals(World.Environment.THE_END)) { - this.populateTheEndChunk(result); + this.populateTheEndChunk(world, result, biomeGrid); } else { - this.populateOverWorldChunk(result, biomeGrid); + this.populateOverWorldChunk(world, result, biomeGrid); } return result; @@ -95,9 +95,11 @@ public class ChunkGeneratorWorld extends ChunkGenerator /** * This method populates The End world chunk data. + * @param world world where chunks are generated. * @param chunkData ChunkData that must be populated. + * @param biomeGrid BiomeGrid for this chunk. */ - private void populateTheEndChunk(ChunkData chunkData) + private void populateTheEndChunk(World world, ChunkData chunkData, BiomeGrid biomeGrid) { // because everything starts at 0 and ends at 255 final int worldHeight = this.settings.getWorldDepth(); @@ -114,14 +116,28 @@ public class ChunkGeneratorWorld extends ChunkGenerator chunkData.setRegion(0, worldHeight - 1, 0, 16, worldHeight, 16, this.settings.isEndRoof() ? Material.BEDROCK : this.settings.getEndMainBlock()); + + // Set biome + for (int x = 0; x < 16; x += 4) + { + for (int y = 0; y < world.getMaxHeight(); y += 4) + { + for (int z = 0; z < 16; z += 4) + { + biomeGrid.setBiome(x, y, z, this.settings.getDefaultNetherBiome()); + } + } + } } /** * This method populates nether world chunk data. + * @param world world where chunks are generated. * @param chunkData ChunkData that must be populated. + * @param biomeGrid BiomeGrid for this chunk. */ - private void populateNetherChunk(ChunkData chunkData) + private void populateNetherChunk(World world, ChunkData chunkData, BiomeGrid biomeGrid) { // because everything starts at 0 and ends at 255 final int worldHeight = this.settings.getWorldDepth(); @@ -138,15 +154,28 @@ public class ChunkGeneratorWorld extends ChunkGenerator chunkData.setRegion(0, worldHeight - 1, 0, 16, worldHeight, 16, this.settings.isNetherRoof() ? Material.BEDROCK : this.settings.getNetherMainBlock()); + + // Set biome + for (int x = 0; x < 16; x += 4) + { + for (int y = 0; y < world.getMaxHeight(); y += 4) + { + for (int z = 0; z < 16; z += 4) + { + biomeGrid.setBiome(x, y, z, this.settings.getDefaultNetherBiome()); + } + } + } } /** * This method populates Over world chunk data. + * @param world world where chunks are generated. * @param chunkData ChunkData that must be populated. * @param biomeGrid BiomeGrid for this chunk. */ - private void populateOverWorldChunk(ChunkData chunkData, BiomeGrid biomeGrid) + private void populateOverWorldChunk(World world, ChunkData chunkData, BiomeGrid biomeGrid) { // because everything starts at 0 and ends at 255 final int worldHeight = this.settings.getWorldDepth(); @@ -165,11 +194,14 @@ public class ChunkGeneratorWorld extends ChunkGenerator this.settings.isNormalRoof() ? Material.BEDROCK : this.settings.getNormalMainBlock()); // Set biome - for (int x = 0; x < 16; x++) + for (int x = 0; x < 16; x += 4) { - for (int z = 0; z < 16; z++) + for (int y = 0; y < world.getMaxHeight(); y += 4) { - biomeGrid.setBiome(x, z, this.settings.getDefaultBiome()); + for (int z = 0; z < 16; z += 4) + { + biomeGrid.setBiome(x, y, z, this.settings.getDefaultBiome()); + } } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 611f45f..69436da 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,4 +1,4 @@ -# CaveBlock Configuration 1.13.0 +# CaveBlock Configuration 1.14.0-SNAPSHOT-LOCAL caveblock: command: # Cave Command. What command users will run to access their cave. @@ -120,6 +120,9 @@ world: # Caves in Nether. Change to false for standard vanilla nether. # /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds. caves: true + # The default biome for the nether world (this may affect what mobs can spawn) + # Added since 1.14.0. + biome: NETHER_WASTES # Nether spawn protection radius - this is the distance around the nether spawn # that will be protected from player interaction (breaking blocks, pouring lava etc.) # Minimum is 0 (not recommended), maximum is 100. Default is 25. @@ -159,6 +162,9 @@ world: generate: true # /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds. caves: true + # The default biome for the end world (this may affect what mobs can spawn) + # Added since 1.14.0. + biome: THE_END # /!\ This feature is experimental and might not work as expected or might not work at all. dragon-spawn: false # Make over world roof of bedrock, if false, it will be made from stone @@ -188,7 +194,6 @@ world: remove-mobs-whitelist: - WITHER - ENDERMAN - - PIG_ZOMBIE - ZOMBIE_VILLAGER # World flags. These are boolean settings for various flags for this world flags: