Skip to content

Commit

Permalink
possible mixin fix
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Apr 14, 2024
1 parent 5f5fe17 commit 9e97a51
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@ public abstract class EntityMixin {

@Shadow public abstract float getXRot();

@ModifyExpressionValue(method = "turn", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;clamp(FFF)F"))
@Shadow public float xRotO;

@ModifyExpressionValue(method = "turn", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;clamp(FFF)F", ordinal = 0))
private float icarus$updateLookDirection(float original) {
var self = (Entity)(Object) this;
if(self instanceof LivingEntity living) {
if(Entity.class.cast(this) instanceof LivingEntity living) {
return IcarusHelper.hasWings.test(living) ? Mth.wrapDegrees(this.getXRot()) : original;
}
return original;
}

@ModifyExpressionValue(method = "turn", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;clamp(FFF)F", ordinal = 1))
private float icarus$updateLookDirection0(float original) {
if (Entity.class.cast(this) instanceof LivingEntity living) {
return IcarusHelper.hasWings.test(living) ? Mth.wrapDegrees(this.xRotO) : original;
}
return original;
}
}

0 comments on commit 9e97a51

Please sign in to comment.