From b6ccee010bdde4c0c40029ea76d01a9a6605f6e3 Mon Sep 17 00:00:00 2001
From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com>
Date: Thu, 2 Jul 2020 17:28:02 +0100
Subject: [PATCH] Add config options to show/hide spell HUD and charge meter
---
.../java/electroblob/wizardry/Settings.java | 18 ++++++++++++++++++
.../wizardry/client/gui/GuiSpellDisplay.java | 5 +++++
.../assets/ebwizardry/lang/en_gb.lang | 8 ++++++++
.../assets/ebwizardry/lang/en_us.lang | 8 ++++++++
4 files changed, 39 insertions(+)
diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java
index df0b5b9e..d4e53a41 100644
--- a/src/main/java/electroblob/wizardry/Settings.java
+++ b/src/main/java/electroblob/wizardry/Settings.java
@@ -338,6 +338,10 @@ public final class Settings {
public boolean blinkEffect = true;
/** [Client-only] Whether to use spellcasting animations for players. */
public boolean spellcastingAnimations = true;
+ /** [Client-only] Whether to show the spell HUD when holding a wand. */
+ public boolean showSpellHUD = true;
+ /** [Client-only] Whether to show the charge meter when charging up a spell. */
+ public boolean showChargeMeter = true;
/** [Client-only] The position of the spell HUD. */
public GuiPosition spellHUDPosition = GuiPosition.BOTTOM_LEFT;
@@ -966,6 +970,20 @@ public final class Settings {
reverseScrollDirection = property.getBoolean();
propOrder.add(property.getName());
+ property = config.get(CLIENT_CATEGORY, "showSpellHUD", false, "Whether to show the spell HUD in the corner of the screen when holding a wand.");
+ property.setLanguageKey("config." + Wizardry.MODID + ".show_spell_hud");
+ property.setRequiresWorldRestart(false);
+ Wizardry.proxy.setToNamedBooleanEntry(property);
+ showSpellHUD = property.getBoolean();
+ propOrder.add(property.getName());
+
+ property = config.get(CLIENT_CATEGORY, "showChargeMeter", false, "Whether to show the spell charge-up meter around the crosshairs when charging up a spell.");
+ property.setLanguageKey("config." + Wizardry.MODID + ".show_charge_meter");
+ property.setRequiresWorldRestart(false);
+ Wizardry.proxy.setToNamedBooleanEntry(property);
+ showChargeMeter = property.getBoolean();
+ propOrder.add(property.getName());
+
property = config.get(CLIENT_CATEGORY, "spellHUDPosition", GuiPosition.BOTTOM_LEFT.name, "The position of the spell HUD.", GuiPosition.names);
property.setLanguageKey("config." + Wizardry.MODID + ".spell_hud_position");
spellHUDPosition = GuiPosition.fromName(property.getString());
diff --git a/src/main/java/electroblob/wizardry/client/gui/GuiSpellDisplay.java b/src/main/java/electroblob/wizardry/client/gui/GuiSpellDisplay.java
index a6e40160..265a9129 100644
--- a/src/main/java/electroblob/wizardry/client/gui/GuiSpellDisplay.java
+++ b/src/main/java/electroblob/wizardry/client/gui/GuiSpellDisplay.java
@@ -106,6 +106,8 @@ public class GuiSpellDisplay {
@SubscribeEvent
public static void draw(RenderGameOverlayEvent.Post event){
+ if(!Wizardry.settings.showSpellHUD && !Wizardry.settings.showChargeMeter) return; // Optimisation
+
EntityPlayer player = Minecraft.getMinecraft().player;
if(player.isSpectator()) return; // Spectators shouldn't have the spell HUD!
@@ -150,6 +152,7 @@ public class GuiSpellDisplay {
*/
private static void renderChargeMeter(EntityPlayer player, ItemStack wand, int width, int height, float partialTicks){
+ if(!Wizardry.settings.showChargeMeter) return;
if(Minecraft.getMinecraft().gameSettings.showDebugInfo) return; // Don't show charge meter in the debug screen
if(Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) return; // Don't show in third person
@@ -194,6 +197,8 @@ public class GuiSpellDisplay {
*/
private static void renderSpellHUD(EntityPlayer player, ItemStack wand, boolean mainHand, int width, int height, float partialTicks, boolean textLayer){
+ if(!Wizardry.settings.showSpellHUD) return;
+
boolean flipX = Wizardry.settings.spellHUDPosition.flipX;
boolean flipY = Wizardry.settings.spellHUDPosition.flipY;
diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang
index 77db6bcc..ecf8acd4 100644
--- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang
+++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang
@@ -1455,6 +1455,14 @@ config.ebwizardry.reverse_scroll_direction=Scroll Direction
config.ebwizardry.reverse_scroll_direction.tooltip=The scroll direction used to switch between spells on a wand while sneaking.
config.ebwizardry.reverse_scroll_direction.true=Reversed
config.ebwizardry.reverse_scroll_direction.false=Normal
+config.ebwizardry.show_spell_hud=Spell HUD
+config.ebwizardry.show_spell_hud.tooltip=Whether to show the spell HUD in the corner of the screen when holding a wand.
+config.ebwizardry.show_spell_hud.true=Shown
+config.ebwizardry.show_spell_hud.false=Hidden
+config.ebwizardry.show_charge_meter=Spell Charge Meter
+config.ebwizardry.show_charge_meter.tooltip=Whether to show the spell charge-up meter around the crosshairs when charging up a spell.
+config.ebwizardry.show_charge_meter.true=Shown
+config.ebwizardry.show_charge_meter.false=Hidden
config.ebwizardry.spell_hud_position=Spell HUD Position
config.ebwizardry.spell_hud_position.tooltip=The position of the spell HUD.
config.ebwizardry.spell_hud_skin=Spell HUD Skin
diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang
index 16efae40..4651daee 100644
--- a/src/main/resources/assets/ebwizardry/lang/en_us.lang
+++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang
@@ -1455,6 +1455,14 @@ config.ebwizardry.reverse_scroll_direction=Scroll Direction
config.ebwizardry.reverse_scroll_direction.tooltip=The scroll direction used to switch between spells on a wand while sneaking.
config.ebwizardry.reverse_scroll_direction.true=Reversed
config.ebwizardry.reverse_scroll_direction.false=Normal
+config.ebwizardry.show_spell_hud=Spell HUD
+config.ebwizardry.show_spell_hud.tooltip=Whether to show the spell HUD in the corner of the screen when holding a wand.
+config.ebwizardry.show_spell_hud.true=Shown
+config.ebwizardry.show_spell_hud.false=Hidden
+config.ebwizardry.show_charge_meter=Spell Charge Meter
+config.ebwizardry.show_charge_meter.tooltip=Whether to show the spell charge-up meter around the crosshairs when charging up a spell.
+config.ebwizardry.show_charge_meter.true=Shown
+config.ebwizardry.show_charge_meter.false=Hidden
config.ebwizardry.spell_hud_position=Spell HUD Position
config.ebwizardry.spell_hud_position.tooltip=The position of the spell HUD.
config.ebwizardry.spell_hud_skin=Spell HUD Skin