Compare commits
4 Commits
v1.1-1.15-
...
v1.1-1.16.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93767421ee | ||
|
|
96718b2b57 | ||
|
|
e3c0f1d533 | ||
|
|
6daf696e01 |
@@ -11,6 +11,6 @@ cloth_version=4.11.14
|
||||
modmenu_version=1.16.8
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0
|
||||
mod_version = 1.1
|
||||
maven_group = markil3
|
||||
archives_base_name = immersive_hud
|
||||
|
||||
@@ -82,7 +82,9 @@ public class ConfigManager
|
||||
private TimeValues hungerTime = new TimeValues();
|
||||
private TimeValues effectTime = new TimeValues();
|
||||
private int crosshairTime = 6 * TICKS_PER_SECOND;
|
||||
private boolean hideCrosshair = true;
|
||||
private int handTime = 30 * TICKS_PER_SECOND;
|
||||
private boolean hideHands = true;
|
||||
private boolean showArmor = true;
|
||||
private double minHealth = 0.5;
|
||||
private int minHunger = 17;
|
||||
@@ -183,6 +185,15 @@ public class ConfigManager
|
||||
{
|
||||
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.
|
||||
@@ -194,6 +205,16 @@ public class ConfigManager
|
||||
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.
|
||||
*
|
||||
@@ -236,6 +257,16 @@ public class ConfigManager
|
||||
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.
|
||||
*
|
||||
@@ -246,6 +277,16 @@ public class ConfigManager
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -131,6 +131,15 @@ public class ModMenu implements ModMenuApi
|
||||
.setSaveConsumer(val -> instance.setCrosshairTime((int) (val * TICKS_PER_SECOND)))
|
||||
.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(
|
||||
"option.immersive_hud.handTime"),
|
||||
(float) instance.getHandTime() / TICKS_PER_SECOND)
|
||||
@@ -140,6 +149,15 @@ public class ModMenu implements ModMenuApi
|
||||
.setSaveConsumer(val -> instance.setHandTime((int) (val * TICKS_PER_SECOND)))
|
||||
.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(
|
||||
"option.immersive_hud.minHealth"),
|
||||
instance.getMinHealth())
|
||||
|
||||
@@ -360,6 +360,9 @@ public class TimerUtils
|
||||
{
|
||||
final float HAND_UP_TIME = 20F;
|
||||
|
||||
boolean hideHands = ConfigManager.getInstance().hideHands();
|
||||
if (hideHands)
|
||||
{
|
||||
switch (hand)
|
||||
{
|
||||
case OFF_HAND:
|
||||
@@ -405,6 +408,7 @@ public class TimerUtils
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -426,6 +430,9 @@ public class TimerUtils
|
||||
boolean changed = false;
|
||||
boolean canceled = false;
|
||||
|
||||
boolean hideCrosshair = ConfigManager.getInstance().hideCrosshair();
|
||||
if (hideCrosshair)
|
||||
{
|
||||
if (mc.crosshairTarget != null && mc.crosshairTarget
|
||||
.getType() != HitResult.Type.MISS)
|
||||
{
|
||||
@@ -458,6 +465,7 @@ public class TimerUtils
|
||||
{
|
||||
crosshairTime -= ticks;
|
||||
}
|
||||
}
|
||||
return canceled;
|
||||
}
|
||||
|
||||
@@ -488,7 +496,7 @@ public class TimerUtils
|
||||
LivingEntity mount;
|
||||
boolean changed = false;
|
||||
|
||||
if (tmp == null)
|
||||
if (tmp == null || !(tmp instanceof LivingEntity))
|
||||
{
|
||||
mountHealth = -1;
|
||||
mountMaxHealth = -1;
|
||||
|
||||
@@ -21,6 +21,8 @@ import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -38,6 +40,9 @@ import markil3.immersive_hud.TimerUtils;
|
||||
@Mixin(ClientPlayerEntity.class)
|
||||
public class ClientPlayerHook
|
||||
{
|
||||
private static final Logger LOGGER =
|
||||
LogManager.getLogger(ClientPlayerHook.class);
|
||||
|
||||
/**
|
||||
* Updates hand timing every time an attack is initiated.
|
||||
*
|
||||
@@ -48,9 +53,20 @@ public class ClientPlayerHook
|
||||
*/
|
||||
@Inject(method = "swingHand", at = @At(value = "TAIL"))
|
||||
public void swingHand(Hand hand, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
TimerUtils.onClick(hand, hand == null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.network" +
|
||||
".ClientPlayerEntity#swingHand " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates hand timing every time an item is used.
|
||||
@@ -62,9 +78,20 @@ public class ClientPlayerHook
|
||||
*/
|
||||
@Inject(method = "setCurrentHand", at = @At(value = "TAIL"))
|
||||
public void setCurrentHand(Hand hand, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
TimerUtils.onClick(hand, hand == null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.network" +
|
||||
".ClientPlayerEntity#setCurrentHand " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates hand timing every the hand is no longer being used.
|
||||
@@ -75,6 +102,8 @@ public class ClientPlayerHook
|
||||
*/
|
||||
@Inject(method = "clearActiveItem", at = @At(value = "HEAD"))
|
||||
public void clearActiveItem(CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MinecraftClient.getInstance().cameraEntity instanceof LivingEntity)
|
||||
{
|
||||
@@ -82,4 +111,13 @@ public class ClientPlayerHook
|
||||
.getActiveHand(), true);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.network" +
|
||||
".ClientPlayerEntity#clearActiveItem " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -40,6 +42,9 @@ import markil3.immersive_hud.TimerUtils;
|
||||
@Mixin(HeldItemRenderer.class)
|
||||
public class HeldItemHook
|
||||
{
|
||||
private static final Logger LOGGER =
|
||||
LogManager.getLogger(HeldItemHook.class);
|
||||
|
||||
/**
|
||||
* Determines whether or not to render a certain hand.
|
||||
*
|
||||
@@ -71,11 +76,22 @@ public class HeldItemHook
|
||||
VertexConsumerProvider vertexConsumers,
|
||||
int light,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TimerUtils.onRenderHand(hand, matrices, tickDelta))
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.render.item" +
|
||||
".HeldItemRenderer#renderFirstPersonItem " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -43,6 +45,8 @@ import markil3.immersive_hud.TimerUtils;
|
||||
@Mixin(InGameHud.class)
|
||||
public class HudHook
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger(HudHook.class);
|
||||
|
||||
private StatusEffectInstance currentEffect;
|
||||
|
||||
/**
|
||||
@@ -57,6 +61,8 @@ public class HudHook
|
||||
@Inject(method = "renderCrosshair", at = @At(value = "HEAD"),
|
||||
cancellable = true)
|
||||
public void startCrosshair(MatrixStack stack, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TimerUtils.drawCrosshair(MinecraftClient.getInstance()
|
||||
.getTickDelta()))
|
||||
@@ -64,6 +70,15 @@ public class HudHook
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#startCrosshair " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets any changes from drawing the crosshair.
|
||||
@@ -76,12 +91,23 @@ public class HudHook
|
||||
*/
|
||||
@Inject(method = "renderCrosshair", at = @At(value = "TAIL"))
|
||||
public void finishCrosshair(MatrixStack stack, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderCrosshair " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or not to draw the horse jump bar.
|
||||
@@ -97,6 +123,8 @@ public class HudHook
|
||||
public void startJumpbar(MatrixStack stack,
|
||||
int x,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TimerUtils.drawJumpbar(stack,
|
||||
MinecraftClient.getInstance().getTickDelta()))
|
||||
@@ -104,6 +132,15 @@ public class HudHook
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderMountJumpBar " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets any changes from drawing the horse jump bar.
|
||||
@@ -118,6 +155,8 @@ public class HudHook
|
||||
public void finishJumpbar(MatrixStack stack,
|
||||
int x,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
stack.pop();
|
||||
/*
|
||||
@@ -125,6 +164,15 @@ public class HudHook
|
||||
*/
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderMountJumpBar " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or not to draw the experience bar.
|
||||
@@ -140,6 +188,8 @@ public class HudHook
|
||||
public void startExperience(MatrixStack stack,
|
||||
int x,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TimerUtils.drawExperience(stack,
|
||||
MinecraftClient.getInstance().getTickDelta()))
|
||||
@@ -147,6 +197,15 @@ public class HudHook
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderExperienceBar " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets any changes from drawing the experience bar.
|
||||
@@ -161,6 +220,8 @@ public class HudHook
|
||||
public void finishExperience(MatrixStack stack,
|
||||
int x,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
stack.pop();
|
||||
/*
|
||||
@@ -168,6 +229,15 @@ public class HudHook
|
||||
*/
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderExperienceBar " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the position of the status bars as the ones below them move up
|
||||
@@ -180,9 +250,20 @@ public class HudHook
|
||||
@ModifyVariable(method = "renderStatusBars(Lnet/minecraft/client/util" +
|
||||
"/math/MatrixStack;)V", at = @At("HEAD"))
|
||||
public MatrixStack startStatus(MatrixStack stack)
|
||||
{
|
||||
try
|
||||
{
|
||||
stack.push();
|
||||
stack.translate(0F, TimerUtils.getHealthTranslation(), 0F);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusBars " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -196,12 +277,23 @@ public class HudHook
|
||||
"/math/MatrixStack;)V", at = @At(value = "INVOKE", target = "Lnet" +
|
||||
"/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"))
|
||||
public void renderArmor(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TimerUtils.drawArmor())
|
||||
{
|
||||
TimerUtils.setAlpha(0F);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusBars " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the health GUI.
|
||||
@@ -214,16 +306,28 @@ public class HudHook
|
||||
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
||||
ordinal = 0))
|
||||
public void renderHealth(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Resets the transparency from the previous call.
|
||||
*/
|
||||
TimerUtils.setAlpha(1F);
|
||||
if (TimerUtils.drawHealth(MinecraftClient.getInstance().getTickDelta()))
|
||||
if (TimerUtils.drawHealth(MinecraftClient.getInstance()
|
||||
.getTickDelta()))
|
||||
{
|
||||
TimerUtils.setAlpha(0F);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusBars " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the food GUI.
|
||||
@@ -236,16 +340,28 @@ public class HudHook
|
||||
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
||||
ordinal = 1))
|
||||
public void renderFood(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Resets the transparency from the previous call.
|
||||
*/
|
||||
TimerUtils.setAlpha(1F);
|
||||
if (TimerUtils.drawHunger(MinecraftClient.getInstance().getTickDelta()))
|
||||
if (TimerUtils.drawHunger(MinecraftClient.getInstance()
|
||||
.getTickDelta()))
|
||||
{
|
||||
TimerUtils.setAlpha(0F);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusBars " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the air GUI.
|
||||
@@ -258,18 +374,40 @@ public class HudHook
|
||||
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
||||
ordinal = 2))
|
||||
public void renderAir(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
TimerUtils.setAlpha(1F);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusBars " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "renderStatusBars(Lnet/minecraft/client/util" +
|
||||
"/math/MatrixStack;)V", at = @At("TAIL"))
|
||||
public MatrixStack finishStatus(MatrixStack stack)
|
||||
{
|
||||
try
|
||||
{
|
||||
stack.pop();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusBars " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -285,6 +423,8 @@ public class HudHook
|
||||
@Inject(method = "renderMountHealth", at = @At(value = "HEAD"),
|
||||
cancellable = true)
|
||||
public void startMountHealth(MatrixStack stack, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TimerUtils.drawMountHealth(stack,
|
||||
MinecraftClient.getInstance().getTickDelta()))
|
||||
@@ -292,6 +432,15 @@ public class HudHook
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderMountHealth " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets any changes from drawing the mount's health.
|
||||
@@ -304,6 +453,8 @@ public class HudHook
|
||||
*/
|
||||
@Inject(method = "renderMountHealth", at = @At(value = "TAIL"))
|
||||
public void finishMountHealth(MatrixStack stack, CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
@@ -311,6 +462,15 @@ public class HudHook
|
||||
stack.pop();
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderMountHealth " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the actual adjustment to the hotbar as needed.
|
||||
@@ -322,11 +482,22 @@ public class HudHook
|
||||
"(Lnet/minecraft/client/util/math/MatrixStack;)V", at =
|
||||
@At(value = "HEAD", shift = At.Shift.AFTER))
|
||||
public void startPotion(MatrixStack effect, CallbackInfo info)
|
||||
{
|
||||
try
|
||||
{
|
||||
TimerUtils.updatePotions(MinecraftClient.getInstance().cameraEntity instanceof ClientPlayerEntity ?
|
||||
((ClientPlayerEntity) MinecraftClient.getInstance().cameraEntity) :
|
||||
null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusEffectOverlay " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the actual adjustment to the hotbar as needed.
|
||||
@@ -341,11 +512,23 @@ public class HudHook
|
||||
"Lnet/minecraft/entity/effect/StatusEffectInstance;" +
|
||||
"shouldShowIcon()Z"))
|
||||
public boolean shouldRenderPotion(StatusEffectInstance effect)
|
||||
{
|
||||
try
|
||||
{
|
||||
currentEffect = effect;
|
||||
return TimerUtils.updatePotion(effect,
|
||||
MinecraftClient.getInstance().getTickDelta());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusEffectOverlay " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the actual adjustment to the hotbar as needed.
|
||||
@@ -361,9 +544,21 @@ public class HudHook
|
||||
@At(value = "STORE"))
|
||||
public float updatePotion(float f,
|
||||
MatrixStack stack)
|
||||
{
|
||||
try
|
||||
{
|
||||
return TimerUtils.getPotionAlpha(currentEffect);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusEffectOverlay " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
return 1F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets any changes from drawing the potion effects.
|
||||
@@ -377,12 +572,23 @@ public class HudHook
|
||||
@Inject(method = "renderStatusEffectOverlay", at = @At(value = "TAIL"))
|
||||
public void finishPotion(MatrixStack matrices,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Resets the color so that nothing else is bothered.
|
||||
*/
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderStatusEffectOverlay " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or not to draw the hotbar.
|
||||
@@ -399,12 +605,23 @@ public class HudHook
|
||||
public void startHotbar(float tickDelta,
|
||||
MatrixStack matrices,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TimerUtils.updateHotbar(tickDelta))
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderHotbar " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the actual adjustment to the hotbar as needed.
|
||||
@@ -422,9 +639,20 @@ public class HudHook
|
||||
public void adjustHotbar(float tickDelta,
|
||||
MatrixStack matrices,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
TimerUtils.recolorHotbar(matrices);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderHotbar " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets any changes from drawing the hotbar.
|
||||
@@ -440,6 +668,8 @@ public class HudHook
|
||||
public void finishHotbar(float tickDelta,
|
||||
MatrixStack stack,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
RenderSystem.popMatrix();
|
||||
stack.pop();
|
||||
@@ -448,4 +678,13 @@ public class HudHook
|
||||
*/
|
||||
TimerUtils.resetAlpha();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(
|
||||
"Error in running net.minecraft.client.gui.hud" +
|
||||
".InGameHud#renderHotbar " +
|
||||
"event",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
"option.immersive_hud.effectFadeIn": "Potion Fade In Time",
|
||||
"option.immersive_hud.effectFadeOut": "Potion Fade Out Time",
|
||||
"option.immersive_hud.crosshairTime": "Crosshair Display Time",
|
||||
"option.immersive_hud.hideCrosshair": "Hide Crosshair",
|
||||
"option.immersive_hud.handTime": "Hand Display Time",
|
||||
"option.immersive_hud.hideHands": "Hide Hands",
|
||||
"option.immersive_hud.minHealth": "Minimum Health Fade",
|
||||
"option.immersive_hud.minHunger": "Minimum Hunger Fade",
|
||||
"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.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.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.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.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"
|
||||
|
||||
Reference in New Issue
Block a user