Skip to content

Commit

Permalink
Failsafe: = Teleport Check bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
onixiya1337 committed Apr 28, 2024
1 parent f7f6db2 commit e616a18
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 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.6.10
version=2.6.11
shouldRelease=true
20 changes: 11 additions & 9 deletions src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ public class FarmHelperConfig extends Config {

//<editor-fold desc="GENERAL">
@Info(
text = "Remember! In any gui related features, such as Auto God Pot, Auto Cookie, Auto Repellent, don't lock hotbar slot 7",
text = "DO NOT lock slot 7 in the hotbar if you're using any gui related features, such as Auto God Pot, Auto Cookie, Auto Repellent",
category = GENERAL,
type = InfoType.INFO
type = InfoType.WARNING,
size = 2
)
public static boolean guiInfo;

Expand Down Expand Up @@ -1800,11 +1801,12 @@ public enum SPRAYONATOR_ITEM {

//<editor-fold desc="DEBUG">
//<editor-fold desc="Debug">
@KeyBind(
name = "Debug Keybind", category = DEBUG, subcategory = "Debug"
)
public static OneKeyBind debugKeybind = new OneKeyBind(Keyboard.KEY_NONE);
// @KeyBind(

// @KeyBind(
// name = "Debug Keybind", category = DEBUG, subcategory = "Debug"
// )
// public static OneKeyBind debugKeybind = new OneKeyBind(Keyboard.KEY_NONE);
// @KeyBind(
// name = "Debug Keybind 2", category = DEBUG
// )
// public static OneKeyBind debugKeybind2 = new OneKeyBind(Keyboard.KEY_H);
Expand Down Expand Up @@ -2072,8 +2074,8 @@ public FarmHelperConfig() {

registerKeyBind(openGuiKeybind, this::openGui);
registerKeyBind(toggleMacro, () -> MacroHandler.getInstance().toggleMacro());
registerKeyBind(debugKeybind, () -> {
});
// registerKeyBind(debugKeybind, () -> {
// });
registerKeyBind(freelookKeybind, () -> Freelook.getInstance().toggle());
registerKeyBind(plotCleaningHelperKeybind, () -> PlotCleaningHelper.getInstance().toggle());
registerKeyBind(enablePestsDestroyerKeyBind, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import net.minecraftforge.fml.common.gameevent.TickEvent;

import java.awt.*;
import java.util.Collections;
import java.util.Comparator;
import java.util.Optional;

public class TeleportFailsafe extends Failsafe {
Expand Down Expand Up @@ -100,7 +100,8 @@ public void onReceivedPacketDetection(ReceivePacketEvent event) {
LogUtils.sendDebug("[Failsafe] Teleport packet received while Fly pathfinder is running. Ignoring");
return;
}
Optional<Tuple<BlockPos, AbstractMacro.State>> lastWalkedPosition = lastWalkedPositions.stream().filter(pos -> pos.getFirst().equals(packetPlayerBlockPos)).min(Collections.reverseOrder());
Comparator<Tuple<BlockPos, AbstractMacro.State>> comparator = Comparator.comparing(Tuple::getFirst, Comparator.reverseOrder());
Optional<Tuple<BlockPos, AbstractMacro.State>> lastWalkedPosition = lastWalkedPositions.stream().filter(pos -> pos.getFirst().equals(packetPlayerBlockPos)).min(comparator);
if (lastWalkedPosition.isPresent()) {
if (packetPlayerPos.distanceTo(currentPlayerPos) < 1) {
LogUtils.sendDebug("[Failsafe] AntiStuck should trigger there. Ignoring");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ public void stop() {
IFeature.super.stop();
if (isRunning()) {
LogUtils.sendDebug("[Movement Recorder] Playing has been stopped.");
return;
}
LogUtils.sendDebug("[Movement Recorder] No recording has been started.");
}

@SubscribeEvent
Expand All @@ -235,8 +233,8 @@ public void onTickPlayMovement(TickEvent.ClientTickEvent event) {
if (!MacroHandler.getInstance().isMacroToggled()) {
if (isRunning()) {
LogUtils.sendDebug("[Movement Recorder] Macro has been disabled. Stopping playing.");
stop();
}
stop();
resetStatesAfterMacroDisabled();
return;
}
Expand Down Expand Up @@ -267,8 +265,8 @@ public void onTickPlayMovement(TickEvent.ClientTickEvent event) {
currentDelay = 0;
if (playingIndex >= movements.size()) {
isMovementPlaying = false;
resetTimers();
LogUtils.sendDebug("[Movement Recorder] Playing has been finished.");
stop();
resetStatesAfterMacroDisabled();
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/jelly/farmhelperv2/hud/DebugHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.jelly.farmhelperv2.failsafe.impl.GuestVisitFailsafe;
import com.jelly.farmhelperv2.failsafe.impl.LowerAvgBpsFailsafe;
import com.jelly.farmhelperv2.feature.FeatureManager;
import com.jelly.farmhelperv2.feature.IFeature;
import com.jelly.farmhelperv2.feature.impl.*;
import com.jelly.farmhelperv2.handler.GameStateHandler;
import com.jelly.farmhelperv2.handler.MacroHandler;
Expand Down Expand Up @@ -123,6 +124,9 @@ protected void getLines(List<String> lines, boolean example) {
}
if (!FeatureManager.getInstance().getCurrentRunningFeatures().isEmpty()) {
lines.add("Blocking Main Thread: " + FeatureManager.getInstance().getPauseExecutionFeatures().size());
for (IFeature feature : FeatureManager.getInstance().getPauseExecutionFeatures()) {
lines.add(" " + feature.getName());
}
lines.add("Running Features:");
FeatureManager.getInstance().getCurrentRunningFeatures().forEach(feature -> lines.add(" " + feature.getName()));
}
Expand Down

0 comments on commit e616a18

Please sign in to comment.