Skip to content

Commit ba500e0

Browse files
committed
okay the damage tint is PERFECT now
1 parent 92c213c commit ba500e0

File tree

7 files changed

+102
-63
lines changed

7 files changed

+102
-63
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ public class OldAnimationsConfig {
111111
public final BooleanOption thirdPersonCapePosition = new BooleanOption("thirdPersonCapePosition", false);
112112
public final BooleanOption oldSpongeTexture = new BooleanOption("oldSpongeTexture", false);
113113
public final BooleanOption oldTallGrassTexture = new BooleanOption("oldTallGrassTexture", false);
114+
public final BooleanOption oldFogGrayScale = new BooleanOption("oldFogGrayScale", true);
115+
public final BooleanOption oldDamageTintLighting = new BooleanOption("oldDamageTintLighting", true);
114116

115117
private final Supplier<Boolean>[] suppliers = new Supplier[] {
116118
enabled::get,
@@ -182,7 +184,8 @@ public void initConfig() {
182184
oldSwingVisualParticles,
183185
secondLayerDamageTint,
184186
damageColor,
185-
oldDamageTick
187+
oldDamageTick,
188+
oldDamageTintLighting
186189
);
187190
category.add(categoryGUI);
188191
categoryGUI.add(
@@ -228,7 +231,8 @@ public void initConfig() {
228231
flameOffset,
229232
oldPickupArm,
230233
fixCameraPitch,
231-
xpOrbPosition
234+
xpOrbPosition,
235+
oldFogGrayScale
232236
);
233237

234238
/* reload the resources upon toggling certain options */

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import net.minecraft.client.render.GameRenderer;
3333
import net.minecraft.entity.Entity;
3434
import net.minecraft.entity.living.LivingEntity;
35+
import net.minecraft.util.math.BlockPos;
3536
import org.objectweb.asm.Opcodes;
3637
import org.spongepowered.asm.mixin.Mixin;
3738
import org.spongepowered.asm.mixin.Shadow;
@@ -49,6 +50,9 @@ public abstract class GameRendererMixin implements Sneaky {
4950
/* why you not final :( */
5051
private Minecraft minecraft;
5152

53+
@Shadow
54+
private float oldFogGrayScale;
55+
5256
@Unique
5357
private float lastCameraY;
5458

@@ -90,19 +94,30 @@ public abstract class GameRendererMixin implements Sneaky {
9094
}
9195

9296
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HeldItemRenderer;updateHeldItem()V")) /* placed below null check */
93-
private void axolotlclient$updateCameraY(CallbackInfo ci) {
97+
private void axolotlclient$onTick(CallbackInfo ci) {
9498
/* updates the current eye height */
95-
if (!axolotlclient$isEitherSneakOptionEnabled()) {
99+
if (!OldAnimationsConfig.isEnabled()) {
96100
return;
97101
}
98102
Entity entity = minecraft.getCamera();
99-
float eyeHeight = entity.getEyeHeight();
100-
lastCameraY = cameraY;
101-
if (OldAnimationsConfig.instance.slowUpSneak.get() && eyeHeight > cameraY) {
102-
cameraY += (eyeHeight - cameraY) * 0.5f;
103-
} else {
104-
cameraY = eyeHeight;
103+
if ((OldAnimationsConfig.instance.smoothSneaking.get() || OldAnimationsConfig.instance.slowUpSneak.get())) {
104+
float eyeHeight = entity.getEyeHeight();
105+
lastCameraY = cameraY;
106+
if (OldAnimationsConfig.instance.slowUpSneak.get() && eyeHeight > cameraY) {
107+
cameraY += (eyeHeight - cameraY) * 0.5f;
108+
} else {
109+
cameraY = eyeHeight;
110+
}
105111
}
112+
113+
/* MC-51150 is already fixed by optifine lmfaoo... */
114+
/* in order to actually give players an option to toggle it, */
115+
/* i think this overwrite is warranted :) */
116+
BlockPos pos = OldAnimationsConfig.instance.oldFogGrayScale.get() ? new BlockPos(minecraft.getCamera().getEyePosition(1.0F)) : new BlockPos(minecraft.getCamera());
117+
float f = minecraft.world.getBrightness(pos);
118+
float g = (float) minecraft.options.viewDistance / 16.0F;
119+
float h = f * (1.0F - g) + g;
120+
oldFogGrayScale = oldFogGrayScale + (h - oldFogGrayScale) * 0.1F;
106121
}
107122

108123
@ModifyExpressionValue(method = "applyHurtCam", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/living/LivingEntity;hurtTime:I"))

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ protected LivingEntityRendererMixin(EntityRenderDispatcher entityRenderDispatche
133133
return original;
134134
}
135135

136+
@ModifyExpressionValue(method = "setupOverlayColor(Lnet/minecraft/entity/living/LivingEntity;FZ)Z", at = @At(value = "CONSTANT", args = "floatValue=1.0", ordinal = 0))
137+
private float axolotlclient$damageTintLighting(float original, @Local(index = 4, ordinal = 1) float g) {
138+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.oldDamageTintLighting.get()) {
139+
return g; /* this will basically make the tint influenced by lighting */
140+
}
141+
return original;
142+
}
143+
136144
@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)
137145
private float axolotlclient$syncNameTag(float f, @Local(argsOnly = true) LivingEntity livingEntity) {
138146
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get() && PlayerUtil.isSelf(livingEntity)) {
@@ -162,7 +170,7 @@ protected LivingEntityRendererMixin(EntityRenderDispatcher entityRenderDispatche
162170

163171
@Override
164172
public boolean axolotlclient$setupOverlayColor(@NotNull LivingEntity livingEntity, float partialTicks) {
165-
/* trick to ensure the brightnessBuffer is updated*/
173+
/* trick to ensure the brightnessBuffer is updated */
166174
if (setupOverlayColor(livingEntity, partialTicks, true)) tearDownOverlayColor();
167175
/* if there are any performance issues, blame this */
168176

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
package io.github.axolotlclient.oldanimations.mixin;
2020

21+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
2122
import com.llamalad7.mixinextras.sugar.Share;
2223
import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef;
2324
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
@@ -52,4 +53,10 @@ public class PlayerModelMixin extends HumanoidModel {
5253
cape.pivotY = pivotY.get();
5354
}
5455
}
56+
57+
@ModifyExpressionValue(method = "translateRightArm", at = @At(value = "CONSTANT", args = "floatValue=1.0F"))
58+
private float axolotlclient$fixAlexArmOffset(float original) {
59+
/* this modification isn't exactly related to 1.7 visuals, but it's close enough that i should include it :P */
60+
return original / (!OldAnimationsConfig.isEnabled() || OldAnimationsConfig.instance.disableAlexModel.get() ? 1.0F : 2.0F);
61+
}
5562
}

src/main/java/io/github/axolotlclient/oldanimations/util/DebugComponents.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public static List<String> getLeftBottom() {
6565
Object[] var14 = new Object[]{playerPosX, MathHelper.floor(playerPosX), MathHelper.floor(playerPosX) >> 4, MathHelper.floor(playerPosX) & 15};
6666
list.add(String.format(var13, Arrays.copyOf(var14, var14.length)));
6767
var13 = "y: %.3f (feet pos, %.3f eyes pos)";
68+
/* this eyeheight stuff is actually directly a fix for MC-51150... */
6869
var14 = new Object[]{mc.player.getShape().minY, playerPosY + (double)((Sneaky) Minecraft.getInstance().gameRenderer).axolotlclient$getEyeHeight()};
6970
list.add(String.format(var13, Arrays.copyOf(var14, var14.length)));
7071
var13 = "z: %.5f (%d) // c: %d (%d)";

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,9 @@
134134
"oldSpongeTexture": "Old Sponge Texture",
135135
"oldSpongeTexture.tooltip": "Reverts the texture of the sponge to it's older counterpart. Toggling this will reload the game resources!",
136136
"oldTallGrassTexture": "Old Tall/Double Grass Textures",
137-
"oldTallGrassTexture.tooltip": "Reverts the textures of tall/double grass to their slightly darker and older counterpart! Toggling this will reload the game resources!"
137+
"oldTallGrassTexture.tooltip": "Reverts the textures of tall/double grass to their slightly darker and older counterpart! Toggling this will reload the game resources!",
138+
"oldFogGrayScale": "Old Fog Grayscale Logic",
139+
"oldFogGrayScale.tooltip": "Calculates fog's grayscale effect starting from the player's eyeline and not their feet just like in 1.7.",
140+
"oldDamageTintLighting": "Apply Lighting to Damage Tint",
141+
"oldDamageTintLighting.tooltip": "Allows the damage tint's red hue to be influenced by the surrounding lighting just like in 1.7."
138142
}
Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
{
2-
"required": true,
3-
"package": "io.github.axolotlclient.oldanimations.mixin",
4-
"compatibilityLevel": "JAVA_8",
5-
"mixinextras": {
6-
"minVersion": "0.5.0-rc.2"
7-
},
8-
"client": [
9-
"BlockModelAccessor",
10-
"CapeLayerMixin",
11-
"ChatOptionsScreenMixin",
12-
"ClientPlayerInteractionManagerAccessor",
13-
"ClientPlayNetworkHandlerMixin",
14-
"DebugOverlayMixin",
15-
"EntityPickupParticleMixin",
16-
"EntityRenderDispatcherMixin",
17-
"EntityRendererMixin",
18-
"FishingBobberEntityRendererMixin",
19-
"GameGuiMixin",
20-
"GameRendererMixin",
21-
"GuiElementMixin",
22-
"HeldItemLayerMixin",
23-
"HeldItemRendererMixin",
24-
"HumanoidModelMixin",
25-
"ItemEntityRendererMixin",
26-
"ItemRendererMixin",
27-
"KeyBindingMixin",
28-
"ListWidgetMixin",
29-
"LivingEntityAccessor",
30-
"LivingEntityRendererMixin",
31-
"MinecraftMixin",
32-
"ModelBakeryMixin",
33-
"ModelTransformationsMixin",
34-
"OptionsScreenMixin",
35-
"PlayerModelMixin",
36-
"PlayerRendererMixin",
37-
"PlayerTabOverlayMixin",
38-
"ProjectileRendererMixin",
39-
"ServerListEntryWidgetMixin",
40-
"ServerPlayerEntityMixin",
41-
"mob_layers.AbstractArmorLayerMixin",
42-
"mob_layers.EnderDragonEyesLayerMixin",
43-
"mob_layers.EndermanEyesLayerMixin",
44-
"mob_layers.PigSaddleLayerMixin",
45-
"mob_layers.SheepFurLayerMixin",
46-
"mob_layers.SlimeOuterLayerMixin",
47-
"mob_layers.SpiderEyesLayerMixin",
48-
"mob_layers.WolfCollarLayerMixin"
49-
],
50-
"injectors": {
51-
"defaultRequire": 1
52-
}
2+
"required": true,
3+
"package": "io.github.axolotlclient.oldanimations.mixin",
4+
"compatibilityLevel": "JAVA_8",
5+
"mixinextras": {
6+
"minVersion": "0.5.0-rc.2"
7+
},
8+
"client": [
9+
"BlockModelAccessor",
10+
"CapeLayerMixin",
11+
"ChatOptionsScreenMixin",
12+
"ClientPlayerInteractionManagerAccessor",
13+
"ClientPlayNetworkHandlerMixin",
14+
"DebugOverlayMixin",
15+
"EntityPickupParticleMixin",
16+
"EntityRenderDispatcherMixin",
17+
"EntityRendererMixin",
18+
"FishingBobberEntityRendererMixin",
19+
"GameGuiMixin",
20+
"GameRendererMixin",
21+
"GuiElementMixin",
22+
"HeldItemLayerMixin",
23+
"HeldItemRendererMixin",
24+
"HumanoidModelMixin",
25+
"ItemEntityRendererMixin",
26+
"ItemRendererMixin",
27+
"KeyBindingMixin",
28+
"ListWidgetMixin",
29+
"LivingEntityAccessor",
30+
"LivingEntityRendererMixin",
31+
"MinecraftMixin",
32+
"ModelBakeryMixin",
33+
"ModelTransformationsMixin",
34+
"OptionsScreenMixin",
35+
"PlayerModelMixin",
36+
"PlayerRendererMixin",
37+
"PlayerTabOverlayMixin",
38+
"ProjectileRendererMixin",
39+
"ServerListEntryWidgetMixin",
40+
"ServerPlayerEntityMixin",
41+
"mob_layers.AbstractArmorLayerMixin",
42+
"mob_layers.EnderDragonEyesLayerMixin",
43+
"mob_layers.EndermanEyesLayerMixin",
44+
"mob_layers.PigSaddleLayerMixin",
45+
"mob_layers.SheepFurLayerMixin",
46+
"mob_layers.SlimeOuterLayerMixin",
47+
"mob_layers.SpiderEyesLayerMixin",
48+
"mob_layers.WolfCollarLayerMixin"
49+
],
50+
"injectors": {
51+
"defaultRequire": 1
52+
}
5353
}

0 commit comments

Comments
 (0)