diff options
Diffstat (limited to 'src/main')
4 files changed, 113 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 6263468fd..f41664ed3 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -144,6 +144,7 @@ import at.hannibal2.skyhanni.features.fishing.ThunderSparksHighlight import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker import at.hannibal2.skyhanni.features.fishing.tracker.FishingTrackerCategoryManager import at.hannibal2.skyhanni.features.fishing.tracker.SeaCreatureTracker +import at.hannibal2.skyhanni.features.fishing.trophy.GeyserFishing import at.hannibal2.skyhanni.features.fishing.trophy.OdgerWaypoint import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishFillet import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager @@ -495,6 +496,7 @@ class SkyHanniMod { loadModule(TrophyFishManager) loadModule(TrophyFishFillet()) loadModule(TrophyFishMessages()) + loadModule(GeyserFishing()) loadModule(BazaarBestSellMethod()) loadModule(ShiftClickBrewing()) loadModule(BazaarOpenPriceWebsite()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/GeyserFishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/GeyserFishingConfig.java new file mode 100644 index 000000000..a0f243ce5 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/GeyserFishingConfig.java @@ -0,0 +1,31 @@ +package at.hannibal2.skyhanni.config.features.fishing.trophyfishing; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import com.google.gson.annotations.Expose; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; +import io.github.moulberry.moulconfig.annotations.ConfigOption; + +public class GeyserFishingConfig { + + @Expose + @ConfigOption( + name = "Hide Geyser Particles", + desc = "Stops the white geyser smoke particles from rendering if your bobber is near the geyser.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideParticles = true; + + @Expose + @ConfigOption( + name = "Draw Geyser Box", + desc = "Draws a box around the effective area of the geyser.") + @ConfigEditorBoolean + @FeatureToggle + public boolean drawBox = true; + + @Expose + @ConfigOption(name = "Geyser Box Color", desc = "Color of the Geyser Box.") + @ConfigEditorColour + public String boxColor = "0:245:85:255:85"; +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/TrophyFishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/TrophyFishingConfig.java index ebcf64cec..1b180efc9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/TrophyFishingConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/trophyfishing/TrophyFishingConfig.java @@ -14,6 +14,11 @@ public class TrophyFishingConfig { public ChatMessagesConfig chatMessages = new ChatMessagesConfig(); @Expose + @ConfigOption(name = "Geyser Fishing", desc = "") + @Accordion + public GeyserFishingConfig geyserOptions = new GeyserFishingConfig(); + + @Expose @ConfigOption(name = "Fillet Tooltip", desc = "Show fillet value of Trophy Fish in tooltip.") @ConfigEditorBoolean @FeatureToggle diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt new file mode 100644 index 000000000..dd38b96f1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt @@ -0,0 +1,75 @@ +package at.hannibal2.skyhanni.features.fishing.trophy + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.FishingBobberCastEvent +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBox_nea +import at.hannibal2.skyhanni.utils.SpecialColour +import net.minecraft.entity.projectile.EntityFishHook +import net.minecraft.util.AxisAlignedBB +import net.minecraft.util.EnumParticleTypes +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.awt.Color + +class GeyserFishing { + private val config get() = SkyHanniMod.feature.fishing.trophyFishing.geyserOptions + + private var bobber: EntityFishHook? = null + private var geyser: LorenzVec? = null + private var geyserBox: AxisAlignedBB? = null + + @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) + fun onReceiveParticle(event: ReceiveParticleEvent) { + if (!shouldProcessParticles() || event.type != EnumParticleTypes.CLOUD) return + + geyser = event.location + val potentialGeyser = geyser ?: return + + geyserBox = AxisAlignedBB( + potentialGeyser.x - 2, 118.0 - 0.1, potentialGeyser.z - 2, + potentialGeyser.x + 2, 118.0 - 0.09, potentialGeyser.z + 2 + ) + + if (config.hideParticles && bobber != null) { + hideGeyserParticles(event) + } + } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + bobber = null + geyser = null + geyserBox = null + } + + @SubscribeEvent + fun onBobberThrow(event: FishingBobberCastEvent) { + bobber = event.bobber + } + + @SubscribeEvent + fun onRenderWorld(event: LorenzRenderWorldEvent) { + if (!config.drawBox || !IslandType.CRIMSON_ISLE.isInIsland()) return + val geyserBox = geyserBox ?: return + val color = Color(SpecialColour.specialToChromaRGB(config.boxColor), true) + event.drawFilledBoundingBox_nea(geyserBox, color) + } + + private fun hideGeyserParticles(event: ReceiveParticleEvent) { + val bobber = bobber ?: return + val geyser = geyser ?: return + + if (bobber.distanceTo(event.location) < 3 && bobber.distanceTo(geyser) < 3) { + event.isCanceled = true + } + } + + private fun shouldProcessParticles() = IslandType.CRIMSON_ISLE.isInIsland() && (config.hideParticles || config.drawBox) +} |