2
2
3
3
import meteordevelopment .meteorclient .events .world .TickEvent ;
4
4
import meteordevelopment .meteorclient .pathing .PathManagers ;
5
+ import meteordevelopment .meteorclient .settings .BoolSetting ;
5
6
import meteordevelopment .meteorclient .settings .EntityTypeListSetting ;
6
7
import meteordevelopment .meteorclient .settings .Setting ;
7
8
import meteordevelopment .meteorclient .settings .SettingGroup ;
12
13
import meteordevelopment .meteorclient .utils .entity .SortPriority ;
13
14
import meteordevelopment .meteorclient .utils .entity .TargetUtils ;
14
15
import meteordevelopment .orbit .EventHandler ;
16
+ import net .minecraft .block .Block ;
17
+ import net .minecraft .block .Blocks ;
15
18
import net .minecraft .entity .Entity ;
16
19
import net .minecraft .entity .EntityType ;
17
20
import net .minecraft .entity .LivingEntity ;
18
21
import net .minecraft .entity .Tameable ;
19
22
import net .minecraft .entity .player .PlayerEntity ;
23
+ import net .minecraft .util .math .BlockPos ;
24
+ import net .minecraft .util .math .Vec3d ;
25
+ import net .minecraft .world .World ;
20
26
21
27
import java .util .ArrayList ;
22
28
import java .util .Set ;
@@ -35,6 +41,20 @@ public Hunt() {
35
41
.build ()
36
42
);
37
43
44
+ private final Setting <Boolean > onGround = sgGeneral .add (new BoolSetting .Builder ()
45
+ .name ("On ground only" )
46
+ .description ("Attack entities on ground only" )
47
+ .defaultValue (false )
48
+ .build ()
49
+ );
50
+
51
+ private final Setting <Boolean > customCheck = sgGeneral .add (new BoolSetting .Builder ()
52
+ .name ("Custom on ground check" )
53
+ .description ("Use a custom on ground check instead of the usual entity.isOnGround. Useful on some servers" )
54
+ .defaultValue (false )
55
+ .build ()
56
+ );
57
+
38
58
private boolean entityCheck (Entity entity ) {
39
59
if (entity .equals (mc .player ) || entity .equals (mc .cameraEntity )) return false ;
40
60
if ((entity instanceof LivingEntity && ((LivingEntity ) entity ).isDead ()) || !entity .isAlive ()) return false ;
@@ -54,7 +74,19 @@ private boolean entityCheck(Entity entity) {
54
74
return false ;
55
75
}
56
76
}
77
+ if (onGround .get ()) {
78
+ if (customCheck .get ()) {
79
+ World world = entity .getWorld ();
80
+
81
+ Vec3d entityPos = entity .getPos ();
82
+ BlockPos posBelow = new BlockPos ((int ) entityPos .x , (int ) (entityPos .y - 1 ), (int ) entityPos .z );
83
+
84
+ Block blockBelow = world .getBlockState (posBelow ).getBlock ();
57
85
86
+ return (blockBelow != Blocks .AIR && blockBelow != Blocks .WATER && blockBelow != Blocks .LAVA );
87
+ }
88
+ else return entity .isOnGround ();
89
+ }
58
90
return true ;
59
91
}
60
92
private final ArrayList <Entity > targets = new ArrayList <>();
0 commit comments