Skip to content

Commit b31c698

Browse files
Fix AutoFarm not harvesting chorus flowers covered by a block
Fixes https://wurstforum.net/d/1377
1 parent 7ba6c32 commit b31c698

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/main/java/net/wurstclient/hacks/autofarm/plants/ChorusPlantPlantType.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,19 @@ public Item getSeedItem()
5757
@Override
5858
public boolean shouldHarvestByMining(BlockPos pos, BlockState state)
5959
{
60-
if(state.isOf(Blocks.CHORUS_FLOWER)
61-
&& state.get(ChorusFlowerBlock.AGE, 0) == ChorusFlowerBlock.MAX_AGE)
62-
return true;
60+
if(state.isOf(Blocks.CHORUS_FLOWER))
61+
return isFlowerFullyGrown(pos, state);
6362

64-
if(!state.isOf(Blocks.CHORUS_PLANT))
65-
return false;
63+
if(state.isOf(Blocks.CHORUS_PLANT))
64+
return !hasAttachedFlowers(pos, state, new HashSet<>());
6665

67-
return !hasAttachedFlowers(pos, state, new HashSet<>());
66+
return false;
67+
}
68+
69+
private boolean isFlowerFullyGrown(BlockPos pos, BlockState state)
70+
{
71+
return state.get(ChorusFlowerBlock.AGE, 0) == ChorusFlowerBlock.MAX_AGE
72+
|| !BlockUtils.getState(pos.up()).isAir();
6873
}
6974

7075
private boolean hasAttachedFlowers(BlockPos pos, BlockState state,

0 commit comments

Comments
 (0)