Skip to content

Commit

Permalink
+ Streamer Mode - hides visual Farm Helper elements
Browse files Browse the repository at this point in the history
+ Auto Pest Hunter - you can now disable highlighting desk location
- Hide Logs - removed due to the new streamer mode
  • Loading branch information
onixiya1337 committed Mar 8, 2024
1 parent 1300155 commit fb4a7b4
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 37 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.4.5-pre27
version=2.4.5-pre28
shouldRelease=true
4 changes: 3 additions & 1 deletion src/main/java/com/jelly/farmhelperv2/FarmHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public void init(FMLInitializationEvent event) {
mc.gameSettings.pauseOnLostFocus = false;
mc.gameSettings.gammaSetting = 1000;
isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().toString().contains("-agentlib:jdwp");
Display.setTitle("Farm Helper 〔v" + VERSION + "〕 " + (!isDebug ? "Bing Chilling" : "wazzup dev?") + " ☛ " + Minecraft.getMinecraft().getSession().getUsername());
if (!FarmHelperConfig.streamerMode)
Display.setTitle("Farm Helper 〔v" + VERSION + "〕 " + (!isDebug ? "Bing Chilling" : "wazzup dev?") + " ☛ " + Minecraft.getMinecraft().getSession().getUsername());
FailsafeUtils.getInstance();

ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
Expand Down Expand Up @@ -141,6 +142,7 @@ private void initializeCommands() {
public void onLastRender(RenderWorldLastEvent event) {
if (mc.thePlayer == null || mc.theWorld == null) return;
if (!FarmHelperConfig.showDebugPathfindingRoute) return;
if (FarmHelperConfig.streamerMode) return;

Vec3 position = mc.thePlayer.getPositionVector();

Expand Down
67 changes: 46 additions & 21 deletions src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,6 @@ public class FarmHelperConfig extends Config {
//</editor-fold>

//<editor-fold desc="Miscellaneous">
@Switch(
name = "Reward Claimer (BETA)", category = MISCELLANEOUS, subcategory = "Miscellaneous",
description = "Automatically claims contest rewards once you open Jacob's GUI"
)
public static boolean rewardClaimer = false;
@DualOption(
name = "AutoUpdater Version Type", category = MISCELLANEOUS, subcategory = "Miscellaneous",
description = "The version type to use",
Expand All @@ -276,16 +271,10 @@ public class FarmHelperConfig extends Config {
)
public static boolean autoUpdaterDownloadBetaVersions = false;
@Switch(
name = "Performance Mode", category = MISCELLANEOUS, subcategory = "Miscellaneous",
description = "Set render distance to 2, set max fps to 15 and doesn't render crops"
)
public static boolean performanceMode = false;
@Number(
name = "Max FPS", category = MISCELLANEOUS, subcategory = "Miscellaneous",
description = "The maximum FPS to set when performance mode is enabled",
min = 10, max = 60
name = "Reward Claimer (BETA)", category = MISCELLANEOUS, subcategory = "Miscellaneous",
description = "Automatically claims contest rewards once you open Jacob's GUI"
)
public static int performanceModeMaxFPS = 20;
public static boolean rewardClaimer = false;
@Switch(
name = "Mute The Game", category = MISCELLANEOUS, subcategory = "Miscellaneous",
description = "Mutes the game while farming"
Expand All @@ -309,6 +298,20 @@ public class FarmHelperConfig extends Config {
public static boolean autoUngrabMouse = true;
//</editor-fold>

//<editor-fold desc="Performance Mod">
@Switch(
name = "Performance Mode", category = MISCELLANEOUS, subcategory = "Performance Mode",
description = "Set render distance to 2, set max fps to 15 and doesn't render crops"
)
public static boolean performanceMode = false;
@Number(
name = "Max FPS", category = MISCELLANEOUS, subcategory = "Performance Mode",
description = "The maximum FPS to set when performance mode is enabled",
min = 10, max = 60
)
public static int performanceModeMaxFPS = 20;
//</editor-fold>

//<editor-fold desc="Crop Utils">
@Switch(
name = "Increase Cocoa Hitboxes", category = MISCELLANEOUS, subcategory = "Crop Utils",
Expand Down Expand Up @@ -1289,6 +1292,11 @@ public static void triggerManuallyPestsDestroyer() {
description = "Logs all events related to the auto pest hunter"
)
public static boolean logAutoPestHunterEvents = true;
@Switch(
name = "Highlight desk location", category = AUTO_PEST_HUNTER, subcategory = "Auto Pest Hunter",
description = "Highlights the pest hunter desk location"
)
public static boolean highlightPestHunterDeskLocation = true;
@Info(
text = "The auto pest hunter will start automatically once you rewarp!",
type = InfoType.WARNING,
Expand Down Expand Up @@ -1686,6 +1694,26 @@ public enum SPRAYONATOR_ITEM {
//</editor-fold>

//<editor-fold desc="HUD">
@Switch(
name = "Streamer mode", category = HUD, subcategory = "Streamer mode",
description = "Hides everything Farm Helper related from the screen."
)
public static boolean streamerMode = false;
@Info(
text = "Streamer mode does NOT disable failsafe notifications or sounds! It only hides visual elements.",
type = InfoType.WARNING,
category = HUD,
subcategory = "Streamer mode",
size = 2
)
public static boolean streamerModeInfo;
@Info(
text = "You must restart the game if you want to hide the window title after enabling the streamer mode.",
type = InfoType.WARNING,
category = HUD,
subcategory = "Streamer mode"
)
public static boolean streamerModeInfo2;
@HUD(
name = "Status HUD", category = HUD
)
Expand Down Expand Up @@ -1716,11 +1744,6 @@ public enum SPRAYONATOR_ITEM {
description = "Prints to chat what the bot is currently executing. Useful if you are having issues."
)
public static boolean debugMode = false;
@Switch(
name = "Hide Logs (Not Recommended)", category = DEBUG, subcategory = "Debug",
description = "Hides all logs from the console. Not recommended."
)
public static boolean hideLogs = false;
@Switch(
name = "Show rotation debug messages", category = DEBUG, subcategory = "Debug",
description = "Shows rotation debug messages"
Expand Down Expand Up @@ -1930,8 +1953,10 @@ public FarmHelperConfig() {
this.hideIf("infoRemoteControl", () -> Loader.isModLoaded("farmhelperjdadependency"));
this.hideIf("failsafeSoundTimes", () -> true);

this.addDependency("debugMode", "Debug Mode", () -> !hideLogs);
this.addDependency("hideLogs", "Hide Logs (Not Recommended)", () -> !debugMode);
this.addDependency("debugMode", "Streamer Mode", () -> !streamerMode);
this.addDependency("streamerMode", "Debug Mode", () -> !debugMode);
this.addDependency("streamerModeInfo", "debugMode");
this.addDependency("streamerModeInfo2", "debugMode");

this.addDependency("fastBreakSpeed", "fastBreak");
this.addDependency("disableFastBreakDuringBanWave", "fastBreak");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ public void onRenderOverlay(RenderGameOverlayEvent.Post event) {
String text = "Restarting the macro in: " + LogUtils.formatTime(restartMacroAfterFailsafeDelay.getRemainingTime());
RenderUtils.drawCenterTopText(text, event, Color.ORANGE);
} else if (triggeredFailsafe.isPresent()
&& !FarmHelperConfig.streamerMode
&& !triggeredFailsafe.get().equals(BanwaveFailsafe.getInstance())
&& !triggeredFailsafe.get().equals(EvacuateFailsafe.getInstance())
&& !triggeredFailsafe.get().equals(GuestVisitFailsafe.getInstance())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ public void onChatMessageReceived(ClientChatReceivedEvent event) {
public void onRenderWorldLast(RenderWorldLastEvent event) {
if (!isRunning()) return;
if (mc.thePlayer == null || mc.theWorld == null) return;
if (FarmHelperConfig.streamerMode) return;
if (!FarmHelperConfig.highlightPestHunterDeskLocation) return;
if (FarmHelperConfig.pestHunterDeskX == 0
&& FarmHelperConfig.pestHunterDeskY == 0
&& FarmHelperConfig.pestHunterDeskZ == 0) return;
RenderUtils.drawBlockBox(deskPos().add(0, 0, 0), new Color(0, 155, 255, 50));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ public void onChat(ClientChatReceivedEvent event) {
public void onRender(RenderWorldLastEvent event) {
if (mc.thePlayer == null || mc.theWorld == null) return;
if (!GameStateHandler.getInstance().inGarden()) return;
if (FarmHelperConfig.streamerMode) return;

List<Entity> pests = mc.theWorld.loadedEntityList.stream().filter(entity -> {
if (entity.isDead) return false;
Expand Down Expand Up @@ -1216,17 +1217,6 @@ public void onSpawnObject(SpawnObjectEvent event) {
}
}

@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event) {
if (mc.thePlayer == null || mc.theWorld == null) return;
if (!GameStateHandler.getInstance().inGarden()) return;
if (state != States.WAIT_FOR_LOCATION) return;
if (!lastFireworkLocation.isPresent()) return;
AxisAlignedBB boundingBox = new AxisAlignedBB(lastFireworkLocation.get().xCoord - 0.05, lastFireworkLocation.get().yCoord - 0.05, lastFireworkLocation.get().zCoord - 0.05, lastFireworkLocation.get().xCoord + 0.05, lastFireworkLocation.get().yCoord + 0.05, lastFireworkLocation.get().zCoord + 0.05);
RenderUtils.drawBox(boundingBox, Color.GREEN);

}

private int getAmountOfPestsInPlots() {
int pests = 0;
for (Map.Entry<Plot, Integer> plot : pestsPlotMap.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ public void onChatMessageReceived(ClientChatReceivedEvent event) {
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event) {
if (mc.thePlayer == null || mc.theWorld == null) return;
if (FarmHelperConfig.streamerMode) return;

if (FarmHelperConfig.highlightRewarp && FarmHelperConfig.rewarpList != null && GameStateHandler.getInstance().inGarden()) {
Color chroma = Color.getHSBColor((float) ((System.currentTimeMillis() / 10) % 2000) / 2000, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import cc.polyfrost.oneconfig.platform.Platform;
import cc.polyfrost.oneconfig.renderer.NanoVGHelper;
import cc.polyfrost.oneconfig.renderer.TextRenderer;
import com.jelly.farmhelperv2.config.FarmHelperConfig;
import com.jelly.farmhelperv2.feature.impl.ProfitCalculator;
import com.jelly.farmhelperv2.handler.GameStateHandler;
import com.jelly.farmhelperv2.handler.MacroHandler;
Expand Down Expand Up @@ -119,7 +120,7 @@ protected boolean shouldShow() {
if (!super.shouldShow()) {
return false;
}
return GameStateHandler.getInstance().inGarden();
return !FarmHelperConfig.streamerMode && GameStateHandler.getInstance().inGarden();
}

public void addLines() {
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/jelly/farmhelperv2/hud/StatusHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.jelly.farmhelperv2.feature.impl.LeaveTimer;
import com.jelly.farmhelperv2.feature.impl.PestsDestroyer;
import com.jelly.farmhelperv2.feature.impl.Scheduler;
import com.jelly.farmhelperv2.handler.GameStateHandler;
import com.jelly.farmhelperv2.handler.MacroHandler;
import com.jelly.farmhelperv2.remote.DiscordBotHandler;
import com.jelly.farmhelperv2.util.LogUtils;
Expand Down Expand Up @@ -85,6 +86,14 @@ protected float getWidth(List<String> lines) {
return width;
}

@Override
protected boolean shouldShow() {
if (!super.shouldShow()) {
return false;
}
return !FarmHelperConfig.streamerMode;
}

public String getStatusString() {
if (FailsafeManager.getInstance().triggeredFailsafe.isPresent()) {
return "Emergency: §l§5" + LogUtils.capitalize(FailsafeManager.getInstance().triggeredFailsafe.get().getType().name()) + "§r";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void initGui(CallbackInfo ci) {
AutoUpdaterGUI.showGUI();
}
}
if (AutoUpdaterGUI.isOutdated)
if (AutoUpdaterGUI.isOutdated && !FarmHelperConfig.streamerMode)
this.splashText = "Update Farm Helper <3";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ public void onDraw(RenderWorldLastEvent event) {
ArrayList<Vec3> copyPath = new ArrayList<>(path);
if (copyPath.isEmpty()) return;
if (!isRunning()) return;
if (FarmHelperConfig.streamerMode) return;
RenderManager renderManager = mc.getRenderManager();
Vec3 current = mc.thePlayer.getPositionVector();
Vec3 next = getNext(copyPath);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jelly/farmhelperv2/util/LogUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class LogUtils {
private static long statusMsgTime = -1;

public synchronized static void sendLog(ChatComponentText chat) {
if (mc.thePlayer != null && !FarmHelperConfig.hideLogs)
if (mc.thePlayer != null && !FarmHelperConfig.streamerMode)
mc.thePlayer.addChatMessage(chat);
else if (mc.thePlayer == null)
System.out.println("[Farm Helper] " + chat.getUnformattedText());
Expand Down

0 comments on commit fb4a7b4

Please sign in to comment.