diff --git a/src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java b/src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java index cb2e5486d..a3d936a11 100644 --- a/src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java +++ b/src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java @@ -38,6 +38,7 @@ public enum Mixins implements IMixins { , "angelica.MixinMinecraftServer" , "angelica.bugfixes.MixinItemRenderer_EdgeDepth" , "angelica.bugfixes.MixinModelCreeper_AuraBodyInflate" + , "angelica.bugfixes.MixinModelSkeleton_LegPelvisZFight" , "angelica.bugfixes.MixinModelWither_ArmorCentering" , "angelica.bugfixes.MixinRenderBlocks_CrossedSquaresNormal" , "angelica.bugfixes.MixinRenderCreeper_AuraDepth" diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/bugfixes/MixinModelSkeleton_LegPelvisZFight.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/bugfixes/MixinModelSkeleton_LegPelvisZFight.java new file mode 100644 index 000000000..173286974 --- /dev/null +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/bugfixes/MixinModelSkeleton_LegPelvisZFight.java @@ -0,0 +1,31 @@ +package com.gtnewhorizons.angelica.mixins.early.angelica.bugfixes; + +import net.minecraft.client.model.ModelSkeleton; +import net.minecraft.entity.Entity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** + * Prevents z-fighting between the skeleton's leg tops and the pelvis (bipedBody) bottom face. + */ +@Mixin(ModelSkeleton.class) +public class MixinModelSkeleton_LegPelvisZFight { + + @Unique + private static final float LEG_PIVOT_Y = Float.intBitsToFloat(Float.floatToIntBits(12.0F) + 128); + + @Inject( + method = "setRotationAngles(FFFFFFLnet/minecraft/entity/Entity;)V", + at = @At("TAIL") + ) + private void angelica$nudgeLegsBelowPelvis(float swing, float swingAmount, float ticks, + float headYaw, float headPitch, float scale, + Entity entity, CallbackInfo ci) { + final ModelSkeleton self = (ModelSkeleton) (Object) this; + self.bipedRightLeg.rotationPointY = LEG_PIVOT_Y; + self.bipedLeftLeg.rotationPointY = LEG_PIVOT_Y; + } +}