mirror of
https://github.com/BentoBoxWorld/Greenhouses.git
synced 2024-11-01 00:09:29 +01:00
Refactor to reduce complexity
This commit is contained in:
parent
7e4f0764e6
commit
e75780e710
@ -241,7 +241,16 @@ public class EcoSystemManager {
|
|||||||
for (double z = ibb.getMinZ(); z < ibb.getMaxZ(); z++) {
|
for (double z = ibb.getMinZ(); z < ibb.getMaxZ(); z++) {
|
||||||
for (double y = ibb.getMaxY() - 1; y >= bb.getMinY(); y--) {
|
for (double y = ibb.getMaxY() - 1; y >= bb.getMinY(); y--) {
|
||||||
Block b = gh.getWorld().getBlockAt(NumberConversions.floor(x), NumberConversions.floor(y), NumberConversions.floor(z));
|
Block b = gh.getWorld().getBlockAt(NumberConversions.floor(x), NumberConversions.floor(y), NumberConversions.floor(z));
|
||||||
|
if (checkBlock(result, b, ignoreLiquid)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkBlock(List<GrowthBlock> result, Block b, boolean ignoreLiquid) {
|
||||||
// Check floor blocks
|
// Check floor blocks
|
||||||
if (!ignoreLiquid) {
|
if (!ignoreLiquid) {
|
||||||
// Check ceiling blocks
|
// Check ceiling blocks
|
||||||
@ -255,22 +264,16 @@ public class EcoSystemManager {
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
result.add(new GrowthBlock(b.getRelative(BlockFace.UP), true));
|
result.add(new GrowthBlock(b.getRelative(BlockFace.UP), true));
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!b.isEmpty() && !b.isLiquid() && b.getRelative(BlockFace.UP).isLiquid()) {
|
if (!b.isEmpty() && !b.isLiquid() && b.getRelative(BlockFace.UP).isLiquid()) {
|
||||||
result.add(new GrowthBlock(b.getRelative(BlockFace.UP), true));
|
result.add(new GrowthBlock(b.getRelative(BlockFace.UP), true));
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int getBoneMeal(Greenhouse gh) {
|
private int getBoneMeal(Greenhouse gh) {
|
||||||
Hopper hopper = getHopper(gh);
|
Hopper hopper = getHopper(gh);
|
||||||
|
Loading…
Reference in New Issue
Block a user