Skip to content

Commit 2f3b4d4

Browse files
committed
fix custom crosshair compat!
1 parent d308a95 commit 2f3b4d4

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/main/java/io/github/axolotlclient/oldanimations/config/OldAnimationsConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class OldAnimationsConfig {
5858
public final BooleanOption show1_7_10 = new BooleanOption("show1_7_10", false);
5959
public final BooleanOption debugInfo = new BooleanOption("debugInfo", true);
6060
public final BooleanOption disableDebugBackground = new BooleanOption("disableDebugBackground", true);
61-
public final BooleanOption debugCrosshair = new BooleanOption("debugCrosshair", true);
61+
public final BooleanOption alwaysShowCrosshair = new BooleanOption("alwaysShowCrosshair", true);
6262
public final BooleanOption debugTextSpacing = new BooleanOption("debugTextSpacing", true);
6363
public final BooleanOption debugTextColorScheme = new BooleanOption("debugTextColorScheme", true);
6464
public final BooleanOption debugTextShadow = new BooleanOption("debugTextShadow", true);
@@ -165,6 +165,7 @@ public void initConfig() {
165165
categoryGUI.add(
166166
show1_7_10,
167167
heartFlashing,
168+
alwaysShowCrosshair,
168169
centeredSelectionMenus,
169170
disableServerSelectionButtons,
170171
disableUnknownServerIcon,
@@ -176,7 +177,6 @@ public void initConfig() {
176177
categoryDebugOverlay.add(
177178
debugInfo,
178179
disableDebugBackground,
179-
debugCrosshair,
180180
debugTextSpacing,
181181
debugTextColorScheme,
182182
debugTextShadow

src/main/java/io/github/axolotlclient/oldanimations/mixin/GameGuiMixin.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2222
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
23+
import io.github.axolotlclient.AxolotlClient;
24+
import io.github.axolotlclient.AxolotlClientConfig.impl.AxolotlClientConfigMod;
25+
import io.github.axolotlclient.modules.hud.HudManager;
26+
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.CrosshairHud;
27+
import io.github.axolotlclient.oldanimations.OldAnimations;
2328
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
2429
import net.minecraft.client.gui.GameGui;
2530
import net.minecraft.client.render.Window;
@@ -56,7 +61,8 @@ public abstract class GameGuiMixin {
5661

5762
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GameGui;hasCrosshair()Z"))
5863
private boolean axolotlclient$enableCrosshair(GameGui instance, Operation<Boolean> original) {
59-
return (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.debugCrosshair.get()) || original.call(instance);
64+
boolean isCustomCrosshair = OldAnimations.AXOLOTLCLIENT && HudManager.getInstance().get(CrosshairHud.ID).isEnabled();
65+
return (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.alwaysShowCrosshair.get() && !isCustomCrosshair) || original.call(instance);
6066
}
6167

6268
@Unique

src/main/java/io/github/axolotlclient/oldanimations/mixin/GameRendererMixin.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2323
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2424
import com.llamalad7.mixinextras.sugar.Local;
25+
import io.github.axolotlclient.modules.hud.HudManager;
26+
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.CrosshairHud;
27+
import io.github.axolotlclient.oldanimations.OldAnimations;
2528
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
2629
import io.github.axolotlclient.oldanimations.ducks.Sneaky;
2730
import net.minecraft.client.Minecraft;
@@ -82,7 +85,8 @@ public abstract class GameRendererMixin implements Sneaky {
8285

8386
@WrapOperation(method = "renderAxisIndicators", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/living/player/LocalClientPlayerEntity;hasReducedDebugInfo()Z"))
8487
private boolean axolotlclient$disableAxisIndicator(LocalClientPlayerEntity instance, Operation<Boolean> original) {
85-
return (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.debugCrosshair.get()) || original.call(instance);
88+
boolean isCustomCrosshair = OldAnimations.AXOLOTLCLIENT && HudManager.getInstance().get(CrosshairHud.ID).isEnabled();
89+
return (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.alwaysShowCrosshair.get() && !isCustomCrosshair) || original.call(instance);
8690
}
8791

8892
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HeldItemRenderer;updateHeldItem()V")) /* placed below null check */

src/main/resources/assets/axolotlclient-oldanimations/lang/en_us.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"debugInfo.tooltip": "Use debug information found in the 1.7 debug menu.",
3131
"disableDebugBackground": "Disable Background",
3232
"disableDebugBackground.tooltip": "Disables the background on text.",
33-
"debugCrosshair": "Show Crosshair",
34-
"debugCrosshair.tooltip": "Replaces the axis indicator with the regular crosshair.",
33+
"alwaysShowCrosshair": "Always Show Crosshair",
34+
"alwaysShowCrosshair.tooltip": "Always shows the crosshair. Replaces the debug menu axis indicator with the regular crosshair as it doesn't exist in 1.7.",
3535
"debugTextSpacing": "Text Spacing",
3636
"debugTextSpacing.tooltip": "Spaces the text in a manner that is identical to 1.7.",
3737
"debugTextColorScheme": "Color Scheme",

0 commit comments

Comments
 (0)