Shuffles where plants are grown in the greenhouse
Fixes https://github.com/BentoBoxWorld/Greenhouses/issues/54
This commit is contained in:
parent
2ccb25e3fc
commit
08e9c25172
|
@ -155,7 +155,9 @@ public class EcoSystemManager {
|
||||||
int bonemeal = getBoneMeal(gh);
|
int bonemeal = getBoneMeal(gh);
|
||||||
if (bonemeal > 0) {
|
if (bonemeal > 0) {
|
||||||
// Get a list of all available blocks
|
// Get a list of all available blocks
|
||||||
int plantsGrown = getAvailableBlocks(gh, true).stream().limit(bonemeal).mapToInt(bl -> gh.getBiomeRecipe().growPlant(bl) ? 1 : 0).sum();
|
List<Block> list = getAvailableBlocks(gh, true);
|
||||||
|
Collections.shuffle(list);
|
||||||
|
int plantsGrown = list.stream().limit(bonemeal).mapToInt(bl -> gh.getBiomeRecipe().growPlant(bl) ? 1 : 0).sum();
|
||||||
if (plantsGrown > 0) {
|
if (plantsGrown > 0) {
|
||||||
setBoneMeal(gh, bonemeal - (int)Math.ceil((double)plantsGrown / PLANTS_PER_BONEMEAL ));
|
setBoneMeal(gh, bonemeal - (int)Math.ceil((double)plantsGrown / PLANTS_PER_BONEMEAL ));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue