Combit/src/main/java/io/gitlab/jfronny/combit/mixin/InGameHudMixin.java

32 lines
1.3 KiB
Java
Raw Normal View History

2020-10-27 20:13:31 +01:00
package io.gitlab.jfronny.combit.mixin;
2022-06-08 11:46:10 +02:00
import io.gitlab.jfronny.combit.*;
import net.minecraft.client.*;
import net.minecraft.client.gui.hud.*;
import net.minecraft.client.option.*;
import net.minecraft.client.util.math.*;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.*;
2020-10-27 20:13:31 +01:00
@Mixin(InGameHud.class)
public class InGameHudMixin {
@Shadow @Final private MinecraftClient client;
2021-12-29 23:36:10 +01:00
private AttackIndicator combit$attackIndicator;
2020-10-27 20:13:31 +01:00
@Inject(at = @At("HEAD"), method = "renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V")
private void renderCrosshair(MatrixStack matrices, CallbackInfo info) {
2021-12-29 23:36:10 +01:00
if (CombitConfig.cooldownProgressOverride >= 0) {
2022-06-08 11:46:10 +02:00
combit$attackIndicator = this.client.options.getAttackIndicator().getValue();
this.client.options.getAttackIndicator().setValue(AttackIndicator.OFF);
2020-10-27 20:13:31 +01:00
}
}
@Inject(at = @At("RETURN"), method = "renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V")
private void renderCrosshairPost(MatrixStack matrices, CallbackInfo info) {
2021-12-29 23:36:10 +01:00
if (CombitConfig.cooldownProgressOverride >= 0) {
2022-06-08 11:46:10 +02:00
this.client.options.getAttackIndicator().setValue(combit$attackIndicator);
2020-10-27 20:13:31 +01:00
}
}
}