1919import meteordevelopment .meteorclient .settings .*;
2020import meteordevelopment .meteorclient .systems .modules .Module ;
2121import meteordevelopment .meteorclient .systems .modules .Modules ;
22+ import meteordevelopment .meteorclient .utils .misc .HorizontalDirection ;
2223import meteordevelopment .meteorclient .utils .misc .Keybind ;
2324import meteordevelopment .meteorclient .utils .player .FindItemResult ;
2425import meteordevelopment .meteorclient .utils .player .InvUtils ;
@@ -110,18 +111,26 @@ public class BaritoneMiner extends Module {
110111 );
111112
112113 public BaritoneMiner () {
113- super (NFAddon .Main , "baritone-miner-Beta " , "Paths automatically (BETA) ." );
114+ super (NFAddon .Main , " [BETA]- baritone-miner " , "Paths to dig automatically ." );
114115 }
115116
116- private BlockPos endOfLinePos , barPos , offsetPos , currPlayerPos , shulkerPlacePos , savedPos = null ;
117117 private Direction toEndOfLineDir , toAdvanceDir , shulkerPlaceDir = null ;
118+ private HorizontalDirection dir = null ;
119+ private BlockPos endOfLinePos , barPos , offsetPos , currPlayerPos , shulkerPlacePos , savedPos = null ;
118120 private boolean offsetting , bindPressed , isPaused , refilling , placedShulker , defined = false ;
119121 private int length , initialNetherrack , initialPicksBroken = 0 ;
120122
121123 Modules modules = Modules .get ();
122124
123125 @ Override
124126 public void onActivate () {
127+ baritoneSettings .blockPlacementPenalty .value = 0.0 ;
128+ baritoneSettings .assumeWalkOnLava .value = true ;
129+ baritoneSettings .allowPlace .value = true ;
130+ baritoneSettings .mineScanDroppedItems .value = true ;
131+
132+ dir = HorizontalDirection .get (mc .player .getYaw ());
133+
125134 if (!defined && !pathStart .get ()) {
126135 start ();
127136 } else if (!defined && pathStart .get ()) {
@@ -134,11 +143,6 @@ public void onActivate() {
134143
135144 initialPicksBroken = NFUtils .getPickaxesBroken ();
136145 initialNetherrack = NFUtils .getNetherrack ();
137-
138- baritoneSettings .blockPlacementPenalty .value = 0.0 ;
139- baritoneSettings .assumeWalkOnLava .value = true ;
140- baritoneSettings .allowPlace .value = true ;
141- baritoneSettings .mineScanDroppedItems .value = true ;
142146 }
143147
144148 @ Override
@@ -234,10 +238,13 @@ public void onTick(TickEvent.Pre event) throws InterruptedException {
234238 barPos = new BlockPos (barPos .offset (toEndOfLineDir ));
235239 }
236240 setGoal (barPos );
241+
242+ /**
237243 // Places a block under the goal to keep baritone from pulling any funny business
238244 if (underPos.getY() != cornerOne.get().getY()) {
239245 placeUnder(barPos);
240246 }
247+ */
241248 } catch (Exception ignored ) {}
242249 }
243250
@@ -335,9 +342,9 @@ private void start() {
335342
336343 currPlayerPos = mc .player .getBlockPos ();
337344 BlockPos extrapolatePos = new BlockPos (cornerOne .get ().getX (), cornerOne .get ().getY (), cornerTwo .get ().getZ ());
338- // toEndOfLineDir = findBlockDir(cornerOne.get(), extrapolatePos);
345+ toEndOfLineDir = findBlockDir (cornerOne .get (), extrapolatePos );
339346 length = findDistance (cornerOne .get (), extrapolatePos , toEndOfLineDir );
340- // toAdvanceDir = findBlockDir(extrapolatePos, cornerTwo.get());
347+ toAdvanceDir = findBlockDir (extrapolatePos , cornerTwo .get ());
341348 endOfLinePos = currPlayerPos .offset (toEndOfLineDir , length );
342349 barPos = currPlayerPos .offset (toEndOfLineDir , 2 );
343350 shulkerPlaceDir = toEndOfLineDir .getOpposite ();
@@ -346,15 +353,15 @@ private void start() {
346353 setGoal (barPos );
347354 }
348355
349- /**
356+
350357 // Finds the direction for one block to get to the other
351358 private Direction findBlockDir (BlockPos originBlock , BlockPos goalBlock ) {
352359 // Very bad this can very easily break if the 2 blocks positions are not inline with each other
353360 BlockPos vec3d = BlockPos .ofFloored (Math .signum (goalBlock .getX () - originBlock .getX ()), 0 , Math .signum (goalBlock .getZ () - originBlock .getZ ()));
354- return Direction.fromVector( vec3d);
361+ return Direction .getFacing ( Vec3d . of ( vec3d )). getOpposite ( );
355362 }
356- */
357363
364+ /**
358365 // Places a block below the input
359366 private void placeUnder(BlockPos pos) {
360367 if (mc.world == null) return;
@@ -364,6 +371,7 @@ private void placeUnder(BlockPos pos) {
364371 BlockUtils.place(under, InvUtils.findInHotbar(Blocks.NETHERRACK.asItem()), false, 0);
365372 }
366373 }
374+ */
367375
368376 private void setGoal (BlockPos goal ) {
369377 baritone .getCustomGoalProcess ().setGoalAndPath (new GoalBlock (goal ));
@@ -373,14 +381,12 @@ private void setGoal(BlockPos goal) {
373381 private int findDistance (BlockPos pos1 , BlockPos pos2 , Direction dir ) {
374382 int dist = 0 ;
375383 switch (dir ) {
376- case EAST , SOUTH -> {
384+ case NORTH , SOUTH -> {
385+ dist = Math .abs (pos1 .getZ () - pos2 .getZ ());
377386 }
378- case WEST -> {
387+ case EAST , WEST -> {
379388 dist = Math .abs (pos1 .getX () - pos2 .getX ());
380389 }
381- case NORTH -> {
382- dist = Math .abs (pos1 .getZ () - pos2 .getZ ());
383- }
384390 }
385391 return dist ;
386392 }
0 commit comments