Catches any errors that occur when triggering events.
It is pretty annoying for the game to crash because of a GUI mod. This should reduce that.
This commit is contained in:
@@ -21,6 +21,8 @@ import net.minecraft.client.network.ClientPlayerEntity;
|
|||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Hand;
|
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.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@@ -38,6 +40,9 @@ import markil3.immersive_hud.TimerUtils;
|
|||||||
@Mixin(ClientPlayerEntity.class)
|
@Mixin(ClientPlayerEntity.class)
|
||||||
public class ClientPlayerHook
|
public class ClientPlayerHook
|
||||||
{
|
{
|
||||||
|
private static final Logger LOGGER =
|
||||||
|
LogManager.getLogger(ClientPlayerHook.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates hand timing every time an attack is initiated.
|
* Updates hand timing every time an attack is initiated.
|
||||||
*
|
*
|
||||||
@@ -48,9 +53,20 @@ public class ClientPlayerHook
|
|||||||
*/
|
*/
|
||||||
@Inject(method = "swingHand", at = @At(value = "TAIL"))
|
@Inject(method = "swingHand", at = @At(value = "TAIL"))
|
||||||
public void swingHand(Hand hand, CallbackInfo callbackInfo)
|
public void swingHand(Hand hand, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
TimerUtils.onClick(hand, hand == null);
|
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.
|
* Updates hand timing every time an item is used.
|
||||||
@@ -62,9 +78,20 @@ public class ClientPlayerHook
|
|||||||
*/
|
*/
|
||||||
@Inject(method = "setCurrentHand", at = @At(value = "TAIL"))
|
@Inject(method = "setCurrentHand", at = @At(value = "TAIL"))
|
||||||
public void setCurrentHand(Hand hand, CallbackInfo callbackInfo)
|
public void setCurrentHand(Hand hand, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
TimerUtils.onClick(hand, hand == null);
|
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.
|
* 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"))
|
@Inject(method = "clearActiveItem", at = @At(value = "HEAD"))
|
||||||
public void clearActiveItem(CallbackInfo callbackInfo)
|
public void clearActiveItem(CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (MinecraftClient.getInstance().cameraEntity instanceof LivingEntity)
|
if (MinecraftClient.getInstance().cameraEntity instanceof LivingEntity)
|
||||||
{
|
{
|
||||||
@@ -82,4 +111,13 @@ public class ClientPlayerHook
|
|||||||
.getActiveHand(), true);
|
.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.item.ItemStack;
|
||||||
import net.minecraft.util.Hand;
|
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.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@@ -40,6 +42,9 @@ import markil3.immersive_hud.TimerUtils;
|
|||||||
@Mixin(HeldItemRenderer.class)
|
@Mixin(HeldItemRenderer.class)
|
||||||
public class HeldItemHook
|
public class HeldItemHook
|
||||||
{
|
{
|
||||||
|
private static final Logger LOGGER =
|
||||||
|
LogManager.getLogger(HeldItemHook.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether or not to render a certain hand.
|
* Determines whether or not to render a certain hand.
|
||||||
*
|
*
|
||||||
@@ -71,11 +76,22 @@ public class HeldItemHook
|
|||||||
VertexConsumerProvider vertexConsumers,
|
VertexConsumerProvider vertexConsumers,
|
||||||
int light,
|
int light,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (TimerUtils.onRenderHand(hand, matrices, tickDelta))
|
if (TimerUtils.onRenderHand(hand, matrices, tickDelta))
|
||||||
{
|
{
|
||||||
callbackInfo.cancel();
|
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.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
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.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@@ -43,6 +45,8 @@ import markil3.immersive_hud.TimerUtils;
|
|||||||
@Mixin(InGameHud.class)
|
@Mixin(InGameHud.class)
|
||||||
public class HudHook
|
public class HudHook
|
||||||
{
|
{
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(HudHook.class);
|
||||||
|
|
||||||
private StatusEffectInstance currentEffect;
|
private StatusEffectInstance currentEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,6 +61,8 @@ public class HudHook
|
|||||||
@Inject(method = "renderCrosshair", at = @At(value = "HEAD"),
|
@Inject(method = "renderCrosshair", at = @At(value = "HEAD"),
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
public void startCrosshair(MatrixStack stack, CallbackInfo callbackInfo)
|
public void startCrosshair(MatrixStack stack, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (TimerUtils.drawCrosshair(MinecraftClient.getInstance()
|
if (TimerUtils.drawCrosshair(MinecraftClient.getInstance()
|
||||||
.getTickDelta()))
|
.getTickDelta()))
|
||||||
@@ -64,6 +70,15 @@ public class HudHook
|
|||||||
callbackInfo.cancel();
|
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.
|
* Resets any changes from drawing the crosshair.
|
||||||
@@ -76,12 +91,23 @@ public class HudHook
|
|||||||
*/
|
*/
|
||||||
@Inject(method = "renderCrosshair", at = @At(value = "TAIL"))
|
@Inject(method = "renderCrosshair", at = @At(value = "TAIL"))
|
||||||
public void finishCrosshair(MatrixStack stack, CallbackInfo callbackInfo)
|
public void finishCrosshair(MatrixStack stack, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Resets the color so that nothing else is bothered.
|
* Resets the color so that nothing else is bothered.
|
||||||
*/
|
*/
|
||||||
TimerUtils.resetAlpha();
|
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.
|
* Determines whether or not to draw the horse jump bar.
|
||||||
@@ -97,6 +123,8 @@ public class HudHook
|
|||||||
public void startJumpbar(MatrixStack stack,
|
public void startJumpbar(MatrixStack stack,
|
||||||
int x,
|
int x,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (TimerUtils.drawJumpbar(stack,
|
if (TimerUtils.drawJumpbar(stack,
|
||||||
MinecraftClient.getInstance().getTickDelta()))
|
MinecraftClient.getInstance().getTickDelta()))
|
||||||
@@ -104,6 +132,15 @@ public class HudHook
|
|||||||
callbackInfo.cancel();
|
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.
|
* Resets any changes from drawing the horse jump bar.
|
||||||
@@ -118,6 +155,8 @@ public class HudHook
|
|||||||
public void finishJumpbar(MatrixStack stack,
|
public void finishJumpbar(MatrixStack stack,
|
||||||
int x,
|
int x,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
stack.pop();
|
stack.pop();
|
||||||
/*
|
/*
|
||||||
@@ -125,6 +164,15 @@ public class HudHook
|
|||||||
*/
|
*/
|
||||||
TimerUtils.resetAlpha();
|
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.
|
* Determines whether or not to draw the experience bar.
|
||||||
@@ -140,6 +188,8 @@ public class HudHook
|
|||||||
public void startExperience(MatrixStack stack,
|
public void startExperience(MatrixStack stack,
|
||||||
int x,
|
int x,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (TimerUtils.drawExperience(stack,
|
if (TimerUtils.drawExperience(stack,
|
||||||
MinecraftClient.getInstance().getTickDelta()))
|
MinecraftClient.getInstance().getTickDelta()))
|
||||||
@@ -147,6 +197,15 @@ public class HudHook
|
|||||||
callbackInfo.cancel();
|
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.
|
* Resets any changes from drawing the experience bar.
|
||||||
@@ -161,6 +220,8 @@ public class HudHook
|
|||||||
public void finishExperience(MatrixStack stack,
|
public void finishExperience(MatrixStack stack,
|
||||||
int x,
|
int x,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
stack.pop();
|
stack.pop();
|
||||||
/*
|
/*
|
||||||
@@ -168,6 +229,15 @@ public class HudHook
|
|||||||
*/
|
*/
|
||||||
TimerUtils.resetAlpha();
|
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
|
* 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" +
|
@ModifyVariable(method = "renderStatusBars(Lnet/minecraft/client/util" +
|
||||||
"/math/MatrixStack;)V", at = @At("HEAD"))
|
"/math/MatrixStack;)V", at = @At("HEAD"))
|
||||||
public MatrixStack startStatus(MatrixStack stack)
|
public MatrixStack startStatus(MatrixStack stack)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
stack.push();
|
stack.push();
|
||||||
stack.translate(0F, TimerUtils.getHealthTranslation(), 0F);
|
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;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,12 +277,23 @@ public class HudHook
|
|||||||
"/math/MatrixStack;)V", at = @At(value = "INVOKE", target = "Lnet" +
|
"/math/MatrixStack;)V", at = @At(value = "INVOKE", target = "Lnet" +
|
||||||
"/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"))
|
"/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"))
|
||||||
public void renderArmor(MatrixStack matrices, CallbackInfo callbackInfo)
|
public void renderArmor(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (TimerUtils.drawArmor())
|
if (TimerUtils.drawArmor())
|
||||||
{
|
{
|
||||||
TimerUtils.setAlpha(0F);
|
TimerUtils.setAlpha(0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.error(
|
||||||
|
"Error in running net.minecraft.client.gui.hud" +
|
||||||
|
".InGameHud#renderStatusBars " +
|
||||||
|
"event",
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts the health GUI.
|
* Adjusts the health GUI.
|
||||||
@@ -214,16 +306,28 @@ public class HudHook
|
|||||||
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
||||||
ordinal = 0))
|
ordinal = 0))
|
||||||
public void renderHealth(MatrixStack matrices, CallbackInfo callbackInfo)
|
public void renderHealth(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Resets the transparency from the previous call.
|
* Resets the transparency from the previous call.
|
||||||
*/
|
*/
|
||||||
TimerUtils.setAlpha(1F);
|
TimerUtils.setAlpha(1F);
|
||||||
if (TimerUtils.drawHealth(MinecraftClient.getInstance().getTickDelta()))
|
if (TimerUtils.drawHealth(MinecraftClient.getInstance()
|
||||||
|
.getTickDelta()))
|
||||||
{
|
{
|
||||||
TimerUtils.setAlpha(0F);
|
TimerUtils.setAlpha(0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.error(
|
||||||
|
"Error in running net.minecraft.client.gui.hud" +
|
||||||
|
".InGameHud#renderStatusBars " +
|
||||||
|
"event",
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts the food GUI.
|
* Adjusts the food GUI.
|
||||||
@@ -236,16 +340,28 @@ public class HudHook
|
|||||||
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
||||||
ordinal = 1))
|
ordinal = 1))
|
||||||
public void renderFood(MatrixStack matrices, CallbackInfo callbackInfo)
|
public void renderFood(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Resets the transparency from the previous call.
|
* Resets the transparency from the previous call.
|
||||||
*/
|
*/
|
||||||
TimerUtils.setAlpha(1F);
|
TimerUtils.setAlpha(1F);
|
||||||
if (TimerUtils.drawHunger(MinecraftClient.getInstance().getTickDelta()))
|
if (TimerUtils.drawHunger(MinecraftClient.getInstance()
|
||||||
|
.getTickDelta()))
|
||||||
{
|
{
|
||||||
TimerUtils.setAlpha(0F);
|
TimerUtils.setAlpha(0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.error(
|
||||||
|
"Error in running net.minecraft.client.gui.hud" +
|
||||||
|
".InGameHud#renderStatusBars " +
|
||||||
|
"event",
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the air GUI.
|
* Resets the air GUI.
|
||||||
@@ -258,18 +374,40 @@ public class HudHook
|
|||||||
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
|
||||||
ordinal = 2))
|
ordinal = 2))
|
||||||
public void renderAir(MatrixStack matrices, CallbackInfo callbackInfo)
|
public void renderAir(MatrixStack matrices, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Resets the color so that nothing else is bothered.
|
* Resets the color so that nothing else is bothered.
|
||||||
*/
|
*/
|
||||||
TimerUtils.setAlpha(1F);
|
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" +
|
@ModifyVariable(method = "renderStatusBars(Lnet/minecraft/client/util" +
|
||||||
"/math/MatrixStack;)V", at = @At("TAIL"))
|
"/math/MatrixStack;)V", at = @At("TAIL"))
|
||||||
public MatrixStack finishStatus(MatrixStack stack)
|
public MatrixStack finishStatus(MatrixStack stack)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
stack.pop();
|
stack.pop();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.error(
|
||||||
|
"Error in running net.minecraft.client.gui.hud" +
|
||||||
|
".InGameHud#renderStatusBars " +
|
||||||
|
"event",
|
||||||
|
e);
|
||||||
|
}
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,6 +423,8 @@ public class HudHook
|
|||||||
@Inject(method = "renderMountHealth", at = @At(value = "HEAD"),
|
@Inject(method = "renderMountHealth", at = @At(value = "HEAD"),
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
public void startMountHealth(MatrixStack stack, CallbackInfo callbackInfo)
|
public void startMountHealth(MatrixStack stack, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (TimerUtils.drawMountHealth(stack,
|
if (TimerUtils.drawMountHealth(stack,
|
||||||
MinecraftClient.getInstance().getTickDelta()))
|
MinecraftClient.getInstance().getTickDelta()))
|
||||||
@@ -292,6 +432,15 @@ public class HudHook
|
|||||||
callbackInfo.cancel();
|
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.
|
* Resets any changes from drawing the mount's health.
|
||||||
@@ -304,6 +453,8 @@ public class HudHook
|
|||||||
*/
|
*/
|
||||||
@Inject(method = "renderMountHealth", at = @At(value = "TAIL"))
|
@Inject(method = "renderMountHealth", at = @At(value = "TAIL"))
|
||||||
public void finishMountHealth(MatrixStack stack, CallbackInfo callbackInfo)
|
public void finishMountHealth(MatrixStack stack, CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Resets the color so that nothing else is bothered.
|
* Resets the color so that nothing else is bothered.
|
||||||
@@ -311,6 +462,15 @@ public class HudHook
|
|||||||
stack.pop();
|
stack.pop();
|
||||||
TimerUtils.resetAlpha();
|
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.
|
* Makes the actual adjustment to the hotbar as needed.
|
||||||
@@ -322,11 +482,22 @@ public class HudHook
|
|||||||
"(Lnet/minecraft/client/util/math/MatrixStack;)V", at =
|
"(Lnet/minecraft/client/util/math/MatrixStack;)V", at =
|
||||||
@At(value = "HEAD", shift = At.Shift.AFTER))
|
@At(value = "HEAD", shift = At.Shift.AFTER))
|
||||||
public void startPotion(MatrixStack effect, CallbackInfo info)
|
public void startPotion(MatrixStack effect, CallbackInfo info)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
TimerUtils.updatePotions(MinecraftClient.getInstance().cameraEntity instanceof ClientPlayerEntity ?
|
TimerUtils.updatePotions(MinecraftClient.getInstance().cameraEntity instanceof ClientPlayerEntity ?
|
||||||
((ClientPlayerEntity) MinecraftClient.getInstance().cameraEntity) :
|
((ClientPlayerEntity) MinecraftClient.getInstance().cameraEntity) :
|
||||||
null);
|
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.
|
* Makes the actual adjustment to the hotbar as needed.
|
||||||
@@ -341,11 +512,23 @@ public class HudHook
|
|||||||
"Lnet/minecraft/entity/effect/StatusEffectInstance;" +
|
"Lnet/minecraft/entity/effect/StatusEffectInstance;" +
|
||||||
"shouldShowIcon()Z"))
|
"shouldShowIcon()Z"))
|
||||||
public boolean shouldRenderPotion(StatusEffectInstance effect)
|
public boolean shouldRenderPotion(StatusEffectInstance effect)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
currentEffect = effect;
|
currentEffect = effect;
|
||||||
return TimerUtils.updatePotion(effect,
|
return TimerUtils.updatePotion(effect,
|
||||||
MinecraftClient.getInstance().getTickDelta());
|
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.
|
* Makes the actual adjustment to the hotbar as needed.
|
||||||
@@ -361,9 +544,21 @@ public class HudHook
|
|||||||
@At(value = "STORE"))
|
@At(value = "STORE"))
|
||||||
public float updatePotion(float f,
|
public float updatePotion(float f,
|
||||||
MatrixStack stack)
|
MatrixStack stack)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return TimerUtils.getPotionAlpha(currentEffect);
|
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.
|
* Resets any changes from drawing the potion effects.
|
||||||
@@ -377,12 +572,23 @@ public class HudHook
|
|||||||
@Inject(method = "renderStatusEffectOverlay", at = @At(value = "TAIL"))
|
@Inject(method = "renderStatusEffectOverlay", at = @At(value = "TAIL"))
|
||||||
public void finishPotion(MatrixStack matrices,
|
public void finishPotion(MatrixStack matrices,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Resets the color so that nothing else is bothered.
|
* Resets the color so that nothing else is bothered.
|
||||||
*/
|
*/
|
||||||
TimerUtils.resetAlpha();
|
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.
|
* Determines whether or not to draw the hotbar.
|
||||||
@@ -399,12 +605,23 @@ public class HudHook
|
|||||||
public void startHotbar(float tickDelta,
|
public void startHotbar(float tickDelta,
|
||||||
MatrixStack matrices,
|
MatrixStack matrices,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (TimerUtils.updateHotbar(tickDelta))
|
if (TimerUtils.updateHotbar(tickDelta))
|
||||||
{
|
{
|
||||||
callbackInfo.cancel();
|
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.
|
* Makes the actual adjustment to the hotbar as needed.
|
||||||
@@ -422,9 +639,20 @@ public class HudHook
|
|||||||
public void adjustHotbar(float tickDelta,
|
public void adjustHotbar(float tickDelta,
|
||||||
MatrixStack matrices,
|
MatrixStack matrices,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
TimerUtils.recolorHotbar(matrices);
|
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.
|
* Resets any changes from drawing the hotbar.
|
||||||
@@ -440,6 +668,8 @@ public class HudHook
|
|||||||
public void finishHotbar(float tickDelta,
|
public void finishHotbar(float tickDelta,
|
||||||
MatrixStack stack,
|
MatrixStack stack,
|
||||||
CallbackInfo callbackInfo)
|
CallbackInfo callbackInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
stack.pop();
|
stack.pop();
|
||||||
@@ -448,4 +678,13 @@ public class HudHook
|
|||||||
*/
|
*/
|
||||||
TimerUtils.resetAlpha();
|
TimerUtils.resetAlpha();
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.error(
|
||||||
|
"Error in running net.minecraft.client.gui.hud" +
|
||||||
|
".InGameHud#renderHotbar " +
|
||||||
|
"event",
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user