Skip to content

Commit d6b8219

Browse files
committed
Add camera settings and disable selfie cam feature
1 parent e07b9d5 commit d6b8219

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ minecraft_version=1.21.5
66
yarn_mappings=1.21.5+build.1
77
loader_version=0.16.14
88
# Mod Properties
9-
mod_version=1.1.2
9+
mod_version=1.1.3
1010
maven_group=com.github
1111
archives_base_name=scaleme
1212
# Dependencies
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.github.scaleme.client.mixin;
2+
3+
import com.github.scaleme.config.ScaleMeConfig;
4+
import net.minecraft.client.option.Perspective;
5+
import org.spongepowered.asm.mixin.Mixin;
6+
import org.spongepowered.asm.mixin.injection.At;
7+
import org.spongepowered.asm.mixin.injection.Inject;
8+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
9+
10+
@Mixin(Perspective.class)
11+
public class PerspectiveMixin {
12+
13+
/**
14+
* Intercepts the perspective cycling to skip front view when selfie cam is disabled
15+
*/
16+
@Inject(method = "next", at = @At("HEAD"), cancellable = true)
17+
private void skipFrontView(CallbackInfoReturnable<Perspective> cir) {
18+
if (ScaleMeConfig.disableSelfieCam) {
19+
Perspective current = (Perspective) (Object) this;
20+
21+
// If we're currently in third person back view and trying to cycle to front view,
22+
// skip directly to first person instead
23+
if (current == Perspective.THIRD_PERSON_BACK) {
24+
cir.setReturnValue(Perspective.FIRST_PERSON);
25+
}
26+
}
27+
}
28+
}

src/main/java/com/github/scaleme/config/ScaleMeConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class ScaleMeConfig extends MidnightConfig {
88
public static final String PLAYER_PRESETS = "player_presets";
99
public static final String HYPIXEL_SAFETY = "hypixel_safety";
1010
public static final String CROSSHAIR = "crosshair";
11+
public static final String CAMERA = "camera";
1112

1213
@Comment(category = SCALING, name = "Change the visual size of your own player model")
1314
public static Comment ownPlayerDescription;
@@ -64,4 +65,10 @@ public class ScaleMeConfig extends MidnightConfig {
6465

6566
@Entry(category = CROSSHAIR, name = "Show Crosshair in Third Person (Front View)")
6667
public static boolean enableCrosshairInThirdPersonFront = false;
68+
69+
@Comment(category = CAMERA, name = "Control camera behavior and perspective options")
70+
public static Comment cameraDescription;
71+
72+
@Entry(category = CAMERA, name = "Disable Selfie Cam (Front View)")
73+
public static boolean disableSelfieCam = false;
6774
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scaleme.midnightconfig.category.player_presets": "Player Presets",
66
"scaleme.midnightconfig.category.hypixel_safety": "Hypixel SAFETY Settings",
77
"scaleme.midnightconfig.category.crosshair": "Crosshair Settings",
8+
"scaleme.midnightconfig.category.camera": "Camera Settings",
89
"scaleme.midnightconfig.ownPlayerDescription.label": "Change the visual size of your own player model",
910
"scaleme.midnightconfig.ownPlayerScale.label": "Own Player Scale",
1011
"scaleme.midnightconfig.ownPlayerScale.tooltip": "Controls how large or small your own player appears visually",
@@ -38,7 +39,11 @@
3839
"scaleme.midnightconfig.enableCrosshairInThirdPerson.tooltip": "Display the crosshair when viewing from behind your character (F5 once)",
3940
"scaleme.midnightconfig.enableCrosshairInThirdPersonFront.label": "Show Crosshair in Third Person (Front View)",
4041
"scaleme.midnightconfig.enableCrosshairInThirdPersonFront.tooltip": "Display the crosshair when viewing from in front of your character (F5 twice)",
42+
"scaleme.midnightconfig.cameraDescription.label": "Control camera behavior and perspective options",
43+
"scaleme.midnightconfig.disableSelfieCam.label": "Disable Selfie Cam (Front View)",
44+
"scaleme.midnightconfig.disableSelfieCam.tooltip": "Prevent cycling to front-facing third person view when pressing F5",
4145
"key.scaleme.open_config": "Open ScaleMe Config",
46+
"key.scaleme.open_presets": "Open Player Presets",
4247
"category.scaleme.general": "ScaleMe",
4348

4449
"scaleme.gui.presets.title": "Player Scaling. Set a custom scale for specific players.",

src/main/resources/scaleme.mixins.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"compatibilityLevel": "JAVA_21",
66
"refmap": "scaleme.refmap.json",
77
"client": [
8+
"MixinInGameHud",
9+
"PerspectiveMixin",
810
"PlayerEntityRendererMixin",
9-
"PlayerEntityRenderStateMixin",
10-
"MixinInGameHud"
11+
"PlayerEntityRenderStateMixin"
1112
],
1213
"injectors": {
1314
"defaultRequire": 1

0 commit comments

Comments
 (0)