Shuffles where plants are grown in the greenhouse

Fixes https://github.com/BentoBoxWorld/Greenhouses/issues/54
This commit is contained in:
tastybento 2021-01-11 17:12:18 -08:00
parent 2ccb25e3fc
commit 08e9c25172
1 changed files with 3 additions and 1 deletions

View File

@ -155,7 +155,9 @@ public class EcoSystemManager {
int bonemeal = getBoneMeal(gh);
if (bonemeal > 0) {
// 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) {
setBoneMeal(gh, bonemeal - (int)Math.ceil((double)plantsGrown / PLANTS_PER_BONEMEAL ));
}