99
1010import java .util .Collection ;
1111import java .util .List ;
12+ import java .util .stream .Stream ;
1213
1314import net .minecraft .client .util .math .MatrixStack ;
1415import net .minecraft .util .math .BlockPos ;
1516import net .minecraft .util .math .Box ;
17+ import net .wurstclient .settings .CheckboxSetting ;
18+ import net .wurstclient .settings .Setting ;
1619import net .wurstclient .util .RenderUtils ;
1720
1821public final class AutoFarmRenderer
@@ -21,28 +24,47 @@ public final class AutoFarmRenderer
2124 new Box (BlockPos .ORIGIN ).contract (1 / 16.0 );
2225 private static final Box NODE_BOX = new Box (BlockPos .ORIGIN ).contract (0.25 );
2326
24- private List <Box > blocksToHarvest = List .of ();
27+ public final CheckboxSetting drawReplantingSpots =
28+ new CheckboxSetting ("Draw replanting spots" , true );
29+ public final CheckboxSetting drawBlocksToHarvest =
30+ new CheckboxSetting ("Draw blocks to harvest" , true );
31+ public final CheckboxSetting drawBlocksToReplant =
32+ new CheckboxSetting ("Draw blocks to replant" , true );
33+
2534 private List <Box > replantingSpots = List .of ();
35+ private List <Box > blocksToHarvest = List .of ();
2636 private List <Box > blocksToReplant = List .of ();
2737
28- public void update (Collection <BlockPos > blocksToHarvest ,
29- Collection <BlockPos > replantingSpots ,
38+ public void update (Collection <BlockPos > replantingSpots ,
39+ Collection <BlockPos > blocksToHarvest ,
3040 Collection <BlockPos > blocksToReplant )
3141 {
32- this .blocksToHarvest =
33- blocksToHarvest .stream ().map (BLOCK_BOX ::offset ).toList ();
3442 this .replantingSpots =
3543 replantingSpots .stream ().map (NODE_BOX ::offset ).toList ();
44+ this .blocksToHarvest =
45+ blocksToHarvest .stream ().map (BLOCK_BOX ::offset ).toList ();
3646 this .blocksToReplant =
3747 blocksToReplant .stream ().map (BLOCK_BOX ::offset ).toList ();
3848 }
3949
4050 public void render (MatrixStack matrixStack )
4151 {
42- RenderUtils .drawOutlinedBoxes (matrixStack , blocksToHarvest , 0x8000FF00 ,
43- false );
44- RenderUtils .drawNodes (matrixStack , replantingSpots , 0x8000FFFF , false );
45- RenderUtils .drawOutlinedBoxes (matrixStack , blocksToReplant , 0x80FF0000 ,
46- false );
52+ if (drawReplantingSpots .isChecked ())
53+ RenderUtils .drawNodes (matrixStack , replantingSpots , 0x8000FFFF ,
54+ false );
55+
56+ if (drawBlocksToHarvest .isChecked ())
57+ RenderUtils .drawOutlinedBoxes (matrixStack , blocksToHarvest ,
58+ 0x8000FF00 , false );
59+
60+ if (drawBlocksToReplant .isChecked ())
61+ RenderUtils .drawOutlinedBoxes (matrixStack , blocksToReplant ,
62+ 0x80FF0000 , false );
63+ }
64+
65+ public Stream <Setting > getSettings ()
66+ {
67+ return Stream .of (drawReplantingSpots , drawBlocksToHarvest ,
68+ drawBlocksToReplant );
4769 }
4870}
0 commit comments