Skip to content

Commit f44bd8e

Browse files
committed
More fixes
1 parent cce50e4 commit f44bd8e

5 files changed

Lines changed: 119 additions & 117 deletions

File tree

src/main/java/me/redcarlos/netherfreedom/modules/hud/WelcomeHudNF.java

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@
1616
import static meteordevelopment.meteorclient.MeteorClient.mc;
1717

1818
public class WelcomeHudNF extends HudElement {
19-
public static final HudElementInfo<WelcomeHudNF> INFO = new HudElementInfo<>(NFAddon.Hud, "welcome-hud", "Displays a friendly welcome.", WelcomeHudNF::new);
20-
21-
private final SettingGroup sgGeneral = settings.getDefaultGroup();
22-
23-
private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
24-
.name("mode")
25-
.description("What text to show for the greeting.")
26-
.defaultValue(Mode.Time)
27-
.build()
28-
);
19+
public static final HudElementInfo<WelcomeHudNF> INFO = new HudElementInfo<>(NFAddon.Hud, "welcome-hud-NF", "Displays a friendly welcome.", WelcomeHudNF::new);
2920

3021
private String leftText;
3122
private String rightText;
@@ -37,13 +28,7 @@ public WelcomeHudNF() {
3728

3829
@Override
3930
public void tick(HudRenderer renderer) {
40-
int localTime = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
41-
42-
if (mode.get() == Mode.NetherFreedom) leftText = "Welcome to NF Client, ";
43-
else if (localTime <= 12) leftText = "Good Morning, ";
44-
else if (localTime <= 16) leftText = "Good Afternoon, ";
45-
else leftText = "Good Evening, ";
46-
31+
leftText = "Welcome to NetherFreedom, ";
4732
rightText = Modules.get().get(NameProtect.class).getName(mc.getSession().getUsername());
4833

4934
leftWidth = renderer.textWidth(leftText);
@@ -58,16 +43,11 @@ public void render(HudRenderer renderer) {
5843
double y = this.y;
5944

6045
if (isInEditor()) {
61-
renderer.text("NFWelcome", x, y, TextHud.getSectionColor(0), true);
46+
renderer.text("WelcomeHUD-NF", x, y, TextHud.getSectionColor(0), true);
6247
return;
6348
}
6449

6550
renderer.text(leftText, x, y, TextHud.getSectionColor(0), true);
6651
renderer.text(rightText, x + leftWidth, y, TextHud.getSectionColor(1), true);
6752
}
68-
69-
public enum Mode {
70-
NetherFreedom,
71-
Time
72-
}
7353
}

src/main/java/me/redcarlos/netherfreedom/modules/main/BaritoneMiner.java

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import meteordevelopment.meteorclient.settings.*;
2020
import meteordevelopment.meteorclient.systems.modules.Module;
2121
import meteordevelopment.meteorclient.systems.modules.Modules;
22+
import meteordevelopment.meteorclient.utils.misc.HorizontalDirection;
2223
import meteordevelopment.meteorclient.utils.misc.Keybind;
2324
import meteordevelopment.meteorclient.utils.player.FindItemResult;
2425
import 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

Comments
 (0)