55import baritone .api .pathing .goals .GoalBlock ;
66import meteordevelopment .meteorclient .systems .modules .Modules ;
77import meteordevelopment .meteorclient .utils .player .PlayerUtils ;
8+ import meteordevelopment .meteorclient .utils .world .BlockUtils ;
89import meteordevelopment .meteorclient .utils .world .Dimension ;
910import nekiplay .meteorplus .features .modules .integrations .MapIntegration ;
11+ import nekiplay .meteorplus .utils .RotationUtils ;
1012import net .minecraft .client .gui .screen .Screen ;
1113import net .minecraft .util .math .BlockPos ;
14+ import net .minecraft .util .math .Vec3d ;
1215import org .spongepowered .asm .mixin .Mixin ;
1316import org .spongepowered .asm .mixin .injection .At ;
1417import org .spongepowered .asm .mixin .injection .Inject ;
2326
2427import java .util .ArrayList ;
2528
29+ import static meteordevelopment .meteorclient .MeteorClient .mc ;
30+
2631@ Mixin (WaypointReader .class )
2732public class WaypointRendererMixin {
2833 @ 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() {
6368 }
6469 }).setNameFormatArgs (new Object []{"G" }));
6570
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+
6698 rightClickOptions .add ((new RightClickOption ("gui.world_map.baritone_path_here" , rightClickOptions .size (), target ) {
6799 public void onAction (Screen screen ) {
68100 GoalBlock goal = new GoalBlock (new BlockPos (element .getX (), element .getY (), element .getZ ()));
@@ -78,15 +110,8 @@ public boolean isActive() {
78110 rightClickOptions .add ((new RightClickOption ("gui.world_map.baritone_elytra_here" , rightClickOptions .size (), target ) {
79111 public void onAction (Screen screen ) {
80112 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" );
90115 }
91116
92117 public boolean isActive () {
0 commit comments