Skip to content

Commit b3be590

Browse files
committed
Hopefully nothing is broken
AutoRepellent: - probably still broken but at least it should try opening inventory now instead of waiting Lower Average BPS: - disables temporarily if the farming tool cannot be found to prevent false positives Farming tool selection: - added support for /neurename command, enjoy calling your hoes whatever you want
1 parent 8155e52 commit b3be590

File tree

7 files changed

+87
-73
lines changed

7 files changed

+87
-73
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2
44
mcVersion=1.8.9
55
modid=farmhelperv2
66
modName=FarmHelper
7-
version=2.8.9-pre5
7+
version=2.8.9-pre6
88
shouldRelease=true

src/main/java/com/jelly/farmhelperv2/config/page/FailsafeNotificationsPage.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public class FailsafeNotificationsPage {
113113
description = "Whether or not to send a notification when the average BPS is lower than the specified value.",
114114
category = "Failsafe Notifications"
115115
)
116-
public static boolean notifyOnLowerAverageBPS = false;
116+
public static boolean notifyOnLowerAverageBPS = true;
117117

118118
@Switch(
119119
name = "Guest Visit Notifications",
@@ -239,7 +239,7 @@ public class FailsafeNotificationsPage {
239239
description = "Whether or not to play a sound when the average BPS is lower than the specified value.",
240240
category = "Failsafe Sound Alerts"
241241
)
242-
public static boolean alertOnLowerAverageBPS = false;
242+
public static boolean alertOnLowerAverageBPS = true;
243243

244244
@Switch(
245245
name = "Guest Visit Alert",
@@ -359,7 +359,7 @@ public class FailsafeNotificationsPage {
359359
description = "Whether or not to tag everyone in the webhook message when the average BPS is lower than the specified value.",
360360
category = "Failsafe Tag Everyone"
361361
)
362-
public static boolean tagEveryoneOnLowerAverageBPS = false;
362+
public static boolean tagEveryoneOnLowerAverageBPS = true;
363363

364364
@Switch(
365365
name = "Guest Visit Tag Everyone",
@@ -478,7 +478,7 @@ public class FailsafeNotificationsPage {
478478
description = "Whether or not to automatically alt-tab when the average BPS is lower than the specified value.",
479479
category = "Failsafe Auto Alt-tab"
480480
)
481-
public static boolean autoAltTabOnLowerAverageBPS = false;
481+
public static boolean autoAltTabOnLowerAverageBPS = true;
482482
@Switch(
483483
name = "Guest Visit Alt-tab",
484484
description = "Whether or not to automatically alt-tab when a guest visits your island.",

src/main/java/com/jelly/farmhelperv2/failsafe/FailsafeManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public FailsafeManager() {
113113
DirtFailsafe.getInstance(),
114114
DisconnectFailsafe.getInstance(),
115115
EvacuateFailsafe.getInstance(),
116-
FullInventoryFailsafe .getInstance(),
116+
FullInventoryFailsafe.getInstance(),
117117
GuestVisitFailsafe.getInstance(),
118118
ItemChangeFailsafe.getInstance(),
119119
JacobFailsafe.getInstance(),

src/main/java/com/jelly/farmhelperv2/feature/impl/AutoRepellent.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ public void onTickExecution(TickEvent.ClientTickEvent event) {
258258
break;
259259
case SWAP_REPELLENT_TO_HOTBAR_PUT:
260260
if (mc.currentScreen == null) {
261-
LogUtils.sendDebug("Waiting for nothing");
261+
LogUtils.sendDebug("Inventory is closed! Changing state to: SWAP_REPELLENT_TO_HOTBAR_PICKUP");
262+
moveRepellentState = MoveRepellentState.SWAP_REPELLENT_TO_HOTBAR_PICKUP;
262263
delay.schedule(300 + (long) (Math.random() * 300));
263264
break;
264265
}
@@ -277,7 +278,8 @@ public void onTickExecution(TickEvent.ClientTickEvent event) {
277278
break;
278279
case SWAP_REPELLENT_TO_HOTBAR_PUT_BACK:
279280
if (mc.currentScreen == null) {
280-
LogUtils.sendDebug("Waiting for nothing");
281+
moveRepellentState = MoveRepellentState.SWAP_REPELLENT_TO_HOTBAR_PICKUP;
282+
LogUtils.sendDebug("Inventory is closed! Changing state to: SWAP_REPELLENT_TO_HOTBAR_PICKUP");
281283
delay.schedule(300 + (long) (Math.random() * 300));
282284
break;
283285
}
@@ -300,7 +302,8 @@ public void onTickExecution(TickEvent.ClientTickEvent event) {
300302
break;
301303
case PUT_ITEM_BACK_PUT:
302304
if (mc.currentScreen == null) {
303-
LogUtils.sendDebug("Waiting for nothing");
305+
moveRepellentState = MoveRepellentState.PUT_ITEM_BACK_PICKUP;
306+
LogUtils.sendDebug("Inventory is closed! Changing state to: PUT_ITEM_BACK_PICKUP");
304307
delay.schedule(300 + (long) (Math.random() * 300));
305308
break;
306309
}

src/main/java/com/jelly/farmhelperv2/feature/impl/BPSTracker.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.jelly.farmhelperv2.feature.impl;
22

33
import cc.polyfrost.oneconfig.utils.Multithreading;
4+
import com.jelly.farmhelperv2.config.FarmHelperConfig;
45
import com.jelly.farmhelperv2.event.PlayerDestroyBlockEvent;
56
import com.jelly.farmhelperv2.feature.IFeature;
67
import com.jelly.farmhelperv2.handler.GameStateHandler;
@@ -148,7 +149,8 @@ public boolean dontCheckForBPS() {
148149
|| MacroHandler.getInstance().isTeleporting()
149150
|| MacroHandler.getInstance().isRewarpTeleport()
150151
|| MacroHandler.getInstance().isStartingUp()
151-
|| !checkForBPS(MacroHandler.getInstance().getMacro().getCurrentState());
152+
|| !checkForBPS(MacroHandler.getInstance().getMacro().getCurrentState())
153+
|| MacroHandler.getInstance().getCrop() == FarmHelperConfig.CropEnum.NONE;
152154
}
153155

154156
public float getBPSFloat() {

src/main/java/com/jelly/farmhelperv2/util/InventoryUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static Slot getSlotOfItemInInventory(String item) {
123123
return null;
124124
}
125125

126-
public static Slot getSlotOfItemByHypixelIdInInventory(String hypixelId) {
126+
public static int getSlotOfItemByHypixelIdInInventory(String hypixelId) {
127127
for (Slot slot : mc.thePlayer.inventoryContainer.inventorySlots) {
128128
if (slot.getHasStack()) {
129129
NBTTagCompound tag = slot.getStack().getTagCompound();
@@ -132,13 +132,13 @@ public static Slot getSlotOfItemByHypixelIdInInventory(String hypixelId) {
132132
if (extraAttributes.hasKey("id")) {
133133
String id = extraAttributes.getString("id");
134134
if (id.equals(hypixelId)) {
135-
return slot;
135+
return slot.getSlotIndex();
136136
}
137137
}
138138
}
139139
}
140140
}
141-
return null;
141+
return -1;
142142
}
143143

144144
public static String getInventoryName() {

src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java

Lines changed: 69 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import net.minecraft.entity.Entity;
1212
import net.minecraft.entity.player.EntityPlayer;
1313
import net.minecraft.init.Blocks;
14+
import net.minecraft.nbt.NBTTagCompound;
1415
import net.minecraft.util.*;
1516
import org.apache.commons.lang3.tuple.Pair;
1617

@@ -110,7 +111,7 @@ public static FarmHelperConfig.CropEnum getFarmingCrop() {
110111
return FarmHelperConfig.CropEnum.CACTUS;
111112
}
112113
}
113-
LogUtils.sendError("Can't detect crop type!");
114+
LogUtils.sendError("Can't detect crop type! Lower average BPS failsafe will be disabled!");
114115
return FarmHelperConfig.CropEnum.NONE;
115116
}
116117

@@ -174,67 +175,75 @@ public static int getFarmingTool(FarmHelperConfig.CropEnum crop, boolean withErr
174175
if (crop == null) return withError ? -1 : 0;
175176
for (int i = 36; i < 44; i++) {
176177
if (mc.thePlayer.inventoryContainer.inventorySlots.get(i).getStack() != null) {
177-
String name = mc.thePlayer.inventoryContainer.inventorySlots.get(i).getStack().getDisplayName();
178-
if (anyHoe) {
179-
if (name.contains("Hoe") || name.contains("Dicer") || name.contains("Chopper") || name.contains("Fungi") || name.contains("Daedalus Axe") || name.contains("Knife")) {
180-
return i - 36;
181-
}
182-
continue;
183-
}
184-
switch (crop) {
185-
case NETHER_WART:
186-
if (name.contains("Newton")) {
187-
return i - 36;
188-
}
189-
continue;
190-
case CARROT:
191-
if (name.contains("Gauss")) {
192-
return i - 36;
193-
}
194-
continue;
195-
case WHEAT:
196-
if (name.contains("Euclid")) {
197-
return i - 36;
198-
}
199-
continue;
200-
case POTATO:
201-
if (name.contains("Pythagorean")) {
202-
return i - 36;
203-
}
204-
continue;
205-
case SUGAR_CANE:
206-
if (name.contains("Turing")) {
207-
return i - 36;
208-
}
209-
continue;
210-
case CACTUS:
211-
if (name.contains("Knife")) {
212-
return i - 36;
213-
}
214-
continue;
215-
case MUSHROOM:
216-
if (name.contains("Fungi") || name.contains("Daedalus Axe")) {
217-
return i - 36;
218-
}
219-
continue;
220-
case PUMPKIN_MELON_UNKNOWN:
221-
if (name.contains("Dicer")) {
222-
return i - 36;
223-
}
224-
continue;
225-
case MELON:
226-
if (name.contains("Melon Dicer")) {
227-
return i - 36;
228-
}
229-
case PUMPKIN:
230-
if (name.contains("Pumpkin Dicer")) {
231-
return i - 36;
178+
NBTTagCompound tag = mc.thePlayer.inventoryContainer.inventorySlots.get(i).getStack().getTagCompound();
179+
if (tag != null && tag.hasKey("ExtraAttributes")) {
180+
NBTTagCompound extraAttributes = tag.getCompoundTag("ExtraAttributes");
181+
if (extraAttributes.hasKey("id")) {
182+
String name = extraAttributes.getString("id");
183+
if (name == null)
184+
continue;
185+
if (anyHoe) {
186+
if (name.contains("HOE") || name.contains("DICER") || name.contains("CHOPPER") || name.contains("FUNGI") || name.contains("DAEDALUS_AXE") || name.contains("KNIFE")) {
187+
return i - 36;
188+
}
189+
continue;
232190
}
233-
continue;
234-
case COCOA_BEANS:
235-
if (name.contains("Chopper")) {
236-
return i - 36;
191+
switch (crop) {
192+
case NETHER_WART:
193+
if (name.contains("HOE_WARTS_3") || name.contains("HOE_WARTS_2") || name.contains("HOE_WARTS")) {
194+
return i - 36;
195+
}
196+
continue;
197+
case CARROT:
198+
if (name.contains("HOE_CARROT_3") || name.contains("HOE_CARROT_2") || name.contains("HOE_CARROT")) {
199+
return i - 36;
200+
}
201+
continue;
202+
case WHEAT:
203+
if (name.contains("HOE_WHEAT_3") || name.contains("HOE_WHEAT_2") || name.contains("HOE_WHEAT")) {
204+
return i - 36;
205+
}
206+
continue;
207+
case POTATO:
208+
if (name.contains("HOE_POTATO_3") || name.contains("HOE_POTATO_2") || name.contains("HOE_POTATO")) {
209+
return i - 36;
210+
}
211+
continue;
212+
case SUGAR_CANE:
213+
if (name.contains("HOE_CANE_3") || name.contains("HOE_CANE_2") || name.contains("HOE_CANE")) {
214+
return i - 36;
215+
}
216+
continue;
217+
case CACTUS:
218+
if (name.contains("CACTUS_KNIFE")) {
219+
return i - 36;
220+
}
221+
continue;
222+
case MUSHROOM:
223+
if (name.contains("FUNGI_CUTTER") || name.contains("DAEDALUS_AXE")) {
224+
return i - 36;
225+
}
226+
continue;
227+
case PUMPKIN_MELON_UNKNOWN:
228+
if (name.contains("_DICER")) {
229+
return i - 36;
230+
}
231+
continue;
232+
case MELON:
233+
if (name.contains("MELON_DICER_3") || name.contains("MELON_DICER_2") || name.contains("MELON_DICER")) {
234+
return i - 36;
235+
}
236+
case PUMPKIN:
237+
if (name.contains("PUMPKIN_DICER_3") || name.contains("PUMPKIN_DICER_2") || name.contains("PUMPKIN_DICER")) {
238+
return i - 36;
239+
}
240+
continue;
241+
case COCOA_BEANS:
242+
if (name.contains("COCO_CHOPPER")) {
243+
return i - 36;
244+
}
237245
}
246+
}
238247
}
239248
}
240249
}

0 commit comments

Comments
 (0)