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,50 +360,54 @@ public class TimerUtils
|
|||||||
{
|
{
|
||||||
final float HAND_UP_TIME = 20F;
|
final float HAND_UP_TIME = 20F;
|
||||||
|
|
||||||
switch (hand)
|
boolean hideHands = ConfigManager.getInstance().hideHands();
|
||||||
|
if (hideHands)
|
||||||
{
|
{
|
||||||
case OFF_HAND:
|
switch (hand)
|
||||||
if (offHandTime == 0 && !offHandLock)
|
|
||||||
{
|
{
|
||||||
return true;
|
case OFF_HAND:
|
||||||
}
|
if (offHandTime == 0 && !offHandLock)
|
||||||
else if (!offHandLock && (mapLock & 0b01) == 0)
|
|
||||||
{
|
|
||||||
if (offHandTime > 0)
|
|
||||||
{
|
{
|
||||||
offHandTime -= ticks;
|
return true;
|
||||||
}
|
}
|
||||||
if (offHandTime < HAND_UP_TIME)
|
else if (!offHandLock && (mapLock & 0b01) == 0)
|
||||||
{
|
{
|
||||||
matrixStack
|
if (offHandTime > 0)
|
||||||
.translate(0,
|
{
|
||||||
-1.0F * (HAND_UP_TIME - offHandTime) /
|
offHandTime -= ticks;
|
||||||
HAND_UP_TIME,
|
}
|
||||||
0);
|
if (offHandTime < HAND_UP_TIME)
|
||||||
|
{
|
||||||
|
matrixStack
|
||||||
|
.translate(0,
|
||||||
|
-1.0F * (HAND_UP_TIME - offHandTime) /
|
||||||
|
HAND_UP_TIME,
|
||||||
|
0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case MAIN_HAND:
|
||||||
case MAIN_HAND:
|
if (mainHandTime == 0 && !mainHandLock)
|
||||||
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 (!mainHandLock && (mapLock & 0b10) == 0)
|
||||||
{
|
{
|
||||||
matrixStack
|
if (mainHandTime > 0)
|
||||||
.translate(0,
|
{
|
||||||
-1.0F * (HAND_UP_TIME - mainHandTime) /
|
mainHandTime -= ticks;
|
||||||
HAND_UP_TIME,
|
}
|
||||||
0);
|
if (mainHandTime < HAND_UP_TIME)
|
||||||
|
{
|
||||||
|
matrixStack
|
||||||
|
.translate(0,
|
||||||
|
-1.0F * (HAND_UP_TIME - mainHandTime) /
|
||||||
|
HAND_UP_TIME,
|
||||||
|
0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -426,37 +430,41 @@ public class TimerUtils
|
|||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
boolean canceled = false;
|
boolean canceled = false;
|
||||||
|
|
||||||
if (mc.crosshairTarget != null && mc.crosshairTarget
|
boolean hideCrosshair = ConfigManager.getInstance().hideCrosshair();
|
||||||
.getType() != HitResult.Type.MISS)
|
if (hideCrosshair)
|
||||||
{
|
{
|
||||||
if (mc.crosshairTarget.getType() == HitResult.Type
|
if (mc.crosshairTarget != null && mc.crosshairTarget
|
||||||
.ENTITY)
|
.getType() != HitResult.Type.MISS)
|
||||||
{
|
{
|
||||||
if (((EntityHitResult) mc.crosshairTarget).getEntity() != entity
|
if (mc.crosshairTarget.getType() == HitResult.Type
|
||||||
.getVehicle())
|
.ENTITY)
|
||||||
|
{
|
||||||
|
if (((EntityHitResult) mc.crosshairTarget).getEntity() != entity
|
||||||
|
.getVehicle())
|
||||||
|
{
|
||||||
|
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