Skip to content

Commit d308a95

Browse files
committed
my bad, this was the last thing i think
1 parent b8f3e6b commit d308a95

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class OldAnimationsConfig {
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);
65-
public final BooleanOption thirdPersonSmoothSneaking = new BooleanOption("thirdPersonSmoothSneaking", true);
65+
public final BooleanOption thirdPersonSneaking = new BooleanOption("thirdPersonSneaking", false);
6666
public final BooleanOption allowMiningCancel = new BooleanOption("allowMiningCancel", true);
6767
public final BooleanOption damageColor = new BooleanOption("damageColor", true);
6868
public final BooleanOption stickRod = new BooleanOption("stickRod", false);
@@ -136,7 +136,7 @@ public void initConfig() {
136136
categorySneaking.add(
137137
smoothSneaking,
138138
slowUpSneak,
139-
thirdPersonSmoothSneaking
139+
thirdPersonSneaking
140140
);
141141
category.add(categoryItems);
142142
categoryItems.add(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public abstract class EntityRendererMixin {
5252
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.flameOffset.get() && PlayerUtil.isSelf(entity)) {
5353
/* taken from 1.7 */
5454
/* we must make sure the flame is synced with the interpolated player model position */
55-
original += (OldAnimationsConfig.instance.thirdPersonSmoothSneaking.get() ? ((Sneaky) Minecraft.getInstance().gameRenderer).axolotlclient$getEyeHeight() : entity.getEyeHeight());
55+
original += (OldAnimationsConfig.instance.thirdPersonSneaking.get() ? ((Sneaky) Minecraft.getInstance().gameRenderer).axolotlclient$getEyeHeight() : entity.getEyeHeight());
5656
}
5757
return original;
5858
}
@@ -64,7 +64,7 @@ public abstract class EntityRendererMixin {
6464
GlStateManager.pushMatrix();
6565
/* taken from 1.7 */
6666
/* we must make sure the flame is synced with the interpolated player model position */
67-
float eyeHeight = (OldAnimationsConfig.instance.thirdPersonSmoothSneaking.get() ? ((Sneaky) Minecraft.getInstance().gameRenderer).axolotlclient$getEyeHeight() : entity.getEyeHeight());
67+
float eyeHeight = (OldAnimationsConfig.instance.thirdPersonSneaking.get() ? ((Sneaky) Minecraft.getInstance().gameRenderer).axolotlclient$getEyeHeight() : entity.getEyeHeight());
6868
GlStateManager.translatef(0.0F, eyeHeight, 0.0F);
6969
}
7070
original.call(instance, entity, dx, dy, dz, tickDelta);

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ public abstract class GameRendererMixin implements Sneaky {
5858
@Inject(method = "setupCamera", at = @At("HEAD"))
5959
protected void axolotlclient$lerpCamera(float partialTicks, int pass, CallbackInfo ci) {
6060
/* eye height is interpolated between the last and current camera Y positions */
61-
if (isSneakingEnabled()) eyeHeight = lerp(partialTicks, lastCameraY, cameraY);
61+
if (!OldAnimationsConfig.isEnabled()) return;
62+
if (OldAnimationsConfig.instance.smoothSneaking.get()) {
63+
eyeHeight = lerp(partialTicks, lastCameraY, cameraY);
64+
} else if (OldAnimationsConfig.instance.slowUpSneak.get()) {
65+
eyeHeight = cameraY;
66+
}
6267
}
6368

6469
@ModifyVariable(method = "transformCamera", at = @At(value = "STORE"), ordinal = 1)
@@ -67,12 +72,12 @@ public abstract class GameRendererMixin implements Sneaky {
6772
/* just use the 1.8 eyeheight while sleeping :p */
6873
return eyeHeight;
6974
}
70-
return isSneakingEnabled() ? axolotlclient$getEyeHeight() : eyeHeight; /* player eye height */
75+
return axolotlclient$isEitherSneakOptionEnabled() ? axolotlclient$getEyeHeight() : eyeHeight;
7176
}
7277

7378
@ModifyArg(method = "renderAxisIndicators", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;translatef(FFF)V"), index = 1)
7479
private float axolotlclient$useLerpEyeHeight_Debug(float x) {
75-
return isSneakingEnabled() ? axolotlclient$getEyeHeight() : x; /* debug crosshair parity */
80+
return axolotlclient$isEitherSneakOptionEnabled() ? axolotlclient$getEyeHeight() : x; /* debug crosshair parity */
7681
}
7782

7883
@WrapOperation(method = "renderAxisIndicators", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/living/player/LocalClientPlayerEntity;hasReducedDebugInfo()Z"))
@@ -83,7 +88,7 @@ public abstract class GameRendererMixin implements Sneaky {
8388
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HeldItemRenderer;updateHeldItem()V")) /* placed below null check */
8489
private void axolotlclient$updateCameraY(CallbackInfo ci) {
8590
/* updates the current eye height */
86-
if (!isSneakingEnabled()) {
91+
if (!axolotlclient$isEitherSneakOptionEnabled()) {
8792
return;
8893
}
8994
Entity entity = minecraft.getCamera();
@@ -110,8 +115,9 @@ private static float lerp(float delta, float start, float end) { /* taken straig
110115
}
111116

112117
@Unique
113-
private static boolean isSneakingEnabled() {
114-
return OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.smoothSneaking.get();
118+
private boolean axolotlclient$isEitherSneakOptionEnabled() {
119+
/* if neither of the sneaking options are selection, we might as well just use the original eyeheight */
120+
return OldAnimationsConfig.isEnabled() && (OldAnimationsConfig.instance.smoothSneaking.get() || OldAnimationsConfig.instance.slowUpSneak.get());
115121
}
116122

117123
@Override

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected LivingEntityRendererMixin(EntityRenderDispatcher entityRenderDispatche
112112
@Inject(method = "render(Lnet/minecraft/entity/living/LivingEntity;DDDFF)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;translatef(FFF)V"))
113113
private void axolotlclient$addSneakingTranslation(LivingEntity livingEntity, double d, double e, double f, float g, float h, CallbackInfo ci) {
114114
/* in order to match 1.7, we need to elevate the player model while sneaking */
115-
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSmoothSneaking.get() && PlayerUtil.isSelf(livingEntity)) {
115+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get() && PlayerUtil.isSelf(livingEntity)) {
116116
if (livingEntity.isSneaking()) {
117117
/* we need to remove the already existing sneaking offset */
118118
/* which is present in BiPedModel#render, PlayerEntityModel#render, and related classes */
@@ -135,7 +135,7 @@ protected LivingEntityRendererMixin(EntityRenderDispatcher entityRenderDispatche
135135

136136
@ModifyArg(method = "renderNameTag(Lnet/minecraft/entity/living/LivingEntity;DDD)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;translatef(FFF)V", ordinal = 0), index = 1)
137137
private float axolotlclient$syncNameTag(float f, @Local(argsOnly = true) LivingEntity livingEntity) {
138-
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSmoothSneaking.get() && PlayerUtil.isSelf(livingEntity)) {
138+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get() && PlayerUtil.isSelf(livingEntity)) {
139139
/* we must ensurethe nametag is synced with the interpolated player model position */
140140
f += ((Sneaky) Minecraft.getInstance().gameRenderer).axolotlclient$getEyeHeight() - 1.62F;
141141
}
@@ -144,7 +144,7 @@ protected LivingEntityRendererMixin(EntityRenderDispatcher entityRenderDispatche
144144

145145
@ModifyArg(method = "renderNameTag(Lnet/minecraft/entity/living/LivingEntity;DDD)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/LivingEntityRenderer;renderNameTag(Lnet/minecraft/entity/Entity;DDDLjava/lang/String;FD)V"), index = 2)
146146
private double axolotlclient$syncNameTag2(double par2, @Local(argsOnly = true) LivingEntity livingEntity) {
147-
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSmoothSneaking.get() && PlayerUtil.isSelf(livingEntity)) {
147+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get() && PlayerUtil.isSelf(livingEntity)) {
148148
/* we must ensure the nametag is synced with the interpolated player model position once again */
149149
par2 += ((Sneaky) Minecraft.getInstance().gameRenderer).axolotlclient$getEyeHeight() - 1.62F;
150150
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"itemPositions.tooltip": "Applies transformations to held items to place them in the same positions they were in 1.7.",
2121
"secondLayerDamageTint": "Second Layer Damage Tint",
2222
"secondLayerDamageTint.tooltip": "Applies the damage tint to the second layer of entities. This means that the player's armor, spider eyes, and endermen eyes will be tinted.",
23-
"smoothSneaking": "Smooth Sneaking (First Person)",
23+
"smoothSneaking": "Smooth Sneaking",
2424
"smoothSneaking.tooltip": "Smoothly interpolates the player's changing eye height as they sneak.",
2525
"heartFlashing": "Heart Flashing",
2626
"heartFlashing.tooltip": "Stops the filled-in heart overlay from showing in the hotbar while taking damage.",
@@ -38,8 +38,8 @@
3838
"debugTextColorScheme.tooltip": "Applies the mismatched color scheme of the 1.7 debug menu",
3939
"debugTextShadow": "Enable Text Shadow",
4040
"debugTextShadow.tooltip": "Enables text shadow.",
41-
"thirdPersonSmoothSneaking": "Smooth Sneaking (Third Person)",
42-
"thirdPersonSmoothSneaking.tooltip": "Smoothly interpolates the player's model position as they sneak. Only viewable while in the third person perspective.",
41+
"thirdPersonSneaking": "Third Person Sneaking Position",
42+
"thirdPersonSneaking.tooltip": "Positions the player model to mimic it's position while sneaking in 1.7. Only viewable in third person mode.",
4343
"allowMiningCancel": "Cancel Mining by Using",
4444
"allowMiningCancel.tooltip": "Allows the player to \"cancel\" their mining progress by using an item.",
4545
"damageColor": "Damage Tint Color",
@@ -89,7 +89,7 @@
8989
"oldSwingVisualParticles": "Show Particles on Missed Hits",
9090
"oldSwingVisualParticles.tooltip": "Visually shows particles (criticals, sharpness, etc) during missed hits given the appropriate conditions.",
9191
"slowUpSneak": "Slow Sneak-Up Animation",
92-
"slowUpSneak.tooltip": "Makes the sneaking up animation slow to match 1.7",
92+
"slowUpSneak.tooltip": "Makes the sneaking up animation slower to match 1.7",
9393
"stopLineTranslateSneak": "Stop Fishing Rod Line Translation while Sneaking",
9494
"stopLineTranslateSneak.tooltip": "Stops the fishing rod's line from translating down while sneaking. Only viewable while in the third person perspective.",
9595
"fixCameraPitch": "Fix Camera Pitch Bug",

0 commit comments

Comments
 (0)