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:
@@ -154,7 +154,9 @@ public class ConfigManager
|
|||||||
private final TimeValues hungerTime;
|
private final TimeValues hungerTime;
|
||||||
private final TimeValues effectTime;
|
private final TimeValues effectTime;
|
||||||
private final ForgeConfigSpec.IntValue crosshairTime;
|
private final ForgeConfigSpec.IntValue crosshairTime;
|
||||||
|
private final ForgeConfigSpec.BooleanValue hideCrosshair;
|
||||||
private final ForgeConfigSpec.IntValue handTime;
|
private final ForgeConfigSpec.IntValue handTime;
|
||||||
|
private final ForgeConfigSpec.BooleanValue hideHands;
|
||||||
private final ForgeConfigSpec.BooleanValue showArmor;
|
private final ForgeConfigSpec.BooleanValue showArmor;
|
||||||
private final ForgeConfigSpec.DoubleValue minHealth;
|
private final ForgeConfigSpec.DoubleValue minHealth;
|
||||||
private final ForgeConfigSpec.IntValue minHunger;
|
private final ForgeConfigSpec.IntValue minHunger;
|
||||||
@@ -181,6 +183,10 @@ public class ConfigManager
|
|||||||
6 * TICKS_PER_SECOND,
|
6 * TICKS_PER_SECOND,
|
||||||
0,
|
0,
|
||||||
10 * 60 * TICKS_PER_SECOND);
|
10 * 60 * TICKS_PER_SECOND);
|
||||||
|
this.hideCrosshair =
|
||||||
|
configSpecBuilder.translation(
|
||||||
|
"immersive_hud.configGui.hideCrosshair.title")
|
||||||
|
.define("hideCrosshair", true);
|
||||||
this.handTime =
|
this.handTime =
|
||||||
configSpecBuilder.translation(
|
configSpecBuilder.translation(
|
||||||
"immersive_hud.configGui.handTime.title")
|
"immersive_hud.configGui.handTime.title")
|
||||||
@@ -188,6 +194,10 @@ public class ConfigManager
|
|||||||
30 * TICKS_PER_SECOND,
|
30 * TICKS_PER_SECOND,
|
||||||
0,
|
0,
|
||||||
10 * 60 * TICKS_PER_SECOND);
|
10 * 60 * TICKS_PER_SECOND);
|
||||||
|
this.hideHands =
|
||||||
|
configSpecBuilder.translation(
|
||||||
|
"immersive_hud.configGui.hideHands.title")
|
||||||
|
.define("hideHands", true);
|
||||||
this.showArmor = configSpecBuilder.translation(
|
this.showArmor = configSpecBuilder.translation(
|
||||||
"immersive_hud.configGui.showArmor.title")
|
"immersive_hud.configGui.showArmor.title")
|
||||||
.define("showArmor", true);
|
.define("showArmor", true);
|
||||||
@@ -281,6 +291,16 @@ public class ConfigManager
|
|||||||
return this.crosshairTime.get();
|
return this.crosshairTime.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.get();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains the time that the hands are allowed to display.
|
* Obtains the time that the hands are allowed to display.
|
||||||
*
|
*
|
||||||
@@ -291,6 +311,16 @@ public class ConfigManager
|
|||||||
return this.handTime.get();
|
return this.handTime.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.get();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the armor bar should render.
|
* Checks whether the armor bar should render.
|
||||||
*
|
*
|
||||||
@@ -334,6 +364,16 @@ public class ConfigManager
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
|
// * 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.set(hide);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
// * Sets the time that the hands are allowed to display.
|
// * Sets the time that the hands are allowed to display.
|
||||||
// *
|
// *
|
||||||
// * @param time - The hand display time values.
|
// * @param time - The hand display time values.
|
||||||
@@ -344,6 +384,16 @@ public class ConfigManager
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
|
// * 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.set(hide);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
// * Determines whether the armor bar should render.
|
// * Determines whether the armor bar should render.
|
||||||
// *
|
// *
|
||||||
// * @param show - Whether or not armor shows on the HUD.
|
// * @param show - Whether or not armor shows on the HUD.
|
||||||
|
|||||||
@@ -294,55 +294,60 @@ public class TimerUtils
|
|||||||
{
|
{
|
||||||
float HAND_UP_TIME = 20F;
|
float HAND_UP_TIME = 20F;
|
||||||
|
|
||||||
switch (hand)
|
boolean hideHands =
|
||||||
|
ConfigManager.getInstance().hideHands();
|
||||||
|
if (hideHands)
|
||||||
{
|
{
|
||||||
case OFF_HAND:
|
switch (hand)
|
||||||
if (mainHandTime > 0 && mainHandTime < HAND_UP_TIME)
|
|
||||||
{
|
{
|
||||||
/*
|
case OFF_HAND:
|
||||||
* Undo the transformation of the previous hand
|
if (mainHandTime > 0 && mainHandTime < HAND_UP_TIME)
|
||||||
*/
|
|
||||||
GlStateManager.translatef(0,
|
|
||||||
(float) (1.0F * (HAND_UP_TIME - mainHandTime) / HAND_UP_TIME),
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
if (offHandTime == 0 && !offHandLock)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (!offHandLock && (mapLock & 0b01) == 0)
|
|
||||||
{
|
|
||||||
if (offHandTime > 0)
|
|
||||||
{
|
|
||||||
offHandTime -= ticks;
|
|
||||||
}
|
|
||||||
if (offHandTime < HAND_UP_TIME)
|
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Undo the transformation of the previous hand
|
||||||
|
*/
|
||||||
GlStateManager.translatef(0,
|
GlStateManager.translatef(0,
|
||||||
(float) (-1.0F * (HAND_UP_TIME - offHandTime) / HAND_UP_TIME),
|
(float) (1.0F * (HAND_UP_TIME - mainHandTime) / HAND_UP_TIME),
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
}
|
if (offHandTime == 0 && !offHandLock)
|
||||||
break;
|
|
||||||
case MAIN_HAND:
|
|
||||||
if (mainHandTime == 0 && !mainHandLock)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (!mainHandLock && (mapLock & 0b10) == 0)
|
|
||||||
{
|
|
||||||
if (mainHandTime > 0)
|
|
||||||
{
|
{
|
||||||
mainHandTime -= ticks;
|
return true;
|
||||||
}
|
}
|
||||||
if (mainHandTime < HAND_UP_TIME)
|
else if (!offHandLock && (mapLock & 0b01) == 0)
|
||||||
{
|
{
|
||||||
GlStateManager.translatef(0,
|
if (offHandTime > 0)
|
||||||
(float) (-1.0F * (HAND_UP_TIME - mainHandTime) / HAND_UP_TIME),
|
{
|
||||||
0);
|
offHandTime -= ticks;
|
||||||
|
}
|
||||||
|
if (offHandTime < HAND_UP_TIME)
|
||||||
|
{
|
||||||
|
GlStateManager.translatef(0,
|
||||||
|
(float) (-1.0F * (HAND_UP_TIME - offHandTime) / HAND_UP_TIME),
|
||||||
|
0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case MAIN_HAND:
|
||||||
|
if (mainHandTime == 0 && !mainHandLock)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (!mainHandLock && (mapLock & 0b10) == 0)
|
||||||
|
{
|
||||||
|
if (mainHandTime > 0)
|
||||||
|
{
|
||||||
|
mainHandTime -= ticks;
|
||||||
|
}
|
||||||
|
if (mainHandTime < HAND_UP_TIME)
|
||||||
|
{
|
||||||
|
GlStateManager.translatef(0,
|
||||||
|
(float) (-1.0F * (HAND_UP_TIME - mainHandTime) / HAND_UP_TIME),
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -378,34 +383,39 @@ public class TimerUtils
|
|||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
boolean canceled = false;
|
boolean canceled = false;
|
||||||
|
|
||||||
if (mc.objectMouseOver != null && mc.objectMouseOver.getType() != RayTraceResult.Type.MISS)
|
boolean hideCrosshair =
|
||||||
|
ConfigManager.getInstance().hideCrosshair();
|
||||||
|
if (hideCrosshair)
|
||||||
{
|
{
|
||||||
if (mc.objectMouseOver.getType() == RayTraceResult.Type.ENTITY)
|
if (mc.objectMouseOver != null && mc.objectMouseOver.getType() != RayTraceResult.Type.MISS)
|
||||||
{
|
{
|
||||||
if (mc.objectMouseOver.hitInfo == null || mc.objectMouseOver.hitInfo != mc.player
|
if (mc.objectMouseOver.getType() == RayTraceResult.Type.ENTITY)
|
||||||
.getRidingEntity())
|
{
|
||||||
|
if (mc.objectMouseOver.hitInfo == null || mc.objectMouseOver.hitInfo != mc.player
|
||||||
|
.getRidingEntity())
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (changed || mainHandLock || offHandLock || crosshairTime > 0)
|
||||||
|
{
|
||||||
|
setAlpha(Main.getAlpha(crosshairTime > 0 ?
|
||||||
|
crosshairTime :
|
||||||
|
CROSSHAIR_TIME, CROSSHAIR_TIME, 0, 0));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
changed = true;
|
canceled = true;
|
||||||
|
}
|
||||||
|
if (crosshairTime > 0)
|
||||||
|
{
|
||||||
|
crosshairTime -= ticks;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (changed || mainHandLock || offHandLock || crosshairTime > 0)
|
|
||||||
{
|
|
||||||
setAlpha(Main.getAlpha(crosshairTime > 0 ?
|
|
||||||
crosshairTime :
|
|
||||||
CROSSHAIR_TIME, CROSSHAIR_TIME, 0, 0));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
canceled = true;
|
|
||||||
}
|
|
||||||
if (crosshairTime > 0)
|
|
||||||
{
|
|
||||||
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