diff --git a/pom.xml b/pom.xml index 88893f9..b5bcdea 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ ${build.version}-SNAPSHOT - 1.9.3 + 1.9.4 -LOCAL BentoBoxWorld_Greenhouses bentobox-world diff --git a/src/main/java/world/bentobox/greenhouses/greenhouse/BiomeRecipe.java b/src/main/java/world/bentobox/greenhouses/greenhouse/BiomeRecipe.java index b41efe5..515fafa 100644 --- a/src/main/java/world/bentobox/greenhouses/greenhouse/BiomeRecipe.java +++ b/src/main/java/world/bentobox/greenhouses/greenhouse/BiomeRecipe.java @@ -403,8 +403,9 @@ public boolean spawnMob(Block b) { return getRandomMob() // Check if the spawn on block matches, if it exists .filter(m -> Optional.of(m.mobSpawnOn()) - .map(b.getRelative(BlockFace.DOWN).getType()::equals) + .map(getEffectiveBlock(b.getRelative(BlockFace.DOWN))::equals) .orElse(true)) + // If spawn occurs, check if it can fit inside greenhouse .map(m -> { Entity entity = b.getWorld().spawnEntity(spawnLoc, m.mobType()); @@ -425,6 +426,19 @@ public boolean spawnMob(Block b) { }).orElse(false); } + /** + * Get the effective block material, allowing bubble columns to act as water. + * @param b - block to check + * @return the block + */ + private Material getEffectiveBlock(Block b) { + // Treat Bubble Column as water + if (b.getType() == Material.BUBBLE_COLUMN) { + return Material.WATER; + } + return b.getType(); + } + /** * Prevent hoglins and piglins from zombifying if they spawn in the overworld * @param entity - spawned entity diff --git a/src/main/java/world/bentobox/greenhouses/managers/EcoSystemManager.java b/src/main/java/world/bentobox/greenhouses/managers/EcoSystemManager.java index 8ca43e2..7665b9d 100644 --- a/src/main/java/world/bentobox/greenhouses/managers/EcoSystemManager.java +++ b/src/main/java/world/bentobox/greenhouses/managers/EcoSystemManager.java @@ -241,16 +241,14 @@ protected List getAvailableBlocks(Greenhouse gh, boolean ignoreLiqu for (double z = ibb.getMinZ(); z < ibb.getMaxZ(); z++) { for (double y = ibb.getMaxY() - 1; y >= bb.getMinY(); y--) { Block b = gh.getWorld().getBlockAt(NumberConversions.floor(x), NumberConversions.floor(y), NumberConversions.floor(z)); - if (checkBlock(result, b, ignoreLiquid)) { - break; - } + checkBlock(result, b, ignoreLiquid); } } } return result; } - private boolean checkBlock(List result, Block b, boolean ignoreLiquid) { + private void checkBlock(List result, Block b, boolean ignoreLiquid) { // Check floor blocks if (!ignoreLiquid) { // Check ceiling blocks @@ -264,15 +262,12 @@ private boolean checkBlock(List result, Block b, boolean ignoreLiqu ) ) { result.add(new GrowthBlock(b.getRelative(BlockFace.UP), true)); - return true; } } else { if (!b.isEmpty() && !b.isLiquid() && b.getRelative(BlockFace.UP).isLiquid()) { result.add(new GrowthBlock(b.getRelative(BlockFace.UP), true)); - return true; } } - return false; } private int getBoneMeal(Greenhouse gh) {