Skip to content

Commit 55e7bc5

Browse files
committed
forgot this in the push oopsies
1 parent 3955d2e commit 55e7bc5

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* This program is free software; you can redistribute it and/or
3+
* modify it under the terms of the GNU Lesser General Public
4+
* License as published by the Free Software Foundation; either
5+
* version 3 of the License, or (at your option) any later version.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10+
* Lesser General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU Lesser General Public License
13+
* along with this program; if not, write to the Free Software Foundation,
14+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15+
*
16+
* For more information, see the LICENSE file.
17+
*/
18+
19+
package io.github.axolotlclient.oldanimations.mixin.mob_layers;
20+
21+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
22+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
23+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
24+
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
25+
import net.minecraft.client.render.entity.layer.WornSkullLayer;
26+
import net.minecraft.entity.living.LivingEntity;
27+
import org.spongepowered.asm.mixin.Mixin;
28+
import org.spongepowered.asm.mixin.injection.At;
29+
import org.spongepowered.asm.mixin.injection.Inject;
30+
import org.spongepowered.asm.mixin.injection.ModifyArg;
31+
import org.spongepowered.asm.mixin.injection.ModifyVariable;
32+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
33+
34+
@Mixin(WornSkullLayer.class)
35+
public class WornSkullLayerMixin {
36+
37+
//TODO: Figure out how to color the skull layer with the 1.7 logic??
38+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/living/LivingEntity;isSneaking()Z"))
39+
private boolean axolotlclient$disableSneakTranslation(LivingEntity instance, Operation<Boolean> original) {
40+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get()) {
41+
/* we need to remove the sneaking offset since we will be using our own */
42+
return false;
43+
}
44+
return original.call(instance);
45+
}
46+
47+
@ModifyVariable(method = "render", at = @At("STORE"))
48+
private boolean axolotlclient$disableHumanoidCheck(boolean value) {
49+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.skullLayerRendering.get()) {
50+
/* goodbye villager-specific worn skull rendering :p */
51+
return false;
52+
}
53+
return value;
54+
}
55+
56+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/living/LivingEntity;isBaby()Z"))
57+
private boolean axolotlclient$disableBabyCheck(LivingEntity instance, Operation<Boolean> original) {
58+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.skullLayerRendering.get()) {
59+
/* the baby will NOT be getting special treatment */
60+
return false;
61+
}
62+
return original.call(instance);
63+
}
64+
65+
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;rotatef(FFFF)V"), index = 0)
66+
private float axolotlclient$oldBlockRotation(float f) {
67+
/* taken from 1.7 */
68+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.skullLayerRendering.get()) {
69+
return 90;
70+
}
71+
return f;
72+
}
73+
74+
@ModifyExpressionValue(method = "render", at = @At(value = "CONSTANT", args = "floatValue=1.1875"))
75+
private float axolotlclient$useOldScale(float original) {
76+
/* taken from 1.7 */
77+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.skullLayerRendering.get()) {
78+
return 1.0625F;
79+
}
80+
return original;
81+
}
82+
83+
@Inject(method = "colorsWhenDamaged", at = @At("HEAD"), cancellable = true)
84+
private void axolotlclient$removeDamageColor(CallbackInfoReturnable<Boolean> callback) {
85+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.noSkullLayerDamageTint.get()) {
86+
/* disables coloring the second layer just like 1.7 */
87+
callback.setReturnValue(false);
88+
}
89+
}
90+
}

0 commit comments

Comments
 (0)