Skip to content

Commit 89b0311

Browse files
Fix AutoFarm ignoring a few chorus plant parts that it can safely harvest
1 parent 516c6dd commit 89b0311

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,23 @@ private boolean hasAttachedFlowers(BlockPos pos, BlockState state,
8484
if(!state.get(entry.getValue(), false))
8585
continue;
8686

87-
BlockPos neighborPos = pos.offset(entry.getKey());
87+
Direction direction = entry.getKey();
88+
BlockPos neighborPos = pos.offset(direction);
8889
BlockState neighborState = BlockUtils.getState(neighborPos);
8990
if(neighborState.isOf(Blocks.CHORUS_FLOWER))
9091
return true;
9192

92-
if(neighborState.isOf(Blocks.CHORUS_PLANT)
93-
&& hasAttachedFlowers(neighborPos, neighborState, visited))
93+
if(!neighborState.isOf(Blocks.CHORUS_PLANT))
94+
continue;
95+
96+
// A horizontally adjacent neighbor that connects down is probably
97+
// connected to the stem, so we can ignore any flowers that it
98+
// supports.
99+
if(direction.getAxis().isHorizontal()
100+
&& neighborState.get(ConnectingBlock.DOWN, false))
101+
continue;
102+
103+
if(hasAttachedFlowers(neighborPos, neighborState, visited))
94104
return true;
95105
}
96106

0 commit comments

Comments
 (0)