5
5
import baritone .api .pathing .goals .GoalBlock ;
6
6
import meteordevelopment .meteorclient .systems .modules .Modules ;
7
7
import meteordevelopment .meteorclient .utils .player .PlayerUtils ;
8
+ import meteordevelopment .meteorclient .utils .world .BlockUtils ;
8
9
import meteordevelopment .meteorclient .utils .world .Dimension ;
9
10
import nekiplay .meteorplus .features .modules .integrations .MapIntegration ;
11
+ import nekiplay .meteorplus .utils .RotationUtils ;
10
12
import net .minecraft .client .gui .screen .Screen ;
11
13
import net .minecraft .util .math .BlockPos ;
14
+ import net .minecraft .util .math .Vec3d ;
12
15
import org .spongepowered .asm .mixin .Mixin ;
13
16
import org .spongepowered .asm .mixin .injection .At ;
14
17
import org .spongepowered .asm .mixin .injection .Inject ;
23
26
24
27
import java .util .ArrayList ;
25
28
29
+ import static meteordevelopment .meteorclient .MeteorClient .mc ;
30
+
26
31
@ Mixin (WaypointReader .class )
27
32
public class WaypointRendererMixin {
28
33
@ Inject (method = "getRightClickOptions(Lxaero/map/mods/gui/Waypoint;Lxaero/map/gui/IRightClickableElement;)Ljava/util/ArrayList;" , at = @ At ("HEAD" ), remap = false , cancellable = true )
@@ -63,6 +68,33 @@ public boolean isActive() {
63
68
}
64
69
}).setNameFormatArgs (new Object []{"G" }));
65
70
71
+ rightClickOptions .add ((new RightClickOption ("gui.world_map.look_at_waypoint" , rightClickOptions .size (), target ) {
72
+ public void onAction (Screen screen ) {
73
+ Vec3d playerPos = mc .player .getPos ();
74
+ Vec3d blockCenter = new Vec3d (
75
+ element .getX () + 0.5 ,
76
+ element .getY () + 0.5 ,
77
+ element .getZ () + 0.5
78
+ );
79
+
80
+ // Вычисляем вектор направления от игрока к блоку
81
+ Vec3d direction = blockCenter .subtract (playerPos ).normalize ();
82
+
83
+ // Преобразуем вектор направления в углы поворота (yaw и pitch)
84
+ double distanceXZ = Math .sqrt (direction .x * direction .x + direction .z * direction .z );
85
+ float yaw = (float )Math .toDegrees (Math .atan2 (direction .z , direction .x )) - 90.0F ;
86
+ float pitch = (float )Math .toDegrees (-Math .atan2 (direction .y , distanceXZ ));
87
+
88
+ // Устанавливаем поворот игрока
89
+ mc .player .setYaw (yaw );
90
+ mc .player .setPitch (pitch );
91
+ }
92
+
93
+ public boolean isActive () {
94
+ return true ;
95
+ }
96
+ }).setNameFormatArgs (new Object []{"L" }));
97
+
66
98
rightClickOptions .add ((new RightClickOption ("gui.world_map.baritone_path_here" , rightClickOptions .size (), target ) {
67
99
public void onAction (Screen screen ) {
68
100
GoalBlock goal = new GoalBlock (new BlockPos (element .getX (), element .getY (), element .getZ ()));
@@ -78,15 +110,8 @@ public boolean isActive() {
78
110
rightClickOptions .add ((new RightClickOption ("gui.world_map.baritone_elytra_here" , rightClickOptions .size (), target ) {
79
111
public void onAction (Screen screen ) {
80
112
GoalBlock goal = new GoalBlock (new BlockPos (element .getX (), element .getY (), element .getZ ()));
81
- if (goal .getGoalPos ().getY () > 0 && goal .getGoalPos ().getY () < 128 ) {
82
- BaritoneAPI .getProvider ().getPrimaryBaritone ().getCustomGoalProcess ().setGoal (goal );
83
- for (IBaritone baritone : BaritoneAPI .getProvider ().getAllBaritones ()) {
84
- if (!baritone .getCommandManager ().getRegistry ().stream ().filter ((a ) -> a .getNames ().get (0 ).equalsIgnoreCase ("elytra" )).findAny ().isEmpty ()) {
85
- baritone .getCommandManager ().execute ("elytra" );
86
- break ;
87
- }
88
- }
89
- }
113
+ BaritoneAPI .getProvider ().getPrimaryBaritone ().getCustomGoalProcess ().setGoal (goal );
114
+ BaritoneAPI .getProvider ().getPrimaryBaritone ().getCommandManager ().execute ("elytra" );
90
115
}
91
116
92
117
public boolean isActive () {
0 commit comments