Skip to content

Commit

Permalink
Shuffles where plants are grown in the greenhouse
Browse files Browse the repository at this point in the history
Fixes #54
  • Loading branch information
tastybento committed Jan 12, 2021
1 parent 2ccb25e commit 08e9c25
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ private void growPlants(Greenhouse gh) {
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 ));
}
Expand Down

0 comments on commit 08e9c25

Please sign in to comment.