Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>1.9.3</build.version>
<build.version>1.9.4</build.version>
<build.number>-LOCAL</build.number>
<sonar.projectKey>BentoBoxWorld_Greenhouses</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,14 @@ protected List<GrowthBlock> 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<GrowthBlock> result, Block b, boolean ignoreLiquid) {
private void checkBlock(List<GrowthBlock> result, Block b, boolean ignoreLiquid) {
// Check floor blocks
if (!ignoreLiquid) {
// Check ceiling blocks
Expand All @@ -264,15 +262,12 @@ private boolean checkBlock(List<GrowthBlock> 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) {
Expand Down
Loading