Skip to content

Commit

Permalink
Crosshair using wrong settings, update on spectator/f5 change. Fix #105
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Sep 8, 2023
1 parent aaef06a commit 70c60a7
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import dev.tr7zw.exordium.access.VanillaBufferAccess.CrosshairOverlayAccess;
import dev.tr7zw.exordium.util.BufferedComponent;
import net.minecraft.client.AttackIndicatorStatus;
import net.minecraft.client.CameraType;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiGraphics;
Expand All @@ -27,15 +28,19 @@ public class CrosshairMixin implements CrosshairOverlayAccess {
private float lastYaw = 0;
private float lastCooldown = 0;
private boolean lastHighlight = false;
private boolean lastHidden = false;

private BufferedComponent crosshairBufferedComponent = new BufferedComponent(true,
() -> ExordiumModBase.instance.config.debugScreenSettings) {
() -> ExordiumModBase.instance.config.crosshairSettings) {

@Override
public boolean needsRender() {
if (wasRenderingF3 != minecraft.options.renderDebug) {
return true;
}
if(lastHidden != ((minecraft.options.getCameraType() != CameraType.FIRST_PERSON) || minecraft.player.isSpectator())) {
return true;
}
if (wasRenderingF3) {
return lastPitch != minecraft.getCameraEntity().getXRot()
|| lastYaw != minecraft.getCameraEntity().getYRot();
Expand All @@ -58,6 +63,7 @@ public boolean needsRender() {

@Override
public void captureState() {
lastHidden = minecraft.options.getCameraType() != CameraType.FIRST_PERSON || minecraft.player.isSpectator();
wasRenderingF3 = minecraft.options.renderDebug;
lastPitch = minecraft.getCameraEntity().getXRot();
lastYaw = minecraft.getCameraEntity().getYRot();
Expand Down

0 comments on commit 70c60a7

Please sign in to comment.