Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 0245483

Browse files
committed
add HitColor option, allow Snap Perspective mode
1 parent b643df2 commit 0245483

File tree

10 files changed

+79
-25
lines changed

10 files changed

+79
-25
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,9 @@
7272

7373
- fix KeyBindOptions not being saved
7474
- since this is a critical fix, this will also be released for 1.19.2
75-
- add 'Snap-Perspective' mode to Freelook
75+
- add 'Snap-Perspective' mode to Freelook
76+
77+
### 2.2.8
78+
79+
- HitColor option
80+
- Allow Snap Perspective mode to be used on servers where Freelook is disallowed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ dependencies {
7171

7272
// More hacks that make mac os work
7373
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
74-
configurations.all {
74+
configurations.configureEach {
7575
resolutionStrategy {
7676
dependencySubstitution {
7777
substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-201408222') using module('org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209')
@@ -83,7 +83,7 @@ if (System.getProperty("os.name").toLowerCase().contains("mac")) {
8383
}
8484

8585
// Fix netty with Java 17+ (be happy if it didn't break for you)
86-
configurations.all {
86+
configurations.configureEach {
8787
resolutionStrategy {
8888
dependencySubstitution {
8989
substitute module('io.netty:netty-all:4.0.23.Final') using module('io.netty:netty-all:4.0.26.Final')
@@ -153,7 +153,7 @@ modrinth {
153153
gameVersions = ["${project.minecraft_version}"]
154154
loaders = ["fabric"]
155155
dependencies {
156-
//required.project "legacy-fabric-api" // Once lfapi is on modrinth (aka 'its next release')
156+
required.project "legacy-fabric-api"
157157
}
158158

159159
// Changelog fetching: Credit LambdAurora.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx1G
1212
archives_base_name = AxolotlClient
1313

1414
# Dependencies
15-
fabric_version = 1.8.0+1.8.9
15+
fabric_version = 1.9.0+1.8.9
1616

1717
# AxolotlClientConfig
1818
config_version = 1.0.14

src/main/java/io/github/axolotlclient/config/AxolotlClientConfig.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class AxolotlClientConfig extends ConfigHolder {
5757
public final BooleanOption dynamicFOV = new BooleanOption("axolotlclient.dynamicFov", true);
5858
public final BooleanOption fullBright = new BooleanOption("axolotlclient.fullBright", false);
5959
public final BooleanOption lowFire = new BooleanOption("axolotlclient.lowFire", false);
60+
public final ColorOption hitColor = new ColorOption("axolotlclient.hitColor", new Color(255, 0, 0, 77));
6061

6162
public final ColorOption loadingScreenColor = new ColorOption("axolotlclient.loadingBgColor", new Color(-1));
6263
public final BooleanOption nightMode = new BooleanOption("axolotlclient.nightMode", false);
@@ -128,7 +129,13 @@ public void init() {
128129
AxolotlClientConfigConfig.searchSort, AxolotlClientConfigConfig.searchSortOrder);
129130
general.addSubCategory(searchFilters);
130131

131-
rendering.add(customSky, cloudHeight, AxolotlClientConfigConfig.chromaSpeed, dynamicFOV, fullBright, lowFire);
132+
rendering.add(customSky,
133+
cloudHeight,
134+
AxolotlClientConfigConfig.chromaSpeed,
135+
dynamicFOV,
136+
fullBright,
137+
lowFire,
138+
hitColor);
132139

133140
timeChanger.add(timeChangerEnabled);
134141
timeChanger.add(customTime);

src/main/java/io/github/axolotlclient/mixin/LivingEntityRendererMixin.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
import net.minecraft.text.LiteralText;
3333
import net.minecraft.text.Text;
3434
import org.spongepowered.asm.mixin.Mixin;
35-
import org.spongepowered.asm.mixin.injection.At;
36-
import org.spongepowered.asm.mixin.injection.Inject;
37-
import org.spongepowered.asm.mixin.injection.Redirect;
35+
import org.spongepowered.asm.mixin.injection.*;
3836
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3937
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
4038

@@ -70,4 +68,24 @@ public void addBadge(LivingEntity livingEntity, double d, double e, double f, Ca
7068
else if (!NickHider.getInstance().hideOtherNames.get() && !livingEntity.equals(MinecraftClient.getInstance().player))
7169
AxolotlClient.addBadge(livingEntity);
7270
}
71+
72+
@ModifyConstant(method = "method_10252", constant = @Constant(floatValue = 1.0f, ordinal = 0))
73+
private float customHitColorRed(float constant){
74+
return AxolotlClient.CONFIG.hitColor.get().getRed()/255F;
75+
}
76+
77+
@ModifyConstant(method = "method_10252", constant = @Constant(floatValue = 0.0f, ordinal = 0))
78+
private float customHitColorGreen(float constant){
79+
return AxolotlClient.CONFIG.hitColor.get().getGreen()/255F;
80+
}
81+
82+
@ModifyConstant(method = "method_10252", constant = @Constant(floatValue = 0.0f, ordinal = 1))
83+
private float customHitColorBlue(float constant){
84+
return AxolotlClient.CONFIG.hitColor.get().getBlue()/255F;
85+
}
86+
87+
@ModifyConstant(method = "method_10252", constant = @Constant(floatValue = 0.3f, ordinal = 0))
88+
private float customHitColorAlpha(float constant){
89+
return AxolotlClient.CONFIG.hitColor.get().getAlpha()/255F;
90+
}
7391
}

src/main/java/io/github/axolotlclient/modules/freelook/Freelook.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import io.github.axolotlclient.AxolotlclientConfig.options.EnumOption;
2828
import io.github.axolotlclient.AxolotlclientConfig.options.OptionCategory;
2929
import io.github.axolotlclient.modules.AbstractModule;
30+
import io.github.axolotlclient.util.FeatureDisabler;
3031
import net.legacyfabric.fabric.api.client.keybinding.v1.KeyBindingHelper;
3132
import net.minecraft.client.MinecraftClient;
3233
import net.minecraft.client.options.KeyBinding;
@@ -46,7 +47,10 @@ public class Freelook extends AbstractModule {
4647

4748
private final OptionCategory category = new OptionCategory("axolotlclient.freelook");
4849
public final BooleanOption enabled = new BooleanOption("axolotlclient.enabled", false);
49-
private final EnumOption mode = new EnumOption("axolotlclient.mode", new String[]{"axolotlclient.snap_perspective", "axolotlclient.freelook"}, "axolotlclient.freelook");
50+
private final EnumOption mode = new EnumOption("axolotlclient.mode",
51+
new String[]{"axolotlclient.snap_perspective", "axolotlclient.freelook"},
52+
value -> FeatureDisabler.update(),
53+
"axolotlclient.freelook");
5054
private final EnumOption perspective = new EnumOption("axolotlclient.perspective", Perspective.values(),
5155
Perspective.THIRD_PERSON_BACK.toString());
5256
private final BooleanOption invert = new BooleanOption("axolotlclient.invert", false);
@@ -114,7 +118,7 @@ private void stop() {
114118
}
115119

116120
public boolean consumeRotation(float dx, float dy) {
117-
if (!active || !enabled.get() || !mode.get().equals("freelook"))
121+
if (!active || !enabled.get() || !mode.get().equals("axolotlclient.freelook"))
118122
return false;
119123

120124
if (!invert.get())
@@ -134,16 +138,20 @@ public boolean consumeRotation(float dx, float dy) {
134138
}
135139

136140
public float yaw(float defaultValue) {
137-
if (!active || !enabled.get() || !mode.get().equals("freelook"))
141+
if (!active || !enabled.get() || !mode.get().equals("axolotlclient.freelook"))
138142
return defaultValue;
139143

140144
return yaw;
141145
}
142146

143147
public float pitch(float defaultValue) {
144-
if (!active || !enabled.get() || !mode.get().equals("freelook"))
148+
if (!active || !enabled.get() || !mode.get().equals("axolotlclient.freelook"))
145149
return defaultValue;
146150

147151
return pitch;
148152
}
153+
154+
public boolean needsDisabling(){
155+
return mode.get().equals("axolotlclient.freelook");
156+
}
149157
}

src/main/java/io/github/axolotlclient/modules/rpc/DiscordRPC.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import net.fabricmc.loader.api.FabricLoader;
4040
import net.fabricmc.loader.api.ModContainer;
4141
import net.minecraft.client.MinecraftClient;
42+
import net.minecraft.client.resource.language.I18n;
4243

4344
import java.time.Instant;
4445
import java.util.Optional;
@@ -87,7 +88,7 @@ public void init() {
8788
AxolotlClient.CONFIG.addCategory(category);
8889

8990
if (OSUtil.getOS() == OSUtil.OperatingSystem.OTHER) {
90-
enabled.setForceOff(true, "axolotlclient.crash");
91+
enabled.setForceOff(true, I18n.translate("axolotlclient.crash"));
9192
}
9293

9394
Optional<ModContainer> container = FabricLoader.getInstance().getModContainer("axolotlclient");

src/main/java/io/github/axolotlclient/modules/rpc/gameSdk/GameSdkDownloader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import io.github.axolotlclient.modules.rpc.DiscordRPC;
2727
import io.github.axolotlclient.util.Logger;
2828
import io.github.axolotlclient.util.OSUtil;
29+
import net.minecraft.client.resource.language.I18n;
2930

3031
import java.io.File;
3132
import java.io.IOException;
@@ -82,7 +83,7 @@ public static void downloadSdk() {
8283

8384
if (!sdk.exists() || !jni.exists()) {
8485
Logger.error("Could not download GameSDK, no copy is available. RPC will be disabled.");
85-
DiscordRPC.getInstance().enabled.setForceOff(true, "axolotlclient.crash");
86+
DiscordRPC.getInstance().enabled.setForceOff(true, I18n.translate("axolotlclient.crash"));
8687
return;
8788
}
8889

@@ -142,7 +143,7 @@ private static void extractJni(File jni) throws IOException {
142143
extractJni(jni);
143144
} else {
144145
Logger.error("Extracting Jni failed, restart your game to try again.");
145-
DiscordRPC.getInstance().enabled.setForceOff(true, "axolotlclient.crash");
146+
DiscordRPC.getInstance().enabled.setForceOff(true, I18n.translate("axolotlclient.crash"));
146147
}
147148
}
148149

src/main/java/io/github/axolotlclient/util/FeatureDisabler.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,30 @@
2525
import io.github.axolotlclient.AxolotlClient;
2626
import io.github.axolotlclient.AxolotlclientConfig.options.BooleanOption;
2727
import io.github.axolotlclient.modules.freelook.Freelook;
28+
import net.minecraft.client.resource.language.I18n;
2829

2930
import java.util.HashMap;
3031
import java.util.Locale;
32+
import java.util.function.Supplier;
3133

3234
public class FeatureDisabler {
3335

3436
private static final HashMap<BooleanOption, String[]> disabledServers = new HashMap<>();
37+
private static final HashMap<BooleanOption, Supplier<Boolean>> conditions = new HashMap<>();
38+
39+
private static final Supplier<Boolean> NONE = () -> true;
40+
41+
private static String currentAdress;
3542

3643
public static void init() {
37-
setServers(AxolotlClient.CONFIG.fullBright, "gommehd");
38-
setServers(AxolotlClient.CONFIG.timeChangerEnabled, "gommehd");
39-
setServers(Freelook.getInstance().enabled, "hypixel", "mineplex", "gommehd", "nucleoid");
44+
setServers(AxolotlClient.CONFIG.fullBright, NONE, "gommehd");
45+
setServers(AxolotlClient.CONFIG.timeChangerEnabled, NONE, "gommehd");
46+
setServers(Freelook.getInstance().enabled, () -> Freelook.getInstance().needsDisabling(), "hypixel", "mineplex", "gommehd", "nucleoid");
4047
}
4148

4249
public static void onServerJoin(String address) {
43-
disabledServers.forEach((option, strings) -> disableOption(option, strings, address));
50+
currentAdress = address;
51+
update();
4452
}
4553

4654
public static void clear() {
@@ -51,17 +59,22 @@ private static void disableOption(BooleanOption option, String[] servers, String
5159
boolean ban = false;
5260
for (String s : servers) {
5361
if (currentServer.toLowerCase(Locale.ROOT).contains(s.toLowerCase(Locale.ROOT))) {
54-
ban = true;
62+
ban = conditions.get(option).get();
5563
break;
5664
}
5765
}
5866

5967
if (option.getForceDisabled() != ban) {
60-
option.setForceOff(ban, "axolotlclient.ban_reason");
68+
option.setForceOff(ban, I18n.translate("axolotlclient.ban_reason"));
6169
}
6270
}
6371

64-
private static void setServers(BooleanOption option, String... servers) {
72+
private static void setServers(BooleanOption option, Supplier<Boolean> condition, String... servers) {
6573
disabledServers.put(option, servers);
74+
conditions.put(option, condition);
75+
}
76+
77+
public static void update(){
78+
disabledServers.forEach((option, strings) -> disableOption(option, strings, currentAdress));
6679
}
6780
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"smoothCamera.tooltip": "Whether to enable smooth camera while zoomed.",
3434
"dynamicFov": "Dynamic FOV",
3535
"fullBright": "FullBright",
36+
"hitColor": "Hit Color",
3637
"strength": "Strength",
3738
"inGuis": "Apply to GUIs",
3839
"lowFire": "Low Fire",
@@ -302,8 +303,8 @@
302303
"contributors": "Contributors",
303304
"other_people": "Other People",
304305
"external_modules": "External Modules",
305-
"disableReason.crash.tooltip": "This option has been disabled <br>because it would crash your game.",
306-
"disableReason.ban_reason.tooltip": "This option is disabled <br>because it is known to be bannable on your current server.",
306+
"disableReason.crash": "This option has been disabled <br>because it would crash your game.",
307+
"ban_reason": "This option is disabled <br>because it is known to be bannable on your current server.",
307308
"back": "Back",
308309
"close": "Close"
309310
}

0 commit comments

Comments
 (0)