aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java27
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt47
2 files changed, 62 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java
index c6ccfc3e9..ae2819317 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorKeybind;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
@@ -32,6 +33,32 @@ public class PestFinderConfig {
@Expose
@ConfigOption(
+ name = "Plot Visibility Type",
+ desc = "Choose how to show infested plots in the world."
+ )
+ @ConfigEditorDropdown
+ public VisibilityType visibilityType = VisibilityType.BOTH;
+
+ public enum VisibilityType {
+ BORDER("Border"),
+ NAME("Name"),
+ BOTH("Both"),
+ ;
+
+ private final String str;
+
+ VisibilityType(String str) {
+ this.str = str;
+ }
+
+ @Override
+ public String toString() {
+ return str;
+ }
+ }
+
+ @Expose
+ @ConfigOption(
name = "Only With Vacuum",
desc = "Only show the pest display and waypoints while holding a vacuum in the hand."
)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
index 9217f5eb6..289994862 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.features.garden.pests
+import at.hannibal2.skyhanni.config.features.garden.pests.PestFinderConfig.VisibilityType
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.ItemInHandChangeEvent
@@ -7,6 +8,7 @@ import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.garden.pests.PestUpdateEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
+import at.hannibal2.skyhanni.features.garden.GardenPlotAPI
import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.isPestCountInaccurate
import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.isPlayerInside
import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.name
@@ -16,6 +18,7 @@ import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.sendTeleportTo
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
@@ -111,25 +114,45 @@ class PestFinder {
if (config.onlyWithVacuum && !PestAPI.hasVacuumInHand() && (lastTimeVacuumHold.passedSince() > config.showBorderForSeconds.seconds)) return
val playerLocation = event.exactPlayerEyeLocation()
+ val visibility = config.visibilityType
+ val showBorder = visibility == VisibilityType.BOTH || visibility == VisibilityType.BORDER
+ val showName = visibility == VisibilityType.BOTH || visibility == VisibilityType.NAME
for (plot in PestAPI.getInfestedPlots()) {
if (plot.isPlayerInside()) {
- event.renderPlot(plot, LorenzColor.RED.toColor(), LorenzColor.DARK_RED.toColor())
+ if (showBorder) {
+ event.renderPlot(plot, LorenzColor.RED.toColor(), LorenzColor.DARK_RED.toColor())
+ }
continue
}
- event.renderPlot(plot, LorenzColor.GOLD.toColor(), LorenzColor.RED.toColor())
-
- val pests = plot.pests
- val pestsName = StringUtils.pluralize(pests, "pest")
- val plotName = plot.name
- val middle = plot.middle
- val isInaccurate = plot.isPestCountInaccurate
- val location = playerLocation.copy(x = middle.x, z = middle.z)
- event.drawWaypointFilled(location, LorenzColor.RED.toColor())
- val text = "§e" + (if (isInaccurate) "?" else pests) + " §c$pestsName §7in §b$plotName"
- event.drawDynamicText(location, text, 1.5)
+ if (showBorder) {
+ event.renderPlot(plot, LorenzColor.GOLD.toColor(), LorenzColor.RED.toColor())
+ }
+ if (showName) {
+ drawName(plot, playerLocation, event)
+ }
}
}
+ private fun drawName(
+ plot: GardenPlotAPI.Plot,
+ playerLocation: LorenzVec,
+ event: LorenzRenderWorldEvent,
+ ) {
+ val pests = plot.pests
+ val pestsName = StringUtils.pluralize(pests, "pest")
+ val plotName = plot.name
+ val middle = plot.middle
+ val isInaccurate = plot.isPestCountInaccurate
+ val location = playerLocation.copy(x = middle.x, z = middle.z)
+ event.drawWaypointFilled(location, LorenzColor.RED.toColor())
+ val text = "§e" + (if (isInaccurate) "?" else
+ pests
+ ) + " §c$pestsName §7in §b$plotName"
+ event.drawDynamicText(
+ location, text, 1.5
+ )
+ }
+
private var lastKeyPress = SimpleTimeMark.farPast()
@SubscribeEvent