Skip to content

Commit

Permalink
AutoBazaar (Visitors):
Browse files Browse the repository at this point in the history
 = Fixed one issue with buying custom amount and not resetting after visitors macro stuck

PDOTT:
 = Fixed rarely not detecting proper POV

Profit Calculator:
 = Fixed BPS being counted even if macro is paused (during other features)
  • Loading branch information
May2Beez committed Apr 14, 2024
1 parent 807b591 commit 8e11c4d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2
mcVersion=1.8.9
modid=farmhelperv2
modName=FarmHelper
version=2.5.17
version=2.5.18
shouldRelease=true
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private void handleBuyFromBz() {
Slot customAmount = InventoryUtils.getSlotOfItemInContainer("Custom Amount");
if (customAmount != null && customAmount.getHasStack()) {
this.buyState = BuyState.OPEN_SIGN;
this.buyNowButtonSlot = customAmount.slotNumber;
this.buyNowButtonSlot = 13;
LogUtils.sendDebug("[Auto Bazaar] Buying custom amount");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private Optional<Entity> getPest(boolean start) {
double zDiff = entityPosition.zCoord - playerPosition.zCoord;

float yaw = (float) Math.toDegrees(Math.atan2(zDiff, xDiff)) - 90F;
float yawDiff = Math.abs(MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - yaw);
float yawDiff = Math.abs(MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - MathHelper.wrapAngleTo180_float(yaw));
if (FarmHelperConfig.showDebugLogsAboutPDOTT)
LogUtils.sendDebug("Entity Pos: " + e.getPositionVector() + " | CurrenYaw: " + MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) + " | YawNeeded: " + yaw + " | YawDiff: " + yawDiff + " | Dist: " + dist);
returnResult = dist <= vacuumRange - 0.5 && yawDiff <= FarmHelperConfig.pestsDestroyerOnTheTrackFOV / 2f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ public void resetProfits() {
@SubscribeEvent
public void onTickUpdateBPS(MillisecondEvent event) {
if (!MacroHandler.getInstance().isMacroToggled()) return;
if (MacroHandler.getInstance().isCurrentMacroPaused()) return;

if (bpsClock.passed()) {
bpsClock.schedule(1_000);
Expand All @@ -246,8 +247,7 @@ public void onTickUpdateBPS(MillisecondEvent event) {
@SubscribeEvent
public void onTickUpdateProfit(TickEvent.ClientTickEvent event) {
if (!MacroHandler.getInstance().isMacroToggled()) return;
if (!MacroHandler.getInstance().isCurrentMacroEnabled()) return;
if (!GameStateHandler.getInstance().inGarden()) return;
if (MacroHandler.getInstance().isCurrentMacroPaused()) return;

double profit = 0;
ItemStack currentItem = mc.thePlayer.getHeldItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public void stop() {
manuallyStarted = false;
LogUtils.sendWarning("[Visitors Macro] Macro stopped");
rotation.reset();
AutoBazaar.getInstance().stop();
PlayerUtils.closeScreen();
KeyBindUtils.stopMovement();
BaritoneHandler.stopPathing();
Expand Down Expand Up @@ -710,7 +711,7 @@ private void onVisitorsState() {
}
LogUtils.sendDebug("Position of visitor: " + result.entityCharacter.getPositionEyes(1));
if (mc.thePlayer.getDistanceToEntity(result.entityCharacter) > 3) {
Vec3 closestVec = PlayerUtils.getClosestVecAround(result.entityCharacter, 1.35, 90, 45);
Vec3 closestVec = PlayerUtils.getClosestVecAround(result.entityCharacter, 1.35, 45, 0);
if (closestVec == null) {
LogUtils.sendError("[Visitors Macro] Couldn't find a position to get closer");
stop();
Expand Down Expand Up @@ -1053,7 +1054,7 @@ private void onVisitorsState() {
}
LogUtils.sendDebug("Position of visitor: " + currentCharacter.get().getPositionEyes(1));
if (mc.thePlayer.getDistanceToEntity(currentCharacter.get()) > 3) {
Vec3 closestVec = PlayerUtils.getClosestVecAround(currentCharacter.get(), 1.35, 90, 45);
Vec3 closestVec = PlayerUtils.getClosestVecAround(currentCharacter.get(), 1.35, 45, 0);
if (closestVec == null) {
LogUtils.sendError("[Visitors Macro] Couldn't find a position to get closer");
stop();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public static int getFarmingTool(FarmHelperConfig.CropEnum crop, boolean withErr
}
}

int gardeningHoe = InventoryUtils.getSlotIdOfItemInHotbar("Gardening Hoe");
int gardeningHoe = InventoryUtils.getSlotIdOfItemInHotbar("Gardening Hoe", "Gardening Axe");
if (gardeningHoe != -1) {
return gardeningHoe;
}
Expand Down

0 comments on commit 8e11c4d

Please sign in to comment.