diff --git a/pom.xml b/pom.xml
index aa44183..68e71c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,13 +30,9 @@
-
- codemc-snapshots
- https://repo.codemc.org/repository/maven-snapshots
-
- codemc-releases
- https://repo.codemc.org/repository/maven-releases
+ bentoboxworld
+ https://repo.codemc.org/repository/bentoboxworld/
@@ -45,8 +41,8 @@
UTF-8
17
- 1.20.2-R0.1-SNAPSHOT
- 2.5.0-SNAPSHOT
+ 1.21.3-R0.1-SNAPSHOT
+ 2.7.1-SNAPSHOT
${build.version}-SNAPSHOT
@@ -101,9 +97,13 @@
spigot-repo
https://hub.spigotmc.org/nexus/content/repositories/snapshots
+
+ bentoboxworld
+ https://repo.codemc.org/repository/bentoboxworld/
+
codemc-repo
- https://repo.codemc.org/repository/maven-public
+ https://repo.codemc.org/repository/maven-public/
diff --git a/src/main/java/world/bentobox/caveblock/Settings.java b/src/main/java/world/bentobox/caveblock/Settings.java
index a62acff..9990420 100644
--- a/src/main/java/world/bentobox/caveblock/Settings.java
+++ b/src/main/java/world/bentobox/caveblock/Settings.java
@@ -16,8 +16,6 @@ import org.bukkit.block.Biome;
import org.bukkit.entity.EntityType;
import org.eclipse.jdt.annotation.NonNull;
-import com.google.common.base.Enums;
-
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.configuration.ConfigComment;
import world.bentobox.bentobox.api.configuration.ConfigEntry;
@@ -147,7 +145,7 @@ public class Settings implements WorldSettings
@ConfigComment("The default biome for the overworld")
@ConfigEntry(path = "world.default-biome")
- private Biome defaultBiome = Enums.getIfPresent(Biome.class, "DRIPSTONE_CAVES").or(Biome.THE_VOID);
+ private Biome defaultBiome = Biome.DRIPSTONE_CAVES;
@ConfigComment("The maximum number of players a player can ban at any one time in this game mode.")
@ConfigComment("The permission caveblock.ban.maxlimit.X where X is a number can also be used per player")
@@ -231,7 +229,7 @@ public class Settings implements WorldSettings
@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_WASTES").or(Biome.THE_VOID);
+ private Biome defaultNetherBiome = Biome.NETHER_WASTES;
@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.)")
@@ -279,7 +277,7 @@ public class Settings implements WorldSettings
@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 = Enums.getIfPresent(Biome.class, "THE_END").or(Biome.THE_VOID);
+ private Biome defaultTheEndBiome = Biome.THE_END;
@ConfigEntry(path = "world.end.dragon-spawn", experimental = true)
private boolean dragonSpawn = false;
diff --git a/src/main/java/world/bentobox/caveblock/generators/ChunkGeneratorWorld.java b/src/main/java/world/bentobox/caveblock/generators/ChunkGeneratorWorld.java
index 08648c9..e5de1c0 100644
--- a/src/main/java/world/bentobox/caveblock/generators/ChunkGeneratorWorld.java
+++ b/src/main/java/world/bentobox/caveblock/generators/ChunkGeneratorWorld.java
@@ -56,27 +56,27 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
private Material getGroundRoofMaterial(World.Environment environment) {
return switch (environment) {
- case NETHER -> this.settings.isNetherRoof() ? Material.BEDROCK : this.settings.getNetherMainBlock();
- case THE_END -> this.settings.isEndRoof() ? Material.BEDROCK : this.settings.getEndMainBlock();
- default -> this.settings.isNormalRoof() ? Material.BEDROCK : this.settings.getNormalMainBlock();
+ case NETHER -> this.settings.isNetherRoof() ? Material.BEDROCK : this.settings.getNetherMainBlock();
+ case THE_END -> this.settings.isEndRoof() ? Material.BEDROCK : this.settings.getEndMainBlock();
+ default -> this.settings.isNormalRoof() ? Material.BEDROCK : this.settings.getNormalMainBlock();
};
}
private Material getGroundFloorMaterial(World.Environment environment) {
return switch (environment) {
- case NETHER -> this.settings.isNetherFloor() ? Material.BEDROCK : this.settings.getNetherMainBlock();
- case THE_END -> this.settings.isEndFloor() ? Material.BEDROCK : this.settings.getEndMainBlock();
- default -> this.settings.isNormalFloor() ? Material.BEDROCK : this.settings.getNormalMainBlock();
+ case NETHER -> this.settings.isNetherFloor() ? Material.BEDROCK : this.settings.getNetherMainBlock();
+ case THE_END -> this.settings.isEndFloor() ? Material.BEDROCK : this.settings.getEndMainBlock();
+ default -> this.settings.isNormalFloor() ? Material.BEDROCK : this.settings.getNormalMainBlock();
};
}
private Material getBaseMaterial(World.Environment environment) {
return switch (environment) {
- case NETHER -> this.settings.getNetherMainBlock();
- case THE_END -> this.settings.getEndMainBlock();
- default -> this.settings.getNormalMainBlock();
+ case NETHER -> this.settings.getNetherMainBlock();
+ case THE_END -> this.settings.getEndMainBlock();
+ default -> this.settings.getNormalMainBlock();
};
}
@@ -117,10 +117,10 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
final World.Environment environment = worldInfo.getEnvironment();
if (isNewGenerator) {
switch (environment) {
- case NETHER:
- if (worldHeight + 1 > 34) {
- chunkData.setRegion(0, minHeight + 1, 0, 16, 34, 16, Material.SOUL_SAND);
- chunkData.setRegion(0, 34, 0, 16, worldHeight - 1, 16, Material.NETHERRACK);
+ case NETHER:
+ if (worldHeight + 1 > 34) {
+ chunkData.setRegion(0, minHeight + 1, 0, 16, 34, 16, Material.SOUL_SAND);
+ chunkData.setRegion(0, 34, 0, 16, worldHeight - 1, 16, Material.NETHERRACK);
} else {
chunkData.setRegion(0, minHeight + 1, 0, 16, worldHeight - 1, 16, Material.NETHERRACK);
}
diff --git a/src/main/java/world/bentobox/caveblock/generators/populators/EntitiesPopulator.java b/src/main/java/world/bentobox/caveblock/generators/populators/EntitiesPopulator.java
index f688993..cc662ed 100644
--- a/src/main/java/world/bentobox/caveblock/generators/populators/EntitiesPopulator.java
+++ b/src/main/java/world/bentobox/caveblock/generators/populators/EntitiesPopulator.java
@@ -1,12 +1,21 @@
package world.bentobox.caveblock.generators.populators;
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.stream.Collectors;
+
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World.Environment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.WaterMob;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.LimitedRegion;
import org.bukkit.generator.WorldInfo;
@@ -17,9 +26,6 @@ import world.bentobox.bentobox.util.Pair;
import world.bentobox.caveblock.CaveBlock;
import world.bentobox.caveblock.Utils;
-import java.util.*;
-import java.util.stream.Collectors;
-
/**
* This class populates generated chunk with entities by random chance.
*/
@@ -29,17 +35,6 @@ public class EntitiesPopulator extends BlockPopulator {
// Section: Variables
// ---------------------------------------------------------------------
- /**
- * Water entities
- */
- private static final List WATER_ENTITIES = Arrays.asList(EntityType.GUARDIAN,
- EntityType.SQUID,
- EntityType.COD,
- EntityType.SALMON,
- EntityType.PUFFERFISH,
- EntityType.TROPICAL_FISH,
- EntityType.DROWNED,
- EntityType.DOLPHIN);
/**
* CaveBlock addon.
*/
@@ -170,12 +165,16 @@ public class EntitiesPopulator extends BlockPopulator {
if (!limitedRegion.isInRegion(location)) return;
if (!limitedRegion.getType(location).equals(originalMaterial)) return;
- BoundingBox bb = this.getEntityBoundingBox(entityType, location);
+ // Spawn the entity and then make space for it
+ Entity entity = limitedRegion.spawnEntity(location, entityType);
+ BoundingBox bb = entity.getBoundingBox();
for (int x = (int) Math.floor(bb.getMinX()); x < bb.getMaxX(); x++) {
for (int z = (int) Math.floor(bb.getMinZ()); z < bb.getMaxZ(); z++) {
int y = (int) Math.floor(bb.getMinY());
if (!limitedRegion.isInRegion(x, y, z)) {
+ // Only spawn if it's in the region
+ entity.remove();
return;
}
@@ -186,19 +185,19 @@ public class EntitiesPopulator extends BlockPopulator {
if (!limitedRegion.isInRegion(x, y, z) || !limitedRegion.getType(x, y, z).equals(originalMaterial)) {
// Cannot place entity
+ entity.remove();
return;
}
- limitedRegion.setType(x, y, z, WATER_ENTITIES.contains(entityType) ? Material.WATER : Material.AIR);
+ limitedRegion.setType(x, y, z, entity instanceof WaterMob ? Material.WATER : Material.AIR);
}
// Add air block on top for all water entities (required for dolphin, okay for others)
- if (WATER_ENTITIES.contains(entityType) && limitedRegion.isInRegion(x, y, z) && limitedRegion.getType(x, y, z).equals(originalMaterial)) {
+ if (entity instanceof WaterMob && limitedRegion.isInRegion(x, y, z)
+ && limitedRegion.getType(x, y, z).equals(originalMaterial)) {
limitedRegion.setType(x, y, z, Material.CAVE_AIR);
}
}
}
- Entity entity = limitedRegion.spawnEntity(location, entityType);
-
if (entity instanceof LivingEntity livingEntity)
{
livingEntity.setAI(hasAI);
@@ -206,76 +205,6 @@ public class EntitiesPopulator extends BlockPopulator {
}
}
-
- /**
- * This is manual bounding box calculation base on entity type.
- * @param entityType Entity type which bounding box should be created.
- * @param location Location of the bounding box.
- * @return Approximate bounding box of the entity type.
- */
- private BoundingBox getEntityBoundingBox(EntityType entityType, Location location)
- {
- BoundingBox boundingBox = new BoundingBox();
- // Set bounding box to 1 for all entities
- boundingBox.expand(1);
- // Shift to correct location.
- boundingBox.shift(location);
-
- switch (entityType)
- {
- // Turtles base size is 1.1
- case TURTLE -> boundingBox.expand(-0.05, 0, -0.05, 0.05, 0, 0.05);
- // Panda base size is 1.3 and height is 1.25
- case PANDA -> boundingBox.expand(-0.15, 0, -0.15, 0.15, 0.25, 0.15);
- // Sheep height is 1.3
- case SHEEP -> boundingBox.expand(0, 0, 0, 0, 0.3, 0);
- // Cow height is 1.4
- case COW, MUSHROOM_COW -> boundingBox.expand(0, 0, 0, 0, 0.4, 0);
- // Polar Bear base size is 1.3 and height is 1.4
- case POLAR_BEAR -> boundingBox.expand(-0.15, 0, -0.15, 0.15, 0.4, 0.15);
- // Horse base size is 1.3964
- case HORSE, ZOMBIE_HORSE, SKELETON_HORSE -> boundingBox.expand(-0.2, 0, -0.2, 0.2, 0.6, 0.2);
- // Llama height is 1.875
- case LLAMA -> boundingBox.expand(0, 0, 0, 0, 0.875, 0);
- // Ravager base size is 1.95 and height is 2.2
- case RAVAGER -> boundingBox.expand(-0.48, 0, -0.48, 0.48, 1.2, 0.48);
- // Spider base size is 1.4
- case SPIDER -> boundingBox.expand(-0.2, 0, -0.2, 0.2, 0, 0.2);
- // Creeper height 1.7
- case CREEPER -> boundingBox.expand(0, 0, 0, 0, 0.7, 0);
- // Blaze height 1.8
- case BLAZE -> boundingBox.expand(0, 0, 0, 0, 0.8, 0);
- // Zombie, evoker, villager, husk, witch, vindicator, illusioner, drowned, pigman, villager and pillager height is 1.95
- case ZOMBIE, EVOKER, VILLAGER, HUSK, WITCH, VINDICATOR, ILLUSIONER, DROWNED, PIGLIN, PIGLIN_BRUTE, ZOMBIFIED_PIGLIN, ZOMBIE_VILLAGER, PILLAGER, WANDERING_TRADER ->
- boundingBox.expand(0, 0, 0, 0, 0.95, 0);
- // Skeletons height is 1.99
- case SKELETON, STRAY -> boundingBox.expand(0, 0, 0, 0, 0.99, 0);
- // Elder Guardians base height is 2
- case ELDER_GUARDIAN -> boundingBox.expand(-0.5, 0, -0.5, 0.5, 1, 0.5);
- // Slimes are up to 2.04
- case SLIME -> boundingBox.expand(-0.5, 0, -0.5, 0.5, 1, 0.5);
- // Wither skeletons height is 2.4
- case WITHER_SKELETON -> boundingBox.expand(0, 0, 0, 0, 1.4, 0);
- // Wither height is 3.5
- case WITHER -> boundingBox.expand(0, 0, 0, 0, 2.5, 0);
- // Enderman height is 2.9
- case ENDERMAN -> boundingBox.expand(0, 0, 0, 0, 1.9, 0);
- // Ghast base size is 4
- case GHAST -> boundingBox.expand(-2, 0, -2, 2, 3, 2);
- // Iron Golem base size is 1.4 and height is 2.7
- case IRON_GOLEM -> boundingBox.expand(-0.2, 0, -0.2, 0.2, 1.7, 0.2);
- // Snowman height is 1.9
- case SNOWMAN -> boundingBox.expand(0, 0, 0, 0, 0.9, 0);
- // Hoglin base size is 1.4 and height is 1.3965
- case HOGLIN, ZOGLIN -> boundingBox.expand(-0.2, 0, -0.2, 0.2, 0.4, 0.2);
- // Warden height is 2.9
- case WARDEN -> boundingBox.expand(0, 0, 0, 0, 1.9, 0);
- }
-
- return boundingBox;
- }
-
-
// ---------------------------------------------------------------------
// Section: Private Classes
// ---------------------------------------------------------------------
diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml
index 6d89523..9c1c382 100644
--- a/src/main/resources/addon.yml
+++ b/src/main/resources/addon.yml
@@ -1,7 +1,7 @@
name: CaveBlock
main: world.bentobox.caveblock.CaveBlock
version: ${version}${build.number}
-api-version: 2.5.0
+api-version: 2.7.1
metrics: true
repository: "BentoBoxWorld/CaveBlock"
icon: "STONE_PICKAXE"
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 25d5d16..1bfe36f 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -150,6 +150,7 @@ world:
- MATERIAL:GRANITE:40:10
- MATERIAL:ANDESITE:20:10
- MATERIAL:DIORITE:30:8
+ - MATERIAL:LAVA:15:4
- ENTITY:ZOMBIE:10:1
- ENTITY:ENDERMAN:10:1
- ENTITY:SKELETON:10:1
@@ -200,7 +201,7 @@ world:
- MATERIAL:MAGMA_BLOCK:10:3
- MATERIAL:GLOWSTONE:20:8
- MATERIAL:NETHER_BRICKS:10:5
- - MATERIAL:LAVA:10:1
+ - MATERIAL:LAVA:30:10
- ENTITY:MAGMA_CUBE:0.5:1
- ENTITY:GHAST:0.1:1
- ENTITY:WITHER_SKELETON:0.1:1
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index b998ac6..cd64234 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,7 +1,7 @@
name: BentoBox-CaveBlock
main: world.bentobox.caveblock.CaveBlockPladdon
version: ${project.version}${build.number}
-api-version: "1.19"
+api-version: "1.21"
authors: [tastybento, BONNe]
contributors: ["The BentoBoxWorld Community"]