diff options
| author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-09-07 08:47:56 -0400 | 
|---|---|---|
| committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-09-07 08:47:56 -0400 | 
| commit | f068185af33ab4f3e16b9e038627c735368dc316 (patch) | |
| tree | 8d61c6a590893b7d6009499c74c9812a45c33f67 /src/main/kotlin | |
| parent | 9f8a87e84764bd9fb6362e33e03eb47dbe2a84a4 (diff) | |
| download | SkytilsMod-f068185af33ab4f3e16b9e038627c735368dc316.tar.gz SkytilsMod-f068185af33ab4f3e16b9e038627c735368dc316.tar.bz2 SkytilsMod-f068185af33ab4f3e16b9e038627c735368dc316.zip | |
Selected Arrow Display
Diffstat (limited to 'src/main/kotlin')
3 files changed, 60 insertions, 10 deletions
| diff --git a/src/main/kotlin/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/skytils/skytilsmod/core/Config.kt index 93393547..341100b3 100644 --- a/src/main/kotlin/skytils/skytilsmod/core/Config.kt +++ b/src/main/kotlin/skytils/skytilsmod/core/Config.kt @@ -1241,6 +1241,13 @@ object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortin      var pingDisplay = 0      @Property( +        PropertyType.SWITCH, name = "Show Selected Arrow", +        description = "Shows your current selected arrow.", +        category = "Miscellaneous", subcategory = "Other" +    ) +    var showSelectedArrowDisplay = false + +    @Property(          type = PropertyType.SWITCH, name = "Show World Age",          description = "Displays the day count of the current server.",          category = "Miscellaneous", subcategory = "Other" @@ -2258,13 +2265,11 @@ object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortin      }      private object ConfigSorting : SortingBehavior() { -        override fun getCategoryComparator(): Comparator<in Category> { -            return Comparator { o1, o2 -> -                if (o1.name == "General") return@Comparator -1 -                if (o2.name == "General") return@Comparator 1 -                else compareValuesBy(o1, o2) { -                    it.name -                } +        override fun getCategoryComparator(): Comparator<in Category> = Comparator { o1, o2 -> +            if (o1.name == "General") return@Comparator -1 +            if (o2.name == "General") return@Comparator 1 +            else compareValuesBy(o1, o2) { +                it.name              }          }      } diff --git a/src/main/kotlin/skytils/skytilsmod/features/impl/misc/ItemFeatures.kt b/src/main/kotlin/skytils/skytilsmod/features/impl/misc/ItemFeatures.kt index 6750bc47..2a58218d 100644 --- a/src/main/kotlin/skytils/skytilsmod/features/impl/misc/ItemFeatures.kt +++ b/src/main/kotlin/skytils/skytilsmod/features/impl/misc/ItemFeatures.kt @@ -443,6 +443,7 @@ class ItemFeatures {          val bitCosts = HashMap<String, Int>()          init { +            SelectedArrowDisplay()              SoulStrengthGuiElement()              SoulflowGuiElement()          } @@ -488,6 +489,53 @@ class ItemFeatures {          }      } +    class SelectedArrowDisplay : GuiElement("Arrow Swapper Display", FloatPair(0.65f, 0.85f)) { +        override fun render() { +            if (toggled && Utils.inSkyblock) { +                mc.thePlayer.inventory.mainInventory.find { +                    getSkyBlockItemID(it) == "ARROW_SWAPPER" +                }?.let { item -> +                    val alignment = +                        if (actualX < UResolution.scaledWidth / 2f) TextAlignment.LEFT_RIGHT else TextAlignment.RIGHT_LEFT +                    ScreenRenderer.fontRenderer.drawString( +                        getItemLore(item).find { +                            it.startsWith("§aSelected: §") +                        }?.substringAfter("§aSelected: "), +                        if (actualX < UResolution.scaledWidth / 2f) 0f else width.toFloat(), +                        0f, +                        CommonColors.WHITE, +                        alignment, +                        TextShadow.NORMAL +                    ) +                } +            } +        } + +        override fun demoRender() { +            val alignment = +                if (actualX < UResolution.scaledWidth / 2f) TextAlignment.LEFT_RIGHT else TextAlignment.RIGHT_LEFT +            ScreenRenderer.fontRenderer.drawString( +                "§aSelected: §zSkytils Arrow", +                if (actualX < UResolution.scaledWidth / 2f) 0f else width.toFloat(), +                0f, +                CommonColors.WHITE, +                alignment, +                TextShadow.NORMAL +            ) +        } + +        override val height: Int +            get() = ScreenRenderer.fontRenderer.FONT_HEIGHT +        override val width: Int +            get() = ScreenRenderer.fontRenderer.getStringWidth("§aSelected: §zSkytils Arrow") +        override val toggled: Boolean +            get() = Skytils.config.showSelectedArrowDisplay + +        init { +            Skytils.guiManager.registerElement(this) +        } +    } +      class SoulflowGuiElement : GuiElement("Soulflow Display", FloatPair(0.65f, 0.85f)) {          override fun render() {              if (Utils.inSkyblock) { diff --git a/src/main/kotlin/skytils/skytilsmod/mixins/hooks/gui/GuiIngameHook.kt b/src/main/kotlin/skytils/skytilsmod/mixins/hooks/gui/GuiIngameHook.kt index d6e6e500..3eb15a06 100644 --- a/src/main/kotlin/skytils/skytilsmod/mixins/hooks/gui/GuiIngameHook.kt +++ b/src/main/kotlin/skytils/skytilsmod/mixins/hooks/gui/GuiIngameHook.kt @@ -17,10 +17,7 @@   */  package skytils.skytilsmod.mixins.hooks.gui -import net.minecraft.client.Minecraft  import net.minecraft.entity.player.EntityPlayer -import net.minecraft.util.ChatComponentText -import net.minecraftforge.common.MinecraftForge  import org.spongepowered.asm.mixin.injection.callback.CallbackInfo  import skytils.skytilsmod.Skytils  import skytils.skytilsmod.events.SetActionBarEvent | 
