Skip to content

Commit

Permalink
GameState:
Browse files Browse the repository at this point in the history
 = Cultivating should work more precisely
  • Loading branch information
May2Beez committed Feb 28, 2024
1 parent 57b738a commit cb36878
Show file tree
Hide file tree
Showing 3 changed files with 14 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.4.5-pre13
version=2.4.5-pre14
shouldRelease=true
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S2FPacketSetSlot;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.StringUtils;
Expand Down Expand Up @@ -554,13 +555,14 @@ public int getPestsFromVacuum() {
public Long getCultivating(ItemStack item) {
if (mc.theWorld == null || mc.thePlayer == null)
return 0L;
for (String lore : InventoryUtils.getItemLore(item)) {
if (lore.contains("Cultivating")) {
Matcher matcher = cultivatingPattern.matcher(lore);
if (matcher.find()) {
String foundInteger = matcher.group(1).replace(",", "");
return Long.parseLong(foundInteger);
}
NBTTagCompound tag = item.getTagCompound();
if (tag == null)
return 0L;
if (tag.hasKey("ExtraAttributes", 10)) {
NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");

if (ea.hasKey("farmed_cultivating", 99)) {
return (long) ea.getInteger("farmed_cultivating");
}
}
return 0L;
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/com/jelly/farmhelperv2/hud/DebugHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import com.jelly.farmhelperv2.handler.BaritoneHandler;
import com.jelly.farmhelperv2.handler.GameStateHandler;
import com.jelly.farmhelperv2.handler.MacroHandler;
import com.jelly.farmhelperv2.pathfinder.WorldCache;
import com.jelly.farmhelperv2.util.LogUtils;
import com.jelly.farmhelperv2.util.helper.FlyPathfinder;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;

import java.util.List;
import java.util.Map;
Expand All @@ -38,7 +39,6 @@ protected void getLines(List<String> lines, boolean example) {
lines.add("Current state: " + macro.getCurrentState());
lines.add("Rotating: " + macro.getRotation().isRotating());
});
lines.add("Cached blocks: " + WorldCache.getInstance().getWorldCache().size());
lines.add("Current plot: " + GameStateHandler.getInstance().getCurrentPlot());
lines.add("Directions: ");
lines.add(" Forward: " + GameStateHandler.getInstance().isFrontWalkable());
Expand All @@ -47,18 +47,14 @@ protected void getLines(List<String> lines, boolean example) {
lines.add(" Right: " + GameStateHandler.getInstance().isRightWalkable());
lines.add(" Not moving: " + GameStateHandler.getInstance().notMoving());
lines.add(" HasPassedSinceStopped: " + GameStateHandler.getInstance().hasPassedSinceStopped());
ItemStack heldItem = Minecraft.getMinecraft().thePlayer.getHeldItem();
lines.add("Cultivating: " + GameStateHandler.getInstance().getCurrentCultivating().getOrDefault(heldItem != null ? heldItem.getDisplayName() : "", 0L));
if (Scheduler.getInstance().isToggled()) {
lines.add("Scheduler: ");
lines.add(" State: " + LogUtils.capitalize(Scheduler.getInstance().getSchedulerState().toString()));
lines.add(" Clock: " + Scheduler.getInstance().getSchedulerClock().getRemainingTime());
lines.add(" isFarming: " + Scheduler.getInstance().isFarming());
}
lines.add("Buffs");
lines.add(" Cookie: " + GameStateHandler.getInstance().getCookieBuffState());
lines.add(" God Pot: " + GameStateHandler.getInstance().getGodPotState());
final boolean isRepellentFailsafe = GameStateHandler.getInstance().getPestRepellentState() == GameStateHandler.BuffState.FAILSAFE;
lines.add(" Repellent: " + GameStateHandler.getInstance().getPestRepellentState() +
(isRepellentFailsafe ? "" : AutoRepellent.repellentFailsafeClock.passed() ? "" : " & FAILSAFE"));
if (AutoCookie.getInstance().isRunning()) {
lines.add("AutoCookie");
lines.add(" Main State: " + AutoCookie.getInstance().getMainState());
Expand Down

0 comments on commit cb36878

Please sign in to comment.