Adds the ability to always show hands and crosshairs.
Apparently, @rflambert doesn't want the hands to fade. It seemed like a good idea, so I added a configurable option to the main repo.
This commit is contained in:
@@ -82,7 +82,9 @@ public class ConfigManager
|
|||||||
private TimeValues hungerTime = new TimeValues();
|
private TimeValues hungerTime = new TimeValues();
|
||||||
private TimeValues effectTime = new TimeValues();
|
private TimeValues effectTime = new TimeValues();
|
||||||
private int crosshairTime = 6 * TICKS_PER_SECOND;
|
private int crosshairTime = 6 * TICKS_PER_SECOND;
|
||||||
|
private boolean hideCrosshair = true;
|
||||||
private int handTime = 30 * TICKS_PER_SECOND;
|
private int handTime = 30 * TICKS_PER_SECOND;
|
||||||
|
private boolean hideHands = true;
|
||||||
private boolean showArmor = true;
|
private boolean showArmor = true;
|
||||||
private double minHealth = 0.5;
|
private double minHealth = 0.5;
|
||||||
private int minHunger = 17;
|
private int minHunger = 17;
|
||||||
@@ -183,6 +185,15 @@ public class ConfigManager
|
|||||||
{
|
{
|
||||||
return this.crosshairTime;
|
return this.crosshairTime;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Checks whether the crosshairs should be hidden after a period of time.
|
||||||
|
*
|
||||||
|
* @return - Whether or not crosshairs will be hidden.
|
||||||
|
*/
|
||||||
|
public boolean hideCrosshair()
|
||||||
|
{
|
||||||
|
return this.hideCrosshair;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains the time that the hands are allowed to display.
|
* Obtains the time that the hands are allowed to display.
|
||||||
@@ -194,6 +205,16 @@ public class ConfigManager
|
|||||||
return this.handTime;
|
return this.handTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether hands should be hidden after a period of time.
|
||||||
|
*
|
||||||
|
* @return - Whether or not hands will be hidden.
|
||||||
|
*/
|
||||||
|
public boolean hideHands()
|
||||||
|
{
|
||||||
|
return this.hideHands;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the armor bar should render.
|
* Checks whether the armor bar should render.
|
||||||
*
|
*
|
||||||
@@ -236,6 +257,16 @@ public class ConfigManager
|
|||||||
this.crosshairTime = time;
|
this.crosshairTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether the crosshairs should be hidden after a period of time.
|
||||||
|
*
|
||||||
|
* @param hide - Whether or not crosshairs will be hidden.
|
||||||
|
*/
|
||||||
|
public void hideCrosshair(boolean hide)
|
||||||
|
{
|
||||||
|
this.hideCrosshair = hide;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the time that the hands are allowed to display.
|
* Sets the time that the hands are allowed to display.
|
||||||
*
|
*
|
||||||
@@ -246,6 +277,16 @@ public class ConfigManager
|
|||||||
this.handTime = time;
|
this.handTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether hands should be hidden after a period of time.
|
||||||
|
*
|
||||||
|
* @param hide - Whether or not hands will be hidden.
|
||||||
|
*/
|
||||||
|
public void hideHands(boolean hide)
|
||||||
|
{
|
||||||
|
this.hideHands = hide;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the armor bar should render.
|
* Determines whether the armor bar should render.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -131,6 +131,15 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setSaveConsumer(val -> instance.setCrosshairTime((int) (val * TICKS_PER_SECOND)))
|
.setSaveConsumer(val -> instance.setCrosshairTime((int) (val * TICKS_PER_SECOND)))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText(
|
||||||
|
"option.immersive_hud.hideCrosshair"),
|
||||||
|
instance.hideCrosshair())
|
||||||
|
.setDefaultValue(true)
|
||||||
|
.setTooltip(new TranslatableText(
|
||||||
|
"tooltip.immersive_hud.hideCrosshair"))
|
||||||
|
.setSaveConsumer(val -> instance.hideCrosshair(val))
|
||||||
|
.build());
|
||||||
|
|
||||||
general.addEntry(entryBuilder.startDoubleField(new TranslatableText(
|
general.addEntry(entryBuilder.startDoubleField(new TranslatableText(
|
||||||
"option.immersive_hud.handTime"),
|
"option.immersive_hud.handTime"),
|
||||||
(float) instance.getHandTime() / TICKS_PER_SECOND)
|
(float) instance.getHandTime() / TICKS_PER_SECOND)
|
||||||
@@ -140,6 +149,15 @@ public class ModMenu implements ModMenuApi
|
|||||||
.setSaveConsumer(val -> instance.setHandTime((int) (val * TICKS_PER_SECOND)))
|
.setSaveConsumer(val -> instance.setHandTime((int) (val * TICKS_PER_SECOND)))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText(
|
||||||
|
"option.immersive_hud.hideHands"),
|
||||||
|
instance.hideHands())
|
||||||
|
.setDefaultValue(true)
|
||||||
|
.setTooltip(new TranslatableText(
|
||||||
|
"tooltip.immersive_hud.hideHands"))
|
||||||
|
.setSaveConsumer(val -> instance.hideHands(val))
|
||||||
|
.build());
|
||||||
|
|
||||||
general.addEntry(entryBuilder.startDoubleField(new TranslatableText(
|
general.addEntry(entryBuilder.startDoubleField(new TranslatableText(
|
||||||
"option.immersive_hud.minHealth"),
|
"option.immersive_hud.minHealth"),
|
||||||
instance.getMinHealth())
|
instance.getMinHealth())
|
||||||
|
|||||||
@@ -360,6 +360,9 @@ public class TimerUtils
|
|||||||
{
|
{
|
||||||
final float HAND_UP_TIME = 20F;
|
final float HAND_UP_TIME = 20F;
|
||||||
|
|
||||||
|
boolean hideHands = ConfigManager.getInstance().hideHands();
|
||||||
|
if (hideHands)
|
||||||
|
{
|
||||||
switch (hand)
|
switch (hand)
|
||||||
{
|
{
|
||||||
case OFF_HAND:
|
case OFF_HAND:
|
||||||
@@ -405,6 +408,7 @@ public class TimerUtils
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,6 +430,9 @@ public class TimerUtils
|
|||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
boolean canceled = false;
|
boolean canceled = false;
|
||||||
|
|
||||||
|
boolean hideCrosshair = ConfigManager.getInstance().hideCrosshair();
|
||||||
|
if (hideCrosshair)
|
||||||
|
{
|
||||||
if (mc.crosshairTarget != null && mc.crosshairTarget
|
if (mc.crosshairTarget != null && mc.crosshairTarget
|
||||||
.getType() != HitResult.Type.MISS)
|
.getType() != HitResult.Type.MISS)
|
||||||
{
|
{
|
||||||
@@ -458,6 +465,7 @@ public class TimerUtils
|
|||||||
{
|
{
|
||||||
crosshairTime -= ticks;
|
crosshairTime -= ticks;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return canceled;
|
return canceled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
"option.immersive_hud.effectFadeIn": "Potion Fade In Time",
|
"option.immersive_hud.effectFadeIn": "Potion Fade In Time",
|
||||||
"option.immersive_hud.effectFadeOut": "Potion Fade Out Time",
|
"option.immersive_hud.effectFadeOut": "Potion Fade Out Time",
|
||||||
"option.immersive_hud.crosshairTime": "Crosshair Display Time",
|
"option.immersive_hud.crosshairTime": "Crosshair Display Time",
|
||||||
|
"option.immersive_hud.hideCrosshair": "Hide Crosshair",
|
||||||
"option.immersive_hud.handTime": "Hand Display Time",
|
"option.immersive_hud.handTime": "Hand Display Time",
|
||||||
|
"option.immersive_hud.hideHands": "Hide Hands",
|
||||||
"option.immersive_hud.minHealth": "Minimum Health Fade",
|
"option.immersive_hud.minHealth": "Minimum Health Fade",
|
||||||
"option.immersive_hud.minHunger": "Minimum Hunger Fade",
|
"option.immersive_hud.minHunger": "Minimum Hunger Fade",
|
||||||
"option.immersive_hud.showArmor": "Show Armor",
|
"option.immersive_hud.showArmor": "Show Armor",
|
||||||
@@ -42,7 +44,9 @@
|
|||||||
"tooltip.immersive_hud.effectFadeIn": "How many seconds it takes for potion icons to fade in",
|
"tooltip.immersive_hud.effectFadeIn": "How many seconds it takes for potion icons to fade in",
|
||||||
"tooltip.immersive_hud.effectFadeOut": "How many seconds it takes for potion icons to fade out",
|
"tooltip.immersive_hud.effectFadeOut": "How many seconds it takes for potion icons to fade out",
|
||||||
"tooltip.immersive_hud.crosshairTime": "How many seconds the crosshairs can be on screen",
|
"tooltip.immersive_hud.crosshairTime": "How many seconds the crosshairs can be on screen",
|
||||||
|
"tooltip.immersive_hud.hideCrosshair": "Whether or not the crosshairs should be hidden after a period of time",
|
||||||
"tooltip.immersive_hud.handTime": "How many seconds the hands can be on screen",
|
"tooltip.immersive_hud.handTime": "How many seconds the hands can be on screen",
|
||||||
|
"tooltip.immersive_hud.hideHands": "Whether or not hands should be hidden after a period of time",
|
||||||
"tooltip.immersive_hud.minHealth": "When the percentage of health goes below this level, the health bar won't fade away",
|
"tooltip.immersive_hud.minHealth": "When the percentage of health goes below this level, the health bar won't fade away",
|
||||||
"tooltip.immersive_hud.minHunger": "When the hunger level goes below this level, the hunger bar won't fade away",
|
"tooltip.immersive_hud.minHunger": "When the hunger level goes below this level, the hunger bar won't fade away",
|
||||||
"tooltip.immersive_hud.showArmor": "Whether or not the armor bar should display on the HUD"
|
"tooltip.immersive_hud.showArmor": "Whether or not the armor bar should display on the HUD"
|
||||||
|
|||||||
Reference in New Issue
Block a user