44import com .jelly .farmhelperv2 .config .FarmHelperConfig ;
55import com .jelly .farmhelperv2 .config .struct .Rewarp ;
66import com .jelly .farmhelperv2 .failsafe .FailsafeManager ;
7+ import com .jelly .farmhelperv2 .handler .GameStateHandler ;
78import com .jelly .farmhelperv2 .handler .MacroHandler ;
89import com .jelly .farmhelperv2 .util .helper .Clock ;
9- import com .jelly .farmhelperv2 .util .AngleUtils ;
10- import com .jelly .farmhelperv2 .handler .GameStateHandler ;
1110import net .minecraft .block .*;
1211import net .minecraft .client .Minecraft ;
1312import net .minecraft .entity .Entity ;
@@ -54,7 +53,7 @@ public static FarmHelperConfig.CropEnum getFarmingCrop() {
5453 if (mc .theWorld == null ) return FarmHelperConfig .CropEnum .NONE ;
5554 if (mc .theWorld .getBlockState (pos ) == null ) return FarmHelperConfig .CropEnum .NONE ;
5655 Block block = mc .theWorld .getBlockState (pos ).getBlock ();
57- if (block instanceof BlockCrops || block instanceof BlockReed || block instanceof BlockCocoa || block instanceof BlockNetherWart || block instanceof BlockMelon || block instanceof BlockPumpkin || block instanceof BlockMushroom || block instanceof BlockCactus ) {
56+ if (block instanceof BlockCrops || block instanceof BlockReed || block instanceof BlockCocoa || block instanceof BlockNetherWart || block instanceof BlockMelon || block instanceof BlockPumpkin || block instanceof BlockMushroom || block instanceof BlockCactus || block instanceof BlockDoublePlant ) {
5857 closestCrop = Pair .of (block , pos );
5958 foundCropUnderMouse = true ;
6059 }
@@ -76,7 +75,7 @@ public static FarmHelperConfig.CropEnum getFarmingCrop() {
7675 }
7776 BlockPos pos = BlockUtils .getRelativeBlockPos (x , y , z , yaw );
7877 Block block = mc .theWorld .getBlockState (pos ).getBlock ();
79- if (!(block instanceof BlockCrops || block instanceof BlockReed || block instanceof BlockCocoa || block instanceof BlockNetherWart || block instanceof BlockMelon || block instanceof BlockPumpkin || block instanceof BlockMushroom || block instanceof BlockCactus ))
78+ if (!(block instanceof BlockCrops || block instanceof BlockReed || block instanceof BlockCocoa || block instanceof BlockNetherWart || block instanceof BlockMelon || block instanceof BlockPumpkin || block instanceof BlockMushroom || block instanceof BlockCactus || block instanceof BlockDoublePlant ))
8079 continue ;
8180
8281 if (closestCrop == null || mc .thePlayer .getPositionVector ().distanceTo (new Vec3 (pos .getX () + 0.5f , pos .getY (), pos .getZ () + 0.5f )) < mc .thePlayer .getPositionVector ().distanceTo (new Vec3 (closestCrop .getRight ().getX () + 0.5f , closestCrop .getRight ().getY (), closestCrop .getRight ().getZ () + 0.5f ))) {
@@ -89,6 +88,7 @@ public static FarmHelperConfig.CropEnum getFarmingCrop() {
8988
9089 if (closestCrop != null ) {
9190 Block left = closestCrop .getLeft ();
91+ BlockPos pos = closestCrop .getRight ();
9292 if (left .equals (Blocks .wheat )) {
9393 return FarmHelperConfig .CropEnum .WHEAT ;
9494 } else if (left .equals (Blocks .carrots )) {
@@ -111,6 +111,23 @@ public static FarmHelperConfig.CropEnum getFarmingCrop() {
111111 return FarmHelperConfig .CropEnum .MUSHROOM ;
112112 } else if (left .equals (Blocks .cactus )) {
113113 return FarmHelperConfig .CropEnum .CACTUS ;
114+ } else if (left .equals (Blocks .double_plant )) {
115+ BlockDoublePlant plantBlock = (BlockDoublePlant ) left ;
116+ BlockDoublePlant .EnumPlantType variant = plantBlock .getVariant (mc .theWorld , pos );
117+
118+ if (variant == BlockDoublePlant .EnumPlantType .SUNFLOWER ) {
119+ List <String > scoreboardLines = ScoreboardUtils .getScoreboardLines (true );
120+
121+ boolean isDay = scoreboardLines .contains ("Day" );
122+ LogUtils .sendDebug ("Is Day: " + (isDay ? "true" : "false" ));
123+ if (isDay ) {
124+ return FarmHelperConfig .CropEnum .SUNFLOWER ;
125+ } else {
126+ return FarmHelperConfig .CropEnum .MOONFLOWER ;
127+ }
128+ } else if (variant == BlockDoublePlant .EnumPlantType .ROSE ) {
129+ return FarmHelperConfig .CropEnum .ROSE ;
130+ }
114131 }
115132 }
116133 LogUtils .sendError ("Can't detect crop type! Lower average BPS failsafe will be disabled!" );
@@ -384,7 +401,9 @@ public static EnumFacing getHorizontalFacing(float yaw) {
384401
385402 public static void closeScreen () {
386403 if (mc .currentScreen != null && mc .thePlayer != null ) {
387- mc .addScheduledTask (() -> { mc .thePlayer .closeScreen ();});
404+ mc .addScheduledTask (() -> {
405+ mc .thePlayer .closeScreen ();
406+ });
388407 }
389408 }
390409
0 commit comments