Skip to content

Commit

Permalink
Don't invert crosshair colors (#250)
Browse files Browse the repository at this point in the history
Don't invert crosshair colors
  • Loading branch information
Alexdoru authored Sep 23, 2023
1 parent 2870646 commit 7d5bdb0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/LoadingConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public class LoadingConfig {
public boolean removeCreativeSearchTab;

public boolean compactChat;
public boolean dontInvertCrosshairColor;
public boolean enhanceNightVision;
public boolean enableMacosCmdShortcuts;
public boolean fixFontRendererLinewrapRecursion;
Expand Down Expand Up @@ -280,6 +281,7 @@ public LoadingConfig(File file) {
validatePacketEncodingBeforeSendingShouldCrash = config.get(Category.FIXES.toString(), "validatePacketEncodingBeforeSendingShouldCrash", false, "Should the extended packet validation error cause a crash (true) or just print out an error to the log (false)").getBoolean();

compactChat = config.get(Category.TWEAKS.toString(), "Compact chat", true, "Compacts identical consecutive chat messages together").getBoolean();
dontInvertCrosshairColor = config.get(Category.TWEAKS.toString(), "dontInvertCrosshairColor", false, "Stop inverting colors of crosshair").getBoolean();
enhanceNightVision = config.get(Category.TWEAKS.toString(), "enhanceNightVision", false, "Remove the blueish sky tint from night vision").getBoolean();
hideCrosshairInThirdPerson = config.get(Category.TWEAKS.toString(), "hideCrosshairInThirdPerson", true, "Stops rendering the crosshair when you are playing in third person").getBoolean();
hideIc2ReactorSlots = config.get(Category.TWEAKS.toString(), "hideIc2ReactorSlots", true, "Prevent IC2's reactor's coolant slots from being accessed by automations if not a fluid reactor").getBoolean();
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,12 @@ public enum Mixins {
STATIC_LAN_PORT(new Builder("Static Lan Port").setPhase(Phase.EARLY)
.addMixinClasses("minecraft.server.MixinHttpUtil").setSide(Side.CLIENT)
.setApplyIf(() -> Common.config.enableDefaultLanPort).addTargetedMod(TargetedMod.VANILLA)),
CROSSHAIR_THIRDPERSON(new Builder("Crosshairs Thirdperson").setPhase(Phase.EARLY)
.addMixinClasses("forge.MixinGuiIngameForge").setSide(Side.CLIENT)
CROSSHAIR_THIRDPERSON(new Builder("Crosshairs thirdperson").setPhase(Phase.EARLY)
.addMixinClasses("forge.MixinGuiIngameForge_CrosshairThirdPerson").setSide(Side.CLIENT)
.setApplyIf(() -> Common.config.hideCrosshairInThirdPerson).addTargetedMod(TargetedMod.VANILLA)),
DONT_INVERT_CROSSHAIR_COLORS(new Builder("Don't invert crosshair colors").setPhase(Phase.EARLY)
.addMixinClasses("forge.MixinGuiIngameForge_CrosshairInvertColors").setSide(Side.CLIENT)
.setApplyIf(() -> Common.config.dontInvertCrosshairColor).addTargetedMod(TargetedMod.VANILLA)),
FIX_OPENGUIHANDLER_WINDOWID(new Builder("Fix OpenGuiHandler").setPhase(Phase.EARLY)
.addMixinClasses("forge.MixinOpenGuiHandler").setApplyIf(() -> Common.config.fixForgeOpenGuiHandlerWindowId)
.addTargetedMod(TargetedMod.VANILLA)),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.mitchej123.hodgepodge.mixins.early.forge;

import net.minecraftforge.client.GuiIngameForge;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import com.llamalad7.mixinextras.injector.WrapWithCondition;

@Mixin(GuiIngameForge.class)
public class MixinGuiIngameForge_CrosshairInvertColors {

@WrapWithCondition(
method = "renderCrosshairs",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/OpenGlHelper;glBlendFunc(IIII)V"))
private boolean hodgepodge$dontInvertColors(int i1, int i2, int i3, int i4) {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GuiIngameForge.class)
public class MixinGuiIngameForge extends GuiIngame {
public class MixinGuiIngameForge_CrosshairThirdPerson extends GuiIngame {

@Inject(method = "renderCrosshairs", at = @At("HEAD"), cancellable = true, remap = false)
public void hodgepodge$hideCrosshairThirdPerson(int width, int height, CallbackInfo ci) {
Expand All @@ -19,7 +19,7 @@ public class MixinGuiIngameForge extends GuiIngame {
}
}

private MixinGuiIngameForge(Minecraft mc) {
private MixinGuiIngameForge_CrosshairThirdPerson(Minecraft mc) {
super(mc);
}
}

0 comments on commit 7d5bdb0

Please sign in to comment.