aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/HotbarConfig.java31
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/MovableHotBar.kt41
4 files changed, 79 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 0374024e0..794a7a568 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -251,6 +251,7 @@ import at.hannibal2.skyhanni.features.garden.visitor.NPCVisitorFix
import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI
import at.hannibal2.skyhanni.features.garden.visitor.VisitorListener
import at.hannibal2.skyhanni.features.garden.visitor.VisitorRewardWarning
+import at.hannibal2.skyhanni.features.gui.MovableHotBar
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern
import at.hannibal2.skyhanni.features.gui.quiver.QuiverDisplay
@@ -532,6 +533,7 @@ class SkyHanniMod {
loadModule(RenderData())
loadModule(GardenCropMilestones)
loadModule(GardenCropMilestonesCommunityFix)
+ loadModule(MovableHotBar())
loadModule(GardenCropUpgrades)
loadModule(VisitorListener())
loadModule(VisitorRewardWarning())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java
index 1309780a8..b259fd26d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java
@@ -62,6 +62,11 @@ public class GUIConfig {
public DiscordRPCConfig discordRPC = new DiscordRPCConfig();
@Expose
+ @ConfigOption(name = "Hotbar", desc = "Settings for adjusting the hotbar")
+ @Accordion
+ public HotbarConfig hotbar = new HotbarConfig();
+
+ @Expose
@ConfigOption(name = "Marked Players", desc = "Players that got marked with §e/shmarkplayer§7.")
@Accordion
public MarkedPlayerConfig markedPlayers = new MarkedPlayerConfig();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/HotbarConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/HotbarConfig.java
new file mode 100644
index 000000000..e13c18a8d
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/HotbarConfig.java
@@ -0,0 +1,31 @@
+package at.hannibal2.skyhanni.config.features.gui;
+
+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.ConfigEditorInfoText;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+
+public class HotbarConfig {
+
+ @Expose
+ @ConfigOption(name = "Editable", desc = "Adds the hotbar to the gui editor. Allows for moving and scaling of the hotbar.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean editable = false;
+
+ @ConfigOption(name = "§cNotice", desc = "This option will be §c§lincompatible §r§7with mods that change the hotbar. Eg: §eApec§7.")
+ @ConfigEditorInfoText
+ public String notice = "";
+
+ @Expose
+ @ConfigLink(owner = HotbarConfig.class, field = "editable")
+ public Position hotbar = new Position(20, 20);
+
+ @Expose
+ @ConfigOption(name = "Show Outside Skyblock", desc = "Enables the hotbar to be edited even outside of SkyBlock.")
+ @ConfigEditorBoolean
+ public boolean showOutsideSkyblock = false;
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/MovableHotBar.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/MovableHotBar.kt
new file mode 100644
index 000000000..37a86eb22
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/MovableHotBar.kt
@@ -0,0 +1,41 @@
+package at.hannibal2.skyhanni.features.gui
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.GuiEditManager
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.transform
+import net.minecraft.client.Minecraft
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class MovableHotBar {
+
+ private val config get() = SkyHanniMod.feature.gui.hotbar
+
+ private var post = false
+
+ @SubscribeEvent
+ fun onRenderHotbar(event: RenderGameOverlayEvent.Pre) {
+ if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR || !isEnabled()) return
+ post = true
+ GlStateManager.pushMatrix()
+ val scaled = event.resolution
+ val x = scaled.scaledWidth / 2 - 91
+ val y = scaled.scaledHeight - 22
+ config.hotbar.transform()
+ GlStateManager.translate(-x.toFloat(), -y.toFloat(), 0f) // Must be after transform to work with scaling
+ GuiEditManager.add(config.hotbar, "Hotbar", 182 - 1, 22 - 1) // -1 since the editor for some reason add +1
+ }
+
+ @SubscribeEvent
+ fun onRenderHotbar(event: RenderGameOverlayEvent.Post) {
+ if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR || !post) return
+ GlStateManager.popMatrix()
+ post = false
+ }
+
+ fun isEnabled(): Boolean =
+ (LorenzUtils.inSkyBlock || (Minecraft.getMinecraft().thePlayer != null && config.showOutsideSkyblock))
+ && config.editable
+}