From 925bb0964d502bdecf74ad14002bdf7c57bb44d6 Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:26:14 -0400 Subject: Feature: Highlight Crystal Nucleus Crystals (#2598) Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: Cal Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/mining/CrystalHighlighterConfig.java | 35 ++++++++++ .../config/features/mining/MiningConfig.java | 5 ++ .../features/event/hoppity/NucleusBarriersBox.kt | 81 ++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/mining/CrystalHighlighterConfig.java create mode 100644 src/main/java/at/hannibal2/skyhanni/features/event/hoppity/NucleusBarriersBox.kt (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/CrystalHighlighterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/CrystalHighlighterConfig.java new file mode 100644 index 000000000..06c60b507 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/CrystalHighlighterConfig.java @@ -0,0 +1,35 @@ +package at.hannibal2.skyhanni.config.features.mining; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import com.google.gson.annotations.Expose; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; + +public class CrystalHighlighterConfig { + + @Expose + @ConfigOption( + name = "Highlight Crystal Nucleus barriers", + desc = "Draw visible bounding boxes around the Crystal Nucleus crystal barrier blocks." + ) + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = true; + + @Expose + @ConfigOption( + name = "Highlight Opacity", + desc = "Set the opacity of the highlighted boxes.\n§70§8: §7Transparent\n§7100§8: §7Solid" + ) + @ConfigEditorSlider(minValue = 0, maxValue = 100, minStep = 1) + public int opacity = 60; + + @Expose + @ConfigOption( + name = "Only Show During Hoppity's", + desc = "Only show the highlighted boxes during Hoppity's Hunt." + ) + @ConfigEditorBoolean + public boolean onlyDuringHoppity = false; +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningConfig.java index 2c460bd2f..f6a5a83ba 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningConfig.java @@ -73,6 +73,11 @@ public class MiningConfig { @Accordion public MineshaftPityDisplayConfig mineshaftPityDisplay = new MineshaftPityDisplayConfig(); + @Expose + @ConfigOption(name = "Crystal Nucleus Crystal Highlights", desc = "") + @Accordion + public CrystalHighlighterConfig crystalHighlighter = new CrystalHighlighterConfig(); + @Expose @ConfigOption(name = "Highlight Commission Mobs", desc = "Highlight mobs that are part of active commissions.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/NucleusBarriersBox.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/NucleusBarriersBox.kt new file mode 100644 index 000000000..47ab47a38 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/NucleusBarriersBox.kt @@ -0,0 +1,81 @@ +package at.hannibal2.skyhanni.features.event.hoppity + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.features.misc.IslandAreas +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBox_nea +import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock +import net.minecraft.util.AxisAlignedBB +import net.minecraft.util.BlockPos +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object NucleusBarriersBox { + private val config get() = SkyHanniMod.feature.mining.crystalHighlighter + + private var inNucleus = false + + private enum class Crystal(val color: LorenzColor, val boundingBox: AxisAlignedBB) { + AMBER( + LorenzColor.GOLD, + AxisAlignedBB( + BlockPos(474.0, 124.0, 524.0), + BlockPos(485.0, 111.0, 535.0), + ).expandBlock(), + ), + AMETHYST( + LorenzColor.DARK_PURPLE, + AxisAlignedBB( + BlockPos(474.0, 124.0, 492.0), + BlockPos(485.0, 111.0, 503.0), + ).expandBlock(), + ), + TOPAZ( + LorenzColor.YELLOW, + AxisAlignedBB( + BlockPos(508.0, 124.0, 473.0), + BlockPos(519.0, 111.0, 484.0), + ).expandBlock(), + ), + JADE( + LorenzColor.GREEN, + AxisAlignedBB( + BlockPos(542.0, 124.0, 492.0), + BlockPos(553.0, 111.0, 503.0), + ).expandBlock(), + ), + SAPPHIRE( + LorenzColor.BLUE, + AxisAlignedBB( + BlockPos(542.0, 124.0, 524.0), + BlockPos(553.0, 111.0, 535.0), + ).expandBlock(), + ), + } + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + inNucleus = IslandAreas.currentAreaName == "Crystal Nucleus" + } + + @SubscribeEvent + fun onRenderWorld(event: LorenzRenderWorldEvent) { + if (!isEnabled()) return + + Crystal.entries.forEach { crystal -> + event.drawFilledBoundingBox_nea( + crystal.boundingBox, + crystal.color.addOpacity(config.opacity), + renderRelativeToCamera = false, + ) + } + } + + private fun isEnabled() = + IslandType.CRYSTAL_HOLLOWS.isInIsland() && (HoppityAPI.isHoppityEvent() || !config.onlyDuringHoppity) && config.enabled && inNucleus +} -- cgit